Skip to content

Commit

Permalink
Tweak message
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Mar 17, 2024
1 parent 5d09a08 commit f404f62
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ use crate::checkers::ast::Checker;
use crate::importer::ImportRequest;

/// ## What it does
/// Checks for `@singledispatchmethod` decorators on functions or static methods.
/// Checks for `@singledispatchmethod` decorators on functions or static
/// methods.
///
/// ## Why is this bad?
/// The `@singledispatchmethod` decorator is intended for use with class and instance methods, not functions.
/// The `@singledispatchmethod` decorator is intended for use with class and
/// instance methods, not functions.
///
/// Instead, use the `@singledispatch` decorator.
///
Expand All @@ -22,7 +24,7 @@ use crate::importer::ImportRequest;
///
///
/// @singledispatchmethod
/// def foo(arg):
/// def func(arg):
/// ...
/// ```
///
Expand All @@ -32,7 +34,7 @@ use crate::importer::ImportRequest;
///
///
/// @singledispatch
/// def foo(arg):
/// def func(arg):
/// ...
/// ```
///
Expand All @@ -47,7 +49,7 @@ impl Violation for SingledispatchmethodFunction {

#[derive_message_formats]
fn message(&self) -> String {
format!("`@singledispatchmethod` decorator should not be used on functions")
format!("`@singledispatchmethod` decorator should not be used on non-method functions")
}

fn fix_title(&self) -> Option<String> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
source: crates/ruff_linter/src/rules/pylint/mod.rs
---
singledispatchmethod_function.py:4:1: PLE1520 [*] `@singledispatchmethod` decorator should not be used on functions
singledispatchmethod_function.py:4:1: PLE1520 [*] `@singledispatchmethod` decorator should not be used on non-method functions
|
4 | @singledispatchmethod # [singledispatchmethod-function]
| ^^^^^^^^^^^^^^^^^^^^^ PLE1520
Expand All @@ -21,7 +21,7 @@ singledispatchmethod_function.py:4:1: PLE1520 [*] `@singledispatchmethod` decora
6 6 | pass
7 7 |

singledispatchmethod_function.py:20:5: PLE1520 [*] `@singledispatchmethod` decorator should not be used on functions
singledispatchmethod_function.py:20:5: PLE1520 [*] `@singledispatchmethod` decorator should not be used on non-method functions
|
18 | pass
19 |
Expand Down

0 comments on commit f404f62

Please sign in to comment.