regal icon indicating copy to clipboard operation
regal copied to clipboard

Create new Rego setup phase preceeding lint evalutation

Open anderseknert opened this issue 10 months ago • 0 comments

I don't think it's a goal we're touting anywhere, but given the overarching goals of the project it should go without saying that if we can do something either in Go or Rego, we'll do it in Rego. There's currently a few things we either do in Go, or do both in Go and Rego, that could be done only in Rego:

  • Parsing and merging of provided / user configuration
  • Filtering of files / ignores
  • Parsing of input policies

Could be that the last step is too expensive to do in Rego (and regal.parse_module) but the two other steps would be cheaper to do in a pre-lint step even in Rego, as we currently do at least some parts of config evaluation per input file. This is redundant, of course, as the config doesn't change between input files, and should really only be calculated once.

Another benefit of providing a pre-lint evaluation phase executed in Rego is that policy authors — similarly to when they provide custom rules — could provide custom logic for what to do before linting, and have whatever data collected in that step provided as part of the input when running the lint phase.

anderseknert avatar Sep 30 '23 21:09 anderseknert