Rewrite some string-format violation messages (#2242)

This commit is contained in:
Charlie Marsh 2023-01-26 19:42:16 -05:00 committed by GitHub
parent 685d9ab848
commit a316b26b49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 28 deletions

View File

@ -577,20 +577,20 @@ For more, see [Pyflakes](https://pypi.org/project/pyflakes/) on PyPI.
| F405 | import-star-usage | `{name}` may be undefined, or defined from star imports: {sources} | | | F405 | import-star-usage | `{name}` may be undefined, or defined from star imports: {sources} | |
| F406 | import-star-not-permitted | `from {name} import *` only allowed at module level | | | F406 | import-star-not-permitted | `from {name} import *` only allowed at module level | |
| F407 | future-feature-not-defined | Future feature `{name}` is not defined | | | F407 | future-feature-not-defined | Future feature `{name}` is not defined | |
| F501 | percent-format-invalid-format | '...' % ... has invalid format string: {message} | | | F501 | percent-format-invalid-format | `%`-format string has invalid format string: {message} | |
| F502 | percent-format-expected-mapping | '...' % ... expected mapping but got sequence | | | F502 | percent-format-expected-mapping | `%`-format string expected mapping but got sequence | |
| F503 | percent-format-expected-sequence | '...' % ... expected sequence but got mapping | | | F503 | percent-format-expected-sequence | `%`-format string expected sequence but got mapping | |
| F504 | percent-format-extra-named-arguments | '...' % ... has unused named argument(s): {message} | 🛠 | | F504 | percent-format-extra-named-arguments | `%`-format string has unused named argument(s): {message} | 🛠 |
| F505 | percent-format-missing-argument | '...' % ... is missing argument(s) for placeholder(s): {message} | | | F505 | percent-format-missing-argument | `%`-format string is missing argument(s) for placeholder(s): {message} | |
| F506 | percent-format-mixed-positional-and-named | '...' % ... has mixed positional and named placeholders | | | F506 | percent-format-mixed-positional-and-named | `%`-format string has mixed positional and named placeholders | |
| F507 | percent-format-positional-count-mismatch | '...' % ... has {wanted} placeholder(s) but {got} substitution(s) | | | F507 | percent-format-positional-count-mismatch | `%`-format string has {wanted} placeholder(s) but {got} substitution(s) | |
| F508 | percent-format-star-requires-sequence | '...' % ... `*` specifier requires sequence | | | F508 | percent-format-star-requires-sequence | `%`-format string `*` specifier requires sequence | |
| F509 | percent-format-unsupported-format-character | '...' % ... has unsupported format character '{char}' | | | F509 | percent-format-unsupported-format-character | `%`-format string has unsupported format character '{char}' | |
| F521 | string-dot-format-invalid-format | '...'.format(...) has invalid format string: {message} | | | F521 | string-dot-format-invalid-format | `.format` call has invalid format string: {message} | |
| F522 | string-dot-format-extra-named-arguments | '...'.format(...) has unused named argument(s): {message} | 🛠 | | F522 | string-dot-format-extra-named-arguments | `.format` call has unused named argument(s): {message} | 🛠 |
| F523 | string-dot-format-extra-positional-arguments | '...'.format(...) has unused arguments at position(s): {message} | | | F523 | string-dot-format-extra-positional-arguments | `.format` call has unused arguments at position(s): {message} | |
| F524 | string-dot-format-missing-arguments | '...'.format(...) is missing argument(s) for placeholder(s): {message} | | | F524 | string-dot-format-missing-arguments | `.format` call is missing argument(s) for placeholder(s): {message} | |
| F525 | string-dot-format-mixing-automatic | '...'.format(...) mixes automatic and manual numbering | | | F525 | string-dot-format-mixing-automatic | `.format` string mixes automatic and manual numbering | |
| F541 | f-string-missing-placeholders | f-string without any placeholders | 🛠 | | F541 | f-string-missing-placeholders | f-string without any placeholders | 🛠 |
| F601 | multi-value-repeated-key-literal | Dictionary key literal `{name}` repeated | 🛠 | | F601 | multi-value-repeated-key-literal | Dictionary key literal `{name}` repeated | 🛠 |
| F602 | multi-value-repeated-key-variable | Dictionary key `{name}` repeated | 🛠 | | F602 | multi-value-repeated-key-variable | Dictionary key `{name}` repeated | 🛠 |

View File

@ -174,7 +174,7 @@ impl Violation for PercentFormatInvalidFormat {
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
let PercentFormatInvalidFormat(message) = self; let PercentFormatInvalidFormat(message) = self;
format!("'...' % ... has invalid format string: {message}") format!("`%`-format string has invalid format string: {message}")
} }
} }
@ -184,7 +184,7 @@ define_violation!(
impl Violation for PercentFormatExpectedMapping { impl Violation for PercentFormatExpectedMapping {
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
format!("'...' % ... expected mapping but got sequence") format!("`%`-format string expected mapping but got sequence")
} }
} }
@ -194,7 +194,7 @@ define_violation!(
impl Violation for PercentFormatExpectedSequence { impl Violation for PercentFormatExpectedSequence {
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
format!("'...' % ... expected sequence but got mapping") format!("`%`-format string expected sequence but got mapping")
} }
} }
@ -206,7 +206,7 @@ impl AlwaysAutofixableViolation for PercentFormatExtraNamedArguments {
fn message(&self) -> String { fn message(&self) -> String {
let PercentFormatExtraNamedArguments(missing) = self; let PercentFormatExtraNamedArguments(missing) = self;
let message = missing.join(", "); let message = missing.join(", ");
format!("'...' % ... has unused named argument(s): {message}") format!("`%`-format string has unused named argument(s): {message}")
} }
fn autofix_title(&self) -> String { fn autofix_title(&self) -> String {
@ -224,7 +224,7 @@ impl Violation for PercentFormatMissingArgument {
fn message(&self) -> String { fn message(&self) -> String {
let PercentFormatMissingArgument(missing) = self; let PercentFormatMissingArgument(missing) = self;
let message = missing.join(", "); let message = missing.join(", ");
format!("'...' % ... is missing argument(s) for placeholder(s): {message}") format!("`%`-format string is missing argument(s) for placeholder(s): {message}")
} }
} }
@ -234,7 +234,7 @@ define_violation!(
impl Violation for PercentFormatMixedPositionalAndNamed { impl Violation for PercentFormatMixedPositionalAndNamed {
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
format!("'...' % ... has mixed positional and named placeholders") format!("`%`-format string has mixed positional and named placeholders")
} }
} }
@ -245,7 +245,7 @@ impl Violation for PercentFormatPositionalCountMismatch {
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
let PercentFormatPositionalCountMismatch(wanted, got) = self; let PercentFormatPositionalCountMismatch(wanted, got) = self;
format!("'...' % ... has {wanted} placeholder(s) but {got} substitution(s)") format!("`%`-format string has {wanted} placeholder(s) but {got} substitution(s)")
} }
} }
@ -255,7 +255,7 @@ define_violation!(
impl Violation for PercentFormatStarRequiresSequence { impl Violation for PercentFormatStarRequiresSequence {
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
format!("'...' % ... `*` specifier requires sequence") format!("`%`-format string `*` specifier requires sequence")
} }
} }
@ -266,7 +266,7 @@ impl Violation for PercentFormatUnsupportedFormatCharacter {
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
let PercentFormatUnsupportedFormatCharacter(char) = self; let PercentFormatUnsupportedFormatCharacter(char) = self;
format!("'...' % ... has unsupported format character '{char}'") format!("`%`-format string has unsupported format character '{char}'")
} }
} }
@ -277,7 +277,7 @@ impl Violation for StringDotFormatInvalidFormat {
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
let StringDotFormatInvalidFormat(message) = self; let StringDotFormatInvalidFormat(message) = self;
format!("'...'.format(...) has invalid format string: {message}") format!("`.format` call has invalid format string: {message}")
} }
} }
@ -289,7 +289,7 @@ impl AlwaysAutofixableViolation for StringDotFormatExtraNamedArguments {
fn message(&self) -> String { fn message(&self) -> String {
let StringDotFormatExtraNamedArguments(missing) = self; let StringDotFormatExtraNamedArguments(missing) = self;
let message = missing.join(", "); let message = missing.join(", ");
format!("'...'.format(...) has unused named argument(s): {message}") format!("`.format` call has unused named argument(s): {message}")
} }
fn autofix_title(&self) -> String { fn autofix_title(&self) -> String {
@ -307,7 +307,7 @@ impl Violation for StringDotFormatExtraPositionalArguments {
fn message(&self) -> String { fn message(&self) -> String {
let StringDotFormatExtraPositionalArguments(missing) = self; let StringDotFormatExtraPositionalArguments(missing) = self;
let message = missing.join(", "); let message = missing.join(", ");
format!("'...'.format(...) has unused arguments at position(s): {message}") format!("`.format` call has unused arguments at position(s): {message}")
} }
} }
@ -319,7 +319,7 @@ impl Violation for StringDotFormatMissingArguments {
fn message(&self) -> String { fn message(&self) -> String {
let StringDotFormatMissingArguments(missing) = self; let StringDotFormatMissingArguments(missing) = self;
let message = missing.join(", "); let message = missing.join(", ");
format!("'...'.format(...) is missing argument(s) for placeholder(s): {message}") format!("`.format` call is missing argument(s) for placeholder(s): {message}")
} }
} }
@ -329,7 +329,7 @@ define_violation!(
impl Violation for StringDotFormatMixingAutomatic { impl Violation for StringDotFormatMixingAutomatic {
#[derive_message_formats] #[derive_message_formats]
fn message(&self) -> String { fn message(&self) -> String {
format!("'...'.format(...) mixes automatic and manual numbering") format!("`.format` string mixes automatic and manual numbering")
} }
} }