mirror of https://github.com/astral-sh/ruff
refactor: Rename RuleOrigin::title to RuleOrigin::name
This commit is contained in:
parent
f4da7635f0
commit
601848d9a8
|
|
@ -296,7 +296,7 @@ pub fn explain(code: &RuleCode, format: SerializationFormat) -> Result<()> {
|
|||
println!(
|
||||
"{} ({}): {}",
|
||||
code.as_ref(),
|
||||
code.origin().title(),
|
||||
code.origin().name(),
|
||||
code.kind().summary()
|
||||
);
|
||||
}
|
||||
|
|
@ -305,7 +305,7 @@ pub fn explain(code: &RuleCode, format: SerializationFormat) -> Result<()> {
|
|||
"{}",
|
||||
serde_json::to_string_pretty(&Explanation {
|
||||
code: code.as_ref(),
|
||||
origin: code.origin().title(),
|
||||
origin: code.origin().name(),
|
||||
summary: &code.kind().summary(),
|
||||
})?
|
||||
);
|
||||
|
|
|
|||
|
|
@ -47,22 +47,22 @@ pub fn main(cli: &Cli) -> Result<()> {
|
|||
for origin in RuleOrigin::iter() {
|
||||
let prefixes = origin.prefixes();
|
||||
let codes_csv: String = prefixes.as_list(", ");
|
||||
table_out.push_str(&format!("### {} ({codes_csv})", origin.title()));
|
||||
table_out.push_str(&format!("### {} ({codes_csv})", origin.name()));
|
||||
table_out.push('\n');
|
||||
table_out.push('\n');
|
||||
|
||||
toc_out.push_str(&format!(
|
||||
" 1. [{} ({})](#{}-{})\n",
|
||||
origin.title(),
|
||||
origin.name(),
|
||||
codes_csv,
|
||||
origin.title().to_lowercase().replace(' ', "-"),
|
||||
origin.name().to_lowercase().replace(' ', "-"),
|
||||
codes_csv.to_lowercase().replace(',', "-").replace(' ', "")
|
||||
));
|
||||
|
||||
if let Some((url, platform)) = origin.url() {
|
||||
table_out.push_str(&format!(
|
||||
"For more, see [{}]({}) on {}.",
|
||||
origin.title(),
|
||||
origin.name(),
|
||||
url,
|
||||
platform
|
||||
));
|
||||
|
|
|
|||
|
|
@ -495,7 +495,7 @@ impl Prefixes {
|
|||
}
|
||||
|
||||
impl RuleOrigin {
|
||||
pub fn title(&self) -> &'static str {
|
||||
pub fn name(&self) -> &'static str {
|
||||
match self {
|
||||
RuleOrigin::Eradicate => "eradicate",
|
||||
RuleOrigin::Flake82020 => "flake8-2020",
|
||||
|
|
|
|||
Loading…
Reference in New Issue