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: use-rego-v1 #538

Merged
merged 1 commit into from
Feb 5, 2024
Merged

Rule: use-rego-v1 #538

merged 1 commit into from
Feb 5, 2024

Conversation

anderseknert
Copy link
Member

Recommend using import rego.v1.

Also:

  • Ignore import future rules when rego.v1 rule in capabilities
  • Update the documentation for all rules to use the rego.v1 import
  • Update all Rego used in tests to use rego.v1 import

```rego
package policy

# before OPA v0.59.0, this is alright
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# before OPA v0.59.0, this is alright
# before OPA v0.59.0, this was best practice

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Fixed.

## Rationale

OPA [v0.59.0](https://github.com/open-policy-agent/opa/releases/tag/v0.59.0) introduced a new `rego.v1` import, which
allows policy authors to prepare for language changes coming in a future OPA 1.0 release. Some notable changes include:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
allows policy authors to prepare for language changes coming in a future OPA 1.0 release. Some notable changes include:
allows policy authors to prepare for language changes coming in the future OPA 1.0 release. Some notable changes include:

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed 👍

```shell
$ regal lint bundle
131 files linted. No violations found. 1 rule skipped:
- use-rego-v1: Missing capability for `import rego.v1`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is really nice!

Recommend using `import rego.v1`.

Also:
* Ignore `import future` rules when `rego.v1` rule in capabilities
* Update the documentation for all rules to use the `rego.v1` import
* Update all Rego used in tests to use `rego.v1` import

Signed-off-by: Anders Eknert <anders@styra.com>
@anderseknert anderseknert merged commit bc27c76 into main Feb 5, 2024
3 checks passed
@anderseknert anderseknert deleted the use-rego-v1 branch February 5, 2024 11:08
@anderseknert anderseknert mentioned this pull request Feb 5, 2024
srenatus pushed a commit to srenatus/regal that referenced this pull request Oct 1, 2024
Recommend using `import rego.v1`.

Also:
* Ignore `import future` rules when `rego.v1` rule in capabilities
* Update the documentation for all rules to use the `rego.v1` import
* Update all Rego used in tests to use `rego.v1` import

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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants