use-strings-count
Summary: Use strings.count
where possible
Category: Idiomatic
Avoid
package policy
num_as := count(indexof_n("foobarbaz", "a"))
Prefer
package policy
num_as := strings.count("foobarbaz", "a")
Rationale
The strings.count
function added in OPA v0.67.0
is both more readable and efficient compared to using count(indexof_n(...))
and should therefore be preferred.