Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rule idea: flag if a rule is called "if" #140

Closed
srenatus opened this issue Jun 2, 2023 · 0 comments · Fixed by #141
Closed

rule idea: flag if a rule is called "if" #140

srenatus opened this issue Jun 2, 2023 · 0 comments · Fixed by #141
Labels
enhancement New feature or request

Comments

@srenatus
Copy link
Member

srenatus commented Jun 2, 2023

Regrettably, may policies using if that are missing a import future.keywords.if still parse successfully. However, they're rarely do what the author intended.

What they have in common is a rule named if. So, regal could flag that as a likely error, hinting that future.keywords.if should be imported.

Example:

package play

allow := true if {
    input.foo
}

With input = {"foo": true}, data.play evaluates to

{
  "if": true,
  "allow": true
}
@srenatus srenatus added enhancement New feature or request category/rules labels Jun 2, 2023
anderseknert added a commit that referenced this issue Jun 2, 2023
Fixes #140

Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert added a commit that referenced this issue Jun 2, 2023
Fixes #140

Signed-off-by: Anders Eknert <anders@styra.com>
anderseknert added a commit that referenced this issue Jun 2, 2023
Fixes #140

Signed-off-by: Anders Eknert <anders@styra.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant