Skip to content

v0.15.0

Compare
Choose a tag to compare
@github-actions github-actions released this 05 Jan 14:17
· 553 commits to main since this release

This release brings 2 new linter rules, and a few improvements and fixes.

New rule: deprecated-builtin

Category: bugs

Calling deprecated built-in functions should always be avoided, and replacing them is usually trivial. Refer to the OPA docs on strict mode for more details on which built-in functions counts as deprecated.

For more information, see the docs on deprecated-builtin.

New rule: default-over-not

Category: style

Avoid

package policy

import future.keywords.if

username := input.user.name

username := "anonymous" if not input.user.name

Prefer

package policy

default username := "anonymous"

username := input.user.name

While both forms are valid, using the default keyword to assign a constant value in the fallback case better
communicates intent, avoids negation where it isn't needed, and requires less instructions to evaluate. Note that this
rule only covers simple cases where one rule assigns the "happy" path, and another rule assigns on the same condition
negated. This is by design, as using not and negation may very well be the right choice for more complex cases!

For more information, see the docs on default-over-not.

Other improvements

  • Ignore directives can now be placed anywhere in a comment, and not just at the start of one. Thanks @nevumx for requesting this!

Bugs fixed

  • SARIF output format: omit region for violations with whole file as location. Thanks @travbale for reporting this!
  • SARIF output format: fix incorrect level of notice and use none instead. Thanks @travbale for reporting this!

Community

  • The Minder project was added as an adopter. Thanks @JAORMX for this!

Changelog