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

New contract types: 'allow_graph' and 'forbid_graph' #158

Open
seddonym opened this issue Feb 3, 2023 · 0 comments
Open

New contract types: 'allow_graph' and 'forbid_graph' #158

seddonym opened this issue Feb 3, 2023 · 0 comments

Comments

@seddonym
Copy link
Owner

seddonym commented Feb 3, 2023

For more complex linting requirements that don't fit easily into the other built in types, we could have a contract that looks like this:

[importlinter:contract:my-graph-contract]
name = My contract
type = allow_graph
containers = mypackage
allow =
   blue, green -> yellow
   blue.alpha -> orange.beta

This contract would, for example, allow mypackage.blue.foo to import from modules contained in mypackage.yellow, but nothing else. Potentially, the expressions could have a richer syntax involving wildcards.

We could also have a forbid_graph type which list the things which aren't allowed instead.

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

1 participant