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

Update CLI to respect fix applicability #7769

Merged
merged 29 commits into from
Oct 6, 2023
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d01969c
Update CLI to respect fix applicability
evanrittenhouse Oct 2, 2023
74acdf5
Fixups for CI
zanieb Oct 2, 2023
85b5efe
Update CLI documentation for fixes
zanieb Oct 3, 2023
7c05fb5
Use `self.flags.intersects` consistently
zanieb Oct 3, 2023
87def58
Revert change to notebook cell iteration
zanieb Oct 3, 2023
6577833
Remove stale todo from test
zanieb Oct 3, 2023
d004ddc
Cleanup internal commentary on the fix rules
zanieb Oct 3, 2023
96b8ce1
Refactor `fix_file` implementation to use `Fix.applies`
zanieb Oct 3, 2023
9949fa0
Use different symbols for fix messages depending on applicability
zanieb Oct 3, 2023
ee903bf
Update snapshots to reflect changes in fix messages
zanieb Oct 3, 2023
b24d9dd
Remove comment detailing ordering
zanieb Oct 4, 2023
a5ef7d6
Refactor `RuleCodeAndBody.fmt` to avoid using `unwrap`
zanieb Oct 4, 2023
cb6c25e
Do not display fixes with manual applicability
zanieb Oct 4, 2023
8683340
Rename `--suggested-fix` to `--unsafe-fixes` and fix interaction with…
zanieb Oct 4, 2023
d3f0558
Improve messaging around unsafe fixes
zanieb Oct 4, 2023
d35d68d
Refactor `UnsafeFixes` out of `FixMode`
zanieb Oct 5, 2023
953ee4a
Merge branch 'main' into zanie/applicability
zanieb Oct 5, 2023
98c2c29
Update order of applicability levels for `Ord`
zanieb Oct 5, 2023
f57b853
Fix merge compile errors
zanieb Oct 5, 2023
a57e3d3
Refactor unsafe fix display to avoid using flags
zanieb Oct 5, 2023
d3cb905
Fix unsafe fixes in grouped emitter
zanieb Oct 5, 2023
2a5f454
Refactor `FixableStatistics`
zanieb Oct 5, 2023
8d89499
Lint
zanieb Oct 5, 2023
b72ab24
Fixup `CheckCommand`
zanieb Oct 5, 2023
356f409
`FixableStatistics` -> `FixableSummary`
zanieb Oct 5, 2023
1bbc858
Wrap --fix and --unsafe-fixes in code quotes
zanieb Oct 5, 2023
b6e3a9a
Clean up integration tests
zanieb Oct 5, 2023
47b146b
Commit missing snapshot
zanieb Oct 5, 2023
859ac7d
Avoid reading `unsafe_fixes` from nested configuration files
zanieb Oct 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update order of applicability levels for Ord
zanieb committed Oct 5, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 98c2c295755cd05dfcb54b31066a432b14e0c397
12 changes: 6 additions & 6 deletions crates/ruff_diagnostics/src/fix.rs
Original file line number Diff line number Diff line change
@@ -10,17 +10,17 @@ use crate::edit::Edit;
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(rename_all = "lowercase"))]
pub enum Applicability {
/// The fix is safe and can always be applied.
/// The fix is definitely what the user intended, or it maintains the exact meaning of the code.
Always,
/// The fix is unsafe and should only be manually applied by the user.
/// The fix is likely to be incorrect or the resulting code may have invalid syntax.
Never,

/// The fix is unsafe and should only be applied with user opt-in.
/// The fix may be what the user intended, but it is uncertain; the resulting code will have valid syntax.
Sometimes,

/// The fix is unsafe and should only be manually applied by the user.
/// The fix is likely to be incorrect or the resulting code may have invalid syntax.
Never,
/// The fix is safe and can always be applied.
/// The fix is definitely what the user intended, or it maintains the exact meaning of the code.
Always,
}

/// Indicates the level of isolation required to apply a fix.