-
Notifications
You must be signed in to change notification settings - Fork 883
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
Merge Availability and AutofixKind #3629
Merge Availability and AutofixKind #3629
Conversation
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.
Nice. Thanks for working on this improvement :)
crates/ruff_cli/src/commands/rule.rs
Outdated
match rule.autofixable() { | ||
AutofixKind::Sometimes => { | ||
output.push_str("Autofix is sometimes available."); | ||
output.push('\n'); | ||
output.push('\n'); | ||
} | ||
AutofixKind::Always => { | ||
output.push_str("Autofix is always available."); | ||
output.push('\n'); | ||
output.push('\n'); | ||
} | ||
AutofixKind::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.
Nit: We could implement Display
for AutofixKind
. You could then write this as
match rule.autofixable() { | |
AutofixKind::Sometimes => { | |
output.push_str("Autofix is sometimes available."); | |
output.push('\n'); | |
output.push('\n'); | |
} | |
AutofixKind::Always => { | |
output.push_str("Autofix is always available."); | |
output.push('\n'); | |
output.push('\n'); | |
} | |
AutofixKind::None => {} | |
} | |
let autofix = rule.autofixable(); | |
if matches!(autofix, AutofxKind::Sometimes | AutofixKind::Always) { | |
writeln!(output, "{autofix}\n").unwrap(); // Writting to a string never fails except if the program OOms | |
} |
and then re-use the same logic in generate_docs
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.
I do not know the term OOms
. What does it mean?
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.
Oh, sorry. I should avoid using acronyms, and that's my java background shining through. OOM is an acronym for Out of Memory (exception in Java). And OOms is the activity when the program runs out of memory. The equivalent in Python is probably the MemoryError
PR Check ResultsEcosystem✅ ecosystem check detected no changes. BenchmarkLinux
Windows
|
851a8ae
to
49fcccc
Compare
Implement suggestion from @MichaReiser
Originally posted by @MichaReiser in #3593 (comment)