fugue / fregot

Fugue Rego Toolkit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Load Packages referenced in a rego file.

CalvinRodo opened this issue · comments

I'm using fregot to test some conftest checks as an alternative to the opa cli.

It would be nice to be able to load a rego file and have it automatically load all the imported packages so I don't have to import them all myself.

@CalvinRodo I agree that this would be nice, but it's a bit problematic in Rego. While typically I would put something like package foo.bar.qux in foo/bar/qux.rego, this doesn't have to be the case: it could be in vendor/extra/foo/bar/qux.rego, or even just in utils.rego: there is no correspondence between package names and file names.

One alternative is just loading all rego code recursively, but that can also cause issues if some of it is not meant to be loaded (e.g. broken examples). But using something like fregot repl . will do this already.

Does this make sense? Or did I misunderstand the issue?