-
Notifications
You must be signed in to change notification settings - Fork 299
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
Ignored Violations should not contribute to the ViolationStore #915
Comments
Honestly, I've never considered using That being said, I see your point, I would also consider the more natural behavior of this to be ignored from the a) encapsulate the filtering logic for Spontaneously, I would think the second might be the better alternative, because it is then handled in one single place, and in the end it makes sense that when you If you want to create a PR for that I'd be happy to merge it 🙂 |
Thanks for your quick reply, let me give you context on what we're planning to do, probably there exists a better solution. We are running a lot of projects at @cloudflightio in parallel, most of them based on the Spring Boot stack. We have already created a couple of ArchUnit rules and want to provide those as a shared library that can be used in any of those projects. Inside that library, we are having multiple rules for various frameworks (Spring, Spring Boot, JPA, Kotlin) and depending on what we find on the classpath, those rules are evaluated or not (that is already done). All the the users have to do is do add a single import with Maven/Gradle and then do a
And Now it can happen that in certain customer projects we have other rulesets and we i.e. don't want to evaluate rules around JPA entities. In that case we would use the |
Meanwhile I've open-sourced parts of our library with an own implementation of the The workaround here would then be that you once need to populate the store, then create the |
Ah, I see, thanks a lot for sharing 😃 I think that this simply is a use case I never came by, to distribute |
I think I'll have some time to look into this this weekend. So ping me if you've already started working on it, otherwise I would try to tackle it 🙂 |
At the moment the handling of `archunit_ignore_patterns.txt` is inconsistent. E.g. `FreezingArchRule` still writes ignored violations to the `ViolationStore`, `EvaluationResult` reports `hasViolations` even if the violations are ignored, `EvaluationResult.getFailureReport()` still contains ignored violations and `EvaluationResult.handleViolations(..)` also handles ignored violations. We now filter ignored patterns directly on construction of `EvaluationResult`. By that we will solve all these inconsistencies, because `EvaluationResult` as single source of truth already handles ignored violations correctly. Resolves: #915
awesome stuff, thanks a lot! |
Right now, if you ignore a rule using the
archunit_ignore_patterns.txt
, and you wrap that into aFreezingArchRule
, theViolationStore
is still being populated.I would have expected that adding ignore patterns to the
archunit_ignore_patterns.txt
counts more here.Interestingly, if the ViolationStore has once been created, and you add new violations to the ignored rule, then the tests pass.
In other words: it seems that the code that checks the ignore patterns runs after the freezing logic, but imho it should be the opposite.
If you believe that it should remain as it is, it would be great to add that information to https://www.archunit.org/userguide/html/000_Index.html#_ignoring_violations
In any case, I'd be happy to submit a PR
The text was updated successfully, but these errors were encountered: