Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@anderseknert
Copy link
Contributor

This PR introduces Regal for linting the Rego files of the project. The Rego found here is generally in a good shape, so only a few rules have been either ignored or fixed. The few rules fixed include:

Included is also a new job for checking/linting Rego code as part of CI.

@anderseknert anderseknert requested a review from a team as a code owner October 22, 2023 13:45
@ghost
Copy link

ghost commented Oct 22, 2023

πŸ‘‡ Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@anderseknert anderseknert changed the title Add Regal for linting Rego policy: Add Regal for linting Rego Oct 22, 2023
@gal-legit
Copy link
Contributor

gal-legit commented Oct 29, 2023

Hey @anderseknert,
thank you so much for this awesome contribution!
I commented on a couple of new actions that need to be pinned down to a specific commit version to avoid mutability risk. Please just sort it out and I'll approve and merge.

This PR introduces [Regal](https://github.com/styrainc/regal) for linting
the Rego files of the project. The Rego found here is generally in a good
shape, so only a few rules have been either ignored or fixed. The few rules
fixed include:
* [rule-shadows-builtin](https://docs.styra.com/regal/rules/bugs/rule-shadows-builtin)
  as there is already an `is_null` function in the standard lib
* [custom-has-key-construct](https://docs.styra.com/regal/rules/idiomatic/custom-has-key-construct)
  as this is handled by `object.keys` and `in` in modern Rego
* [use-assignment-operator](https://docs.styra.com/regal/rules/style/use-assignment-operator)
  as `:=` is preferred over `=` for rule assignment, and using this does
  not change the semantics of the code in any way.

Included is also a new job for checking/linting Rego code as part of CI.

Signed-off-by: Anders Eknert <[email protected]>
@anderseknert
Copy link
Contributor Author

anderseknert commented Oct 30, 2023

Thanks @gal-legit πŸ˜ƒ I've done that now, plus rebased from latest main πŸ‘

@royb-legit
Copy link
Contributor

Thank you for your contribution, @anderseknert!

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.

3 participants