Skip to content

Releases: StyraInc/regal

v0.5.0

21 Jul 14:13
6fdb963
Compare
Choose a tag to compare

This release brings improvements and new features to improve the experience of authoring custom rules, as well as new, granular capabilities for ignoring files. Most of these improvements are directly based on feedback — and in some cases contributions — from Regal users, which is particularly exciting!

New functionality for ignoring files at a global level and rule level

In addition to setting the severity level of a rule in the Regal configuration file, it is now possible to have the linter ignore files based on their name (or a pattern). This configuration can be applied either globally for all rules, or per rule. An example of this could be wanting to allow the use of the print function in files with a _test.rego suffix, but not in any other files.

Example .regal/config.yaml

ignore:
  files:
    # ignore this file for all rules
    - sketch.rego
rules:
  testing:
    print-or-trace-call:
      level: error
      ignore:
        files:
          # ignore the print-or-trace-call rule in tests
          - "*_test.rego"

See the configuration section of the docs for more details. Thanks @kristiansvalland for this excellent contribution!

Custom rules authoring improvements

Based on feedback we got from users starting to write their own custom rules, we've made several updates to the docs on this topic, fixing the parts people found confusing, and added more examples show e.g. the directory structure of a policy repo using custom Regal rules. Apart from documentation, we've also made it possible have custom rules without a related_resources attribute in the metadata, as some might prefer to document their rules in code, or by other means.

Enhanced type checking of the input AST

This improves the authoring experience for both builtin and custom rules. The regal test command, which is commonly used when developing and testing new rules, now makes use of a schema for the input attribute, i.e. the AST. This allows the command to fail directly when unknown attributes on input are encountered in linter rules, due to typos or other mistakes.

To use this schema in custom rules, add a schemas attribute to the package annotation, using schema.regal.ast for the input:

# METADATA
# description: All packages must use "acme.corp" base name
# schemas:
# - input: schema.regal.ast
package custom.regal.rules.naming["acme-corp-package"]

import future.keywords.contains
import future.keywords.if

report contains violation if {
    # this will fail at compile time, as there is no 'functions' attribute
    # in the input AST
    some function in input.functions

    # ...
}

The schema is applied automatically for builtin rules.

Community

On the community side, we're excited to have @kristiansvalland join us as a maintainer!

Changelog

v0.4.0

04 Jul 09:05
cb516a4
Compare
Choose a tag to compare

This release brings three new rules related to comments and metadata annotations:

  • invalid-metadata-attribute (bugs category) flags custom attributes in metadata annotations not placed under the custom attribute.
  • detached-metadata (style category) flags metadata annotations that are "detached" by whitespace from their package or rule.
  • no-whitespace-comment (style category) simply flags comments where the first character following the # is not whitespace.

Additionally, new end-to-end tests exposed a few mistakes in a previous refactoring, which have been fixed. This mistake meant that v0.3.0 failed to correctly run the line-length and function-arg-return rules... so if you started from that release you're really getting five new rules with v0.4.0... good thing we're keeping a fast paced release cadence! Thanks to @kristiansvalland for reporting on this regression.

Changelog

v0.3.0

27 Jun 13:39
6dcc15e
Compare
Choose a tag to compare

This release improves the use-assignment-operator rule to include many more cases than previously reported.

Additionally, this release fixes a number of issues uncovered when running Regal against some large real-world policy libraries. A few of these were false positives, i.e. where Regal would report issues where there were none, and a few were cases that Regal previously missed.

On the community side, a link to the blog about the ideas behind Regal was added to the README.

Changelog

v0.2.0

21 Jun 14:51
a9c350b
Compare
Choose a tag to compare

This release adds a new idiomatic category, meant for rules that indicate that there is a more idiomatic way to do something. Two new rules have been added to that category:

These rules will flag custom implementations of "has_key" function and "contains" respectively, as more idiomatic ways to achieve the same are now available (see links for details).

Additionally, this release fixes a bug where Regal would fail on inputs where a function was declared more than one time in a policy (i.e. with the same name).

On the community side, we've added a logo and a a code of conduct doc.

The rules have also been refactored so that now each rule resides in its own file rather than all of them being grouped in a big file per category. This makes it easier to quickly find rules to work with, and hopefully also to contribute new ones.

Changelog

v0.1.1

13 Jun 10:50
a415b35
Compare
Choose a tag to compare

Changelog

v0.1.0-beta2

08 Jun 15:34
562d430
Compare
Choose a tag to compare

Changelog

v0.1.0-beta1

07 Jun 14:40
c045881
Compare
Choose a tag to compare

Changelog

v0.0.0-alpha4

02 Jun 07:52
81b53fc
Compare
Choose a tag to compare

Changelog

v0.0.0-alpha3

24 May 13:41
b417470
Compare
Choose a tag to compare

Changelog

v0.0.0-alpha2

23 May 13:49
e364bef
Compare
Choose a tag to compare

Changelog