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

Invert Analyser EventHandlers #1104

Closed
patrickkusebauch opened this issue Feb 2, 2023 · 0 comments · Fixed by #1105
Closed

Invert Analyser EventHandlers #1104

patrickkusebauch opened this issue Feb 2, 2023 · 0 comments · Fixed by #1105

Comments

@patrickkusebauch
Copy link
Collaborator

Right now the way Event Handlers work is that we go Allowed first down to Violation.

When a Violation occurs, we don't know exactly why. We can only say "It was not allowed". We sometimes get exactly this question and it is more common with the introduction of private collectors and internal classes.

As a result, we have many short-circuits in AllowDependencyHandler, to skip all those cases.

My proposal is to invert this principle and instead have multiple Violation handlers. Like DependsOnInternalClassHandler or DependsOnPrivatelyCollectedTokenHandler. These would run first, thus making the short circuits in AllowDependencyHandler no longer required.

As a consequence, rules could now also have a reason field, that would give a clear output indication of why the violation occurred in the first place and possibly how to fix it. Basically to follow the standard way many other SA tools are utilizing.

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

Successfully merging a pull request may close this issue.

1 participant