mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 18:28:24 +00:00
many-to-one 1/9: Rename Rule::code to Rule::noqa_code
Post this commit series several codes can be mapped to a single rule, this commit therefore renames Rule::code to Rule::noqa_code, which is the code that --add-noqa will add to ignore a rule.
This commit is contained in:
parent
502ce80c91
commit
d451c7a506
36 changed files with 66 additions and 62 deletions
|
@ -21,11 +21,11 @@ pub fn main(args: &Args) -> Result<()> {
|
|||
for rule in Rule::iter() {
|
||||
if let Some(explanation) = rule.explanation() {
|
||||
let mut output = String::new();
|
||||
output.push_str(&format!("# {} ({})", rule.as_ref(), rule.code()));
|
||||
output.push_str(&format!("# {} ({})", rule.as_ref(), rule.noqa_code()));
|
||||
output.push('\n');
|
||||
output.push('\n');
|
||||
|
||||
let (linter, _) = Linter::parse_code(rule.code()).unwrap();
|
||||
let (linter, _) = Linter::parse_code(rule.noqa_code()).unwrap();
|
||||
output.push_str(&format!("Derived from the **{}** linter.", linter.name()));
|
||||
output.push('\n');
|
||||
output.push('\n');
|
||||
|
|
|
@ -39,7 +39,7 @@ fn generate_table(table_out: &mut String, rules: impl IntoIterator<Item = Rule>)
|
|||
#[allow(clippy::or_fun_call)]
|
||||
table_out.push_str(&format!(
|
||||
"| {} | {} | {} | {} |",
|
||||
rule.code(),
|
||||
rule.noqa_code(),
|
||||
rule.explanation()
|
||||
.is_some()
|
||||
.then_some(format_args!("[{rule_name}]({URL_PREFIX}/{rule_name}/)",))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue