Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Packages referenced in a rego file. #287

Open
CalvinRodo opened this issue Sep 13, 2021 · 1 comment
Open

Load Packages referenced in a rego file. #287

CalvinRodo opened this issue Sep 13, 2021 · 1 comment

Comments

@CalvinRodo
Copy link

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.

@jaspervdj-luminal
Copy link
Member

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants