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

Strict mode: fail on unused imports #4354

Closed
anderseknert opened this issue Feb 15, 2022 · 2 comments · Fixed by #4377
Closed

Strict mode: fail on unused imports #4354

anderseknert opened this issue Feb 15, 2022 · 2 comments · Fixed by #4377

Comments

@anderseknert
Copy link
Member

anderseknert commented Feb 15, 2022

Running opa check with the --strict flag currently fails when unused assignment is encountered. It would be a good addition if we added a new check to similarly fail on unused imports:

package foo

import data.foo.x

allow {
    input.foo == "bar"
}
$ opa check --strict foo.rego
1 error occurred: policy.rego:3: rego_compile_error: import data.foo.x unused

Whoever wants to work on this might be helped by taking a look at this strict mode PR forbidding the use of input and data as identifiers in rules and variables.

@damienjburks
Copy link
Contributor

Hey y'all! I'd love to take on this issue.

@anderseknert
Copy link
Member Author

Good to see you back @damienjburks! Go right ahead, and holler out if you need any support :)

Open Policy Agent automation moved this from Backlog to Done Mar 11, 2022
srenatus pushed a commit that referenced this issue Mar 11, 2022
Fixes #4354.

Signed-off-by: Damien Burks <damien@damienjburks.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

3 participants