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

Support linting `rq` files #329

Open anderseknert opened 1 year ago

anderseknert commented 1 year ago

Regal should be able to lint rq files "out of the box", meaning that if:

I've probably missed some things as I've still more to learn about rq. Note that the scope of this issue is intentionally limited to "support". Once that's in place we can consider rq-specific linter rules.

Related:

Tagging @charlesdaniels as a stakeholder :)

charlesdaniels commented 1 year ago

Happy to be a resource for this!

I think I have some work to do to expose rq as a Go library. I have created rq #4 to track this work. I have another personal project I also want this for, so this will probably be the next major update to rq.

anderseknert commented 1 year ago

Thanks @charlesdaniels! I'm not sure but we probably don't need rq integrated as a library in order to lint its files, we'll just need to be aware of that parsing quirk where the package can be implied. After that it's all AST nodes to Regal.

What would be good though is if the rq project exposed a capabilities file where all its built-in functions and their definitions were included. Some linter rules uses the built-in function definitions to determine violations, and these would also be useful if we want rq-specific linter rules further down the line.

charlesdaniels commented 1 year ago

Makes sense. Adding a capabilities file is now tracked by rq #8. I do still plan to make rq usable as a library, but good to know it is not a blocker for Regal.