Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

docs: opa-fmt v1/v0 notes #1336

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions docs/rules/style/opa-fmt.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,23 @@ indent_style = tab
indent_size = 4
```

## OPA Format with Rego v1 and v0

OPA 1.0 makes Rego v1 the default. This change mandated some changes to the
functionality of the `opa fmt` command and a number of new options for working
with mixed version code bases. See the
[OPA documentation](https://www.openpolicyagent.org/docs/latest/cli/#opa-fmt)
for the command's options.

In Regal, a v0 file will have the `opa-fmt` violation unless it's been formatted
with `opa fmt --v0-v1`. A v1 file will have the `opa-fmt` violation unless it's
been formatted with `opa fmt` (the rego.v1 keyword is permitted but not added).

When formatting, a file expected to be v1 based on the configuration, but with
v0 syntax is still formatted as `opa fmt –-v0-v1`. Please see
[Configuring Rego Version](https://docs.styra.com/regal#configuring-rego-version)
for more configuration help for multi version projects.

## Configuration Options

This linter rule provides the following configuration options:
Expand Down
Loading