-
Notifications
You must be signed in to change notification settings - Fork 929
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
Remove per-diagnostic check for fixability #7919
Conversation
if !settings.rules.should_fix(diagnostic.kind.rule()) { | ||
diagnostic.fix = None; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the actual code change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a five line change, which then requires removing those if
guards in nearly every rule.
243de02
to
7a1d021
Compare
7a1d021
to
f81771e
Compare
f81771e
to
6db9c21
Compare
PR Check ResultsEcosystem✅ ecosystem check detected no changes. |
Summary
Throughout the codebase, we have this pattern:
This was helpful when we computed fixes lazily; however, we now compute fixes eagerly, and this is only used to ensure that we don't generate fixes for rules marked as unfixable.
We often forget to add this, and it leads to bugs in enforcing
--unfixable
.This PR instead removes all of these checks, moving the responsibility of enforcing
--unfixable
up tocheck_path
. This is similar to how @zanieb handled the--extend-unsafe
logic: we post-process the diagnostics to remove any fixes that should be ignored.