From dcedb801e5e9ab595e80acf208ba1c7edce4022d Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Sun, 30 Oct 2022 13:13:37 -0400 Subject: [PATCH] Tweak a few check messages (#520) --- README.md | 6 +++--- src/checks.rs | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f11b71549c..df1712025e 100644 --- a/README.md +++ b/README.md @@ -272,7 +272,7 @@ The 🛠 emoji indicates that a rule is automatically fixable by the `--fix` com | F634 | IfTuple | If test is a tuple, which is always `True` | | | F701 | BreakOutsideLoop | `break` outside loop | | | F702 | ContinueOutsideLoop | `continue` not properly in loop | | -| F704 | YieldOutsideFunction | `yield` or `yield from` statement outside of a function/method | | +| F704 | YieldOutsideFunction | `yield` or `yield from` statement outside of a function | | | F706 | ReturnOutsideFunction | `return` statement outside of a function/method | | | F707 | DefaultExceptNotLast | An `except:` block as not the last exception handler | | | F722 | ForwardAnnotationSyntaxError | Syntax error in forward annotation: `...` | | @@ -341,7 +341,7 @@ The 🛠 emoji indicates that a rule is automatically fixable by the `--fix` com | D400 | EndsInPeriod | First line should end with a period | | | D402 | NoSignature | First line should not be the function's signature | | | D403 | FirstLineCapitalized | First word of the first line should be properly capitalized | | -| D404 | NoThisPrefix | First word of the docstring should not be `This` | | +| D404 | NoThisPrefix | First word of the docstring should not be 'This' | | | D405 | CapitalizeSectionName | Section name should be properly capitalized ("returns") | 🛠 | | D406 | NewLineAfterSectionName | Section name should end with a newline ("Returns") | 🛠 | | D407 | DashedUnderlineAfterSection | Missing dashed underline after section ("Returns") | 🛠 | @@ -355,7 +355,7 @@ The 🛠 emoji indicates that a rule is automatically fixable by the `--fix` com | D415 | EndsInPunctuation | First line should end with a period, question mark, or exclamation point | | | D416 | SectionNameEndsInColon | Section name should end with a colon ("Returns") | 🛠 | | D417 | DocumentAllArguments | Missing argument descriptions in the docstring: `x`, `y` | | -| D418 | SkipDocstring | Function decorated with @overload shouldn't contain a docstring | | +| D418 | SkipDocstring | Function decorated with `@overload` shouldn't contain a docstring | | | D419 | NonEmpty | Docstring is empty | | ### pyupgrade diff --git a/src/checks.rs b/src/checks.rs index be97d72efa..ec4187a261 100644 --- a/src/checks.rs +++ b/src/checks.rs @@ -1055,7 +1055,7 @@ impl CheckKind { format!("Local variable `{name}` is assigned to but never used") } CheckKind::YieldOutsideFunction => { - "`yield` or `yield from` statement outside of a function/method".to_string() + "`yield` or `yield from` statement outside of a function".to_string() } // pycodestyle warnings CheckKind::NoNewLineAtEndOfFile => "No newline at end of file".to_string(), @@ -1197,7 +1197,7 @@ impl CheckKind { } CheckKind::UselessMetaclassType => "`__metaclass__ = type` is implied".to_string(), CheckKind::DeprecatedUnittestAlias(alias, target) => { - format!("`{}` is deprecated, use `{}` instead", alias, target) + format!("`{alias}` is deprecated, use `{target}` instead") } CheckKind::UselessObjectInheritance(name) => { format!("Class `{name}` inherits from object") @@ -1267,10 +1267,10 @@ impl CheckKind { CheckKind::PublicNestedClass => "Missing docstring in public nested class".to_string(), CheckKind::PublicInit => "Missing docstring in `__init__`".to_string(), CheckKind::NoThisPrefix => { - "First word of the docstring should not be `This`".to_string() + "First word of the docstring should not be 'This'".to_string() } CheckKind::SkipDocstring => { - "Function decorated with @overload shouldn't contain a docstring".to_string() + "Function decorated with `@overload` shouldn't contain a docstring".to_string() } CheckKind::CapitalizeSectionName(name) => { format!("Section name should be properly capitalized (\"{name}\")")