-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Add Applicability
to Fix
#4183
Comments
FYI I've started working on this branched off of #4198 |
This will allow us to change |
I'm working on the names here and looking for something where they're coherent with each other. I'm curious if we're likely to add more levels in the future? For example, here's an option centered on "certainty" that's consistent while leaving room for feature options enum Applicability {
/// The change is guaranteed to be correct and safe to apply automatically.
Certain,
/// The change is likely to be correct, but may require a manual review to ensure correctness.
Likely,
/// The change might not be correct, and requires manual review before applying.
Uncertain,
/// The change could introduce errors or break the code, and should be applied with caution.
Risky,
/// The applicability of the change is not specified or cannot be determined.
Unspecified,
} Or if we do not need more options in the future enum Applicability {
Safe,
Unsafe,
Unspecified
} This option matches your safe/unsafe framing in the primary issue #4181 — I think this may be the clearest framing if there are not going to be additional options? Or if we want to center on how it will be applied enum Applicability {
Automatic,
Suggested,
Unspecified
} |
I don't think we can rule it out completely. For example, Clippy has a Thank you for your thoughtful suggestions. They are way more consistent than my initial proposal :) The challenge I'm facing right now evaluating the proposals is that we need to make a call on what a future
I'm trying to think about how the fix review workflows for
That's why I'm leaning more towards this naming, but I fail to come up with a good name for a fix that we "propose" to a user but e.g. don't support applying automatically because we want users to manually apply, either because the code is incomplete or has a good chance to be incorrect. Would that be What's your preference? |
I think the following makes sense pub enum Applicability {
/// The fix is definitely what the user intended, or maintains the exact meaning of the code.
/// This fix should be automatically applied.
Automatic,
/// The fix may be what the user intended, but it is uncertain.
/// The fix should result in valid code if it is applied.
/// The fix can be applied with user opt-in.
Suggested,
/// The fix has a good chance of being incorrect or the code is incomplete.
/// The fix may result in invalid code if it is applied.
/// The fix should only be manually applied by the user.
Manual,
/// The applicability of the fix is unknown.
#[default]
Unspecified,
} I agree that "certainty" doesn't really help with the typical user workflow. |
I like it. Thanks for pushing for, and improving the naming! |
Part of #4181 and depends on #4182
Applicability
enum infix.rs
similar to Rome's or Clippy'sApplicability
enums with three variants:Safe
(orAutomatic
,Always
,MachineApplicable
?)MaybeIncorrect
Unspecified
applicability
field toFix
safe
andsafe_edits
constructor functions (identical tounspecified
andunspecified_edits)
maybe_incorrect
andmaybe_incorrect_edits
constructor functions (identical tounspecified
andunspecified_edits)
unspecified
andunspecified_edits
asdeprecated
(new lints should use eithersafe_*
ormaybe_incorrect_*). Add
allow(deprecated)` at the call-sites.Diff
implementation to writeSuggested Fix
forMaybeIncorrect
andUnspecified
, andSafe fix
forApplicability::Safe
.The text was updated successfully, but these errors were encountered: