From 8f6ab8b37a132dd03bea13e737560899d9e16a11 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sun, 4 Sep 2022 09:52:31 -0400 Subject: [PATCH] Fix formatting of some rule messages --- README.md | 6 +++--- examples/generate_rules_table.rs | 3 ++- src/checks.rs | 6 +++--- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index d4ab0ce61d..9a4cc6f597 100644 --- a/README.md +++ b/README.md @@ -119,12 +119,12 @@ OPTIONS: | F704 | YieldOutsideFunction | a `yield` or `yield from` statement outside of a function/method | | F706 | ReturnOutsideFunction | a `return` statement outside of a function/method | | F821 | UndefinedName | Undefined name `...` | -| F822 | UndefinedExport | Undefined name `...` in __all__ | +| F822 | UndefinedExport | Undefined name `...` in `__all__` | | F823 | UndefinedLocal | Local variable `...` referenced before assignment | | F831 | DuplicateArgumentName | Duplicate argument name in function definition | | F841 | UnusedVariable | Local variable `...` is assigned to but never used | -| F901 | RaiseNotImplemented | 'raise NotImplemented' should be 'raise NotImplementedError | -| R0205 | UselessObjectInheritance | Class ... inherits from object | +| F901 | RaiseNotImplemented | `raise NotImplemented` should be `raise NotImplementedError` | +| R0205 | UselessObjectInheritance | Class `...` inherits from object | ## Development diff --git a/examples/generate_rules_table.rs b/examples/generate_rules_table.rs index 65aed6504a..852a900919 100644 --- a/examples/generate_rules_table.rs +++ b/examples/generate_rules_table.rs @@ -3,6 +3,7 @@ use ruff::checks::CheckKind; fn main() { let mut check_kinds: Vec = vec![ + CheckKind::AssertTuple, CheckKind::DuplicateArgumentName, CheckKind::FStringMissingPlaceholders, CheckKind::IfTuple, @@ -10,9 +11,9 @@ fn main() { CheckKind::LineTooLong, CheckKind::RaiseNotImplemented, CheckKind::ReturnOutsideFunction, + CheckKind::UndefinedExport("...".to_string()), CheckKind::UndefinedLocal("...".to_string()), CheckKind::UndefinedName("...".to_string()), - CheckKind::UndefinedExport("...".to_string()), CheckKind::UnusedImport("...".to_string()), CheckKind::UnusedVariable("...".to_string()), CheckKind::UselessObjectInheritance("...".to_string()), diff --git a/src/checks.rs b/src/checks.rs index 643682efc8..caaaa49eb0 100644 --- a/src/checks.rs +++ b/src/checks.rs @@ -177,13 +177,13 @@ impl CheckKind { CheckKind::ImportStarUsage => "Unable to detect undefined names".to_string(), CheckKind::LineTooLong => "Line too long".to_string(), CheckKind::RaiseNotImplemented => { - "'raise NotImplemented' should be 'raise NotImplementedError".to_string() + "`raise NotImplemented` should be `raise NotImplementedError`".to_string() } CheckKind::ReturnOutsideFunction => { "a `return` statement outside of a function/method".to_string() } CheckKind::UndefinedExport(name) => { - format!("Undefined name `{name}` in __all__") + format!("Undefined name `{name}` in `__all__`") } CheckKind::UndefinedName(name) => { format!("Undefined name `{name}`") @@ -196,7 +196,7 @@ impl CheckKind { format!("Local variable `{name}` is assigned to but never used") } CheckKind::UselessObjectInheritance(name) => { - format!("Class {name} inherits from object") + format!("Class `{name}` inherits from object") } CheckKind::YieldOutsideFunction => { "a `yield` or `yield from` statement outside of a function/method".to_string()