Skip to content

v0.14.0

Compare
Choose a tag to compare
@github-actions github-actions released this 05 Dec 08:01
· 131 commits to main since this release
b9342d4

This release brings 2 new linter rules, a new output format, and many improvements and fixes.

New rule: boolean-assignment

Category: idiomatic

Assigning the result of a boolean expression is often redundant, and the expression is better placed in the rule body, following an if. This also makes for a more readable rule.

# Instead of this
more_than_one_member := count(input.members) > 1

# Prefer this
more_than_one_member if count(input.members) > 1

For more information, see the docs on boolean-assignment.

New rule: redundant-existence-check

Category: bugs

Checking whether a reference is defined immediately before it's used isn't needed, as an undefined value will have evaluation fail either way:

# Instead of this
employee if {
    input.user.email
    endswith(input.user.email, "@acmecorp.com")
}

# Prefer this
employee if {
    endswith(input.user.email, "@acmecorp.com")
}

For more information, see the docs on redundant-existence-check.

New SARIF output format

SARIF is a standardized output format used and supported by many tools working with static analysis and code quality. Use --format sarif to have regal lint generate standard SARIF output, which can then be consumed by a number of tools.

Bugs fixed

Other improvements

  • The prefer-some-in-iteration rule will by default no longer flag iteration where a sub-attribute is used, like input[_].item
  • The use-in-operator rule has been extended to include more types of items, leading to better discovery of locations where in should be used
  • Remove replace directive in go.mod that made hard to integrate Regal as a library. Thanks, @jamietanna!
  • The project now uses markdownlint to ensure consistent formatting of its documentation
  • The Go API now allows reading custom rules from an fs.FS filesystem
  • OPA dependency bumped to latest v0.59.0
  • Use matrix to build and test Regal in CI for all supported operating systems

Documentation

  • The README now includes a section covering the opa check --strict command, and how it relates to Regal
  • A new page featuring editor integrations has been added to the docs. Thanks, @eshepelyuk!
  • A new page featuring Regal adopters has been added

Changelog