Bug: --disable doesnt work for use-rego-v1
when running regal fix [[path] --disable-all/-D or regal fix [path] --disable [rule] the use-rego-v1 rule will always be ran even if you try to disable it
Hi Odin!
Ah, yes... that one is registered as mandatory: https://github.com/StyraInc/regal/blob/main/cmd/fix.go#L274 Although I don't remember now why we made it so 😅 But it was most likely for good reasons. @charlieegan3 do you remember?
Either way, if we intend to keep it this way we should document that. Are there any reasons you can't use import rego.v1?
OPA 1.0 is like a month or so away, so you'll want to prepare for that now :)
Hey Anders!
Aah yeah it is, didn't look at the code to verify. It would be nice if it was shown in the docs or the regal fix --help prompt that rego-v1 will be applied as default, and with no option to disable.
There is no reason we cant use it, but I get some pushback if I change other application teams rego policies, but with V1 looming over us I can emphasise the importance.
Came across this while enabling the 0.27 rules, but anyhow I don't wanna do both rego-v1 and the directory-package-mismatch rules on our repo at the same time. But I'll just do v1 first, and then directory structure afterwards in a separate pull request.
That makes perfect sense! I'll consult with @charlieegan3 on whether to change the defaults or the docs. Will let you know!
Hi @Od1nB, much has been adjusted in the fix functionality since this was first reported. My understanding is that this will no longer happen.
…/regal/temp fixer-ignore ➜ cat wow/foo.rego
1 │ package wow
2 │
3 │ allow := true # note, not formatted, extra spaces
…/regal/temp fixer-ignore ➜ ./regal_Darwin_arm64 version
Version: 0.30.2
Go Version: go1.23.3
Platform: darwin/arm64
Commit: 2c6ee8e23a1d1625780c4a057d60d954ca9fea7f
Timestamp: 2025-01-16T17:33:07Z
Hostname: github.actions.local
…/regal/temp fixer-ignore ➜ ./regal_Darwin_arm64 fix --disable-all wow/foo.rego --force
No fixes applied.
…/regal/temp fixer-ignore ➜ cat wow/foo.rego
1 │ package wow
2 │
3 │ allow := true # note, still not formatted.
Please don't take my word for it, if you see something else in the latest release, please let me know!
Aside, see https://docs.styra.com/regal#configuring-rego-version if still working on v0 Rego.
Closing for now, but we can re-open if we find another case.