-
Notifications
You must be signed in to change notification settings - Fork 256
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
Question: Is it possible to have different kinds of circular dependencies? #585
Comments
Hi @PetFeld-ed thanks for submitting this question - it's nice to see what interesting cases dc is used for. As far as I can see your approach should work - except that for |
Hi @PetFeld-ed as you can see in the linked PR I've added group matching support for the I have a bit of an issue naming the new via* restrictions, though (see below) - so that will probably change before I merge the PR. backgroundThe The examples below refer to this cycle:
This is also why the regular The new |
Summary
I would like to find out if (how) it is possible to handle different kinds of circular dependencies in different ways. E.g. one type of circular dependency should only issue a warning whereas another type should be an error.
Context
My project is divided in different modules. The folder structure looks like this:
Now if there is a circular dependency inside a single module this should be just a warning.
I can do this by using the default
no-circular
rule and set its severity towarn
:Now I would like to add a rule that if there is a circular dependency between two modules (e.g.
moduleA
depends onmoduleC
andmoduleC
depends onmoduleA
) this should be an error instead.I tried by writing a custom rule for this by using group matching as described in the documentation (https://github.com/sverweij/dependency-cruiser/blob/HEAD/doc/rules-reference.md#group-matching---an-example-matching-peer-folders):
But the result is the same as just putting
no-circular
toerror
severity as it also matches circles inside a single module.Hence my question is: Is it possible to achieve this behaviour? If yes, how would the rule for this need to look?
Environment
The text was updated successfully, but these errors were encountered: