diff --git a/docs/rules/style/opa-fmt.md b/docs/rules/style/opa-fmt.md index 99b02410..0cfa73a2 100644 --- a/docs/rules/style/opa-fmt.md +++ b/docs/rules/style/opa-fmt.md @@ -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: