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

Add Regal for linting Rego #200

Merged
merged 1 commit into from
Oct 16, 2023
Merged

Add Regal for linting Rego #200

merged 1 commit into from
Oct 16, 2023

Commits on Oct 15, 2023

  1. Add Regal for linting Rego

    This PR adds [Regal](https://github.com/styraInc/regal) for linting the Rego
    contained in this repo.
    
    Practically, this PR adds a Regal configuration file adapted to the project,
    where some of the most reported style issues are ignoed for the time being.
    Additionally, we're adding a linter job to the CI pipeline to ensure future
    updates to policy if compliant as well.
    
    A few (hopefully) uncontroversial issues reported have also been fixed:
    
    * [constant-condition](https://docs.styra.com/regal/rules/bugs/constant-condition)
    * [use-assignment-operator](https://docs.styra.com/regal/rules/style/use-assignment-operator)
    * [use-in-operator](https://docs.styra.com/regal/rules/idiomatic/use-in-operator)
    * [use-some-for-output-vars](https://docs.styra.com/regal/rules/idiomatic/use-some-for-output-vars)
    * [non-raw-regex-pattern](https://docs.styra.com/regal/rules/idiomatic/non-raw-regex-pattern)
    
    While the changes are non-intrusive, and should have no impact on evaluation,
    I naturally wanted to run the tests included in this repo and followed the instructions
    in TESTING.md. However, even after having installed all of the dependencies listed as
    required, the test command fails due to a missing `oc` command. I tried to find that
    and possibly update the TESTING.md file to include it, but the instructions I followed
    suggested logging in to a "RedHat Customer Portal" to get it. If being a customer is required
    to run the tests, that requirement would be good to add to the docs as well.
    
    Signed-off-by: Anders Eknert <[email protected]>
    anderseknert committed Oct 15, 2023
    Configuration menu
    Copy the full SHA
    ddc427e View commit details
    Browse the repository at this point in the history