regal icon indicating copy to clipboard operation
regal copied to clipboard

Ignore directives for aggregate rules

Open anderseknert opened this issue 11 months ago • 0 comments

We will need to figure out what ignoring something means in the context of aggregate rules.

rules:
  testing: 
    some-aggregate-rule:
      level: error

ignore:
  files:
    - foo/bar.rego

The way we currently work with ignore directives, foo/bar.rego wouldn't even get parsed. This has proven to be necessary, as foo/bar.rego might not even contain valid Rego. However, perhaps we'll need to consider more fine-grained ignores for aggregate rules? It seems valid to me that one would want to include some file in aggregation, but not necessarily in the linter report. In other words, "use this file to determine whether we have a violation in another file, but ignore violations in the file itself".

Also, if an aggregate rule says "only allow imports of packages, not rules", we'll want to respect explicit, line-level ignore directives of that rule:

# regal ignore:prefer-package-imports
import foo.bar.rule

We should also provide a way for aggregate rules to consider this the same way we do for normal rules.

anderseknert avatar Sep 23 '23 20:09 anderseknert