StyraInc / regal

Regal is a linter and language server for Rego, bringing your policy development experience to the next level!
https://docs.styra.com/regal
Apache License 2.0
261 stars 35 forks source link

Bug: --disable doesnt work for use-rego-v1 #1149

Open Od1nB opened 1 month ago

Od1nB commented 1 month ago

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

anderseknert commented 1 month ago

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 :)

Od1nB commented 1 month ago

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.

anderseknert commented 1 month ago

That makes perfect sense! I'll consult with @charlieegan3 on whether to change the defaults or the docs. Will let you know!