Closed jrencz closed 6 months ago
Hi @jrencz thansk for raising the issue! That's indeed a bug - the linked PR (#931) should fix it. Soon after merging it'll be released in dependency-cruiser version 16.3.1 - I'll give a heads-up in this thread when that has happened.
As you might see if you look into the PR it only adds the required
rules - this is because the allowed
rule (there can only be one) can't have a name.
@jrencz the release scripts are running so it should be on npmjs in a few seconds. Let me know if it helped you!
It did, thank you!
Thanks for fixing it during the weekend. Much appreciated! 🥇
I'm filing it as a FR not as a Bug, because I'm not aware if it's by design or it's just that no one paid attention to it yet.
Context
forbidden
(as the recommended has), but alsorequired
required
rule has acomment
.required
rule.Expected Behavior
Current Behavior
I do see violation reported, but I see
-
in place of the commentPossible Solution
I think it's caused by the fact that when
https://github.com/sverweij/dependency-cruiser/blob/9a523b4e16ceafb9a410875fe780462b5a6c052b/src/report/error.mjs#L108-L115
looks for comment it uses
findRuleByName
and ithttps://github.com/sverweij/dependency-cruiser/blob/9a523b4e16ceafb9a410875fe780462b5a6c052b/src/graph-utl/rule-set.mjs#L12-L16
only looks through
forbidden
, it doesn't take other sections.I see that making it
resolves the problem - I mean: if it's not meant not to find others but
forbidden
. I'm happy to see it introduced as proposed (or as something that gives the same result), or I can create a PR, but if so - please let me know if feature this change touches has some tests or where can I add themConsidered alternatives
I don't think I could rephrase my
required
rule into aforbidden
- I'm a beginner in this tool (~2h so far, but "and counting" - I definitely see its potential), but lack of ability to see comments in output reduces its usefulness for me as repository maintainer in guiding developers through rules in my repository.