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

Use Regal for Rego linting #881

Merged
merged 1 commit into from Oct 19, 2023
Merged

Conversation

anderseknert
Copy link
Member

This PR introduces Regal for linting the example policies in this project. The Rego found there is generally in a good shape, and the fixes done as part of this are mostly related to style.

The code has been updated to conformance against the following rules:

A few rules are also ignored for now (.regal/config.yaml) and I'll leave it up to the maintainers to decide whether more rules should be enabled later.

The PR also adds Regal to CI to lint any Rego introduced or changed in future PRs.

For more information about Regal and its rules, see the documentation for the project.

This PR introduces [Regal](https://github.com/styrainc/regal) for linting
the example policies in this project. The Rego found there is generally in
a good shape, and the fixes done as part of this are mostly related to style.

The code has been updated to conformance against the following rules:

* [line-length](https://docs.styra.com/regal/rules/style/line-length)
* [use-assignment-operator](https://docs.styra.com/regal/rules/style/use-assignment-operator)
* [use-some-for-output-vars](https://docs.styra.com/regal/rules/idiomatic/use-some-for-output-vars)
* [prefer-snake-case](https://docs.styra.com/regal/rules/style/prefer-snake-case)
* [print-or-trace-call](https://docs.styra.com/regal/rules/testing/print-or-trace-call)

A few rules are also ignored for now (`.regal/config.yaml`) and I'll leave
it up to the maintainers to decide whether more rules should be enabled
later.

The PR also adds Regal to CI to lint any Rego introduced or changed
in future PRs.

For more information about Regal and its rules, see the
[documentation](https://docs.styra.com/regal) for the project.

Signed-off-by: Anders Eknert <anders@styra.com>
@jpreese
Copy link
Member

jpreese commented Oct 19, 2023

This looks fantastic to me. As you mentioned, we'll take this as is and play around with the additional rulesets.

Much appreciated ❤️

@jpreese jpreese merged commit 14e95ad into open-policy-agent:master Oct 19, 2023
7 checks passed
@anderseknert anderseknert deleted the regal branch October 19, 2023 15:30
@anderseknert
Copy link
Member Author

Awesome, John! I'd love to hear about your experience using Regal later 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants