---
source: crates/ruff_linter/src/rules/pep8_naming/mod.rs
---
N804 [*] First argument of a class method should be named `cls`
 --> N804.py:5:27
  |
4 | class Class:
5 |     def __init_subclass__(self, default_name, **kwargs):
  |                           ^^^^
6 |         ...
  |
help: Rename `self` to `cls`
  |
4 | class Class:
  -     def __init_subclass__(self, default_name, **kwargs):
5 +     def __init_subclass__(cls, default_name, **kwargs):
6 |         ...
  |
note: This is an unsafe fix and may change runtime behavior

N804 [*] First argument of a class method should be named `cls`
  --> N804.py:9:20
   |
 8 |     @classmethod
 9 |     def badAllowed(self, x, /, other):
   |                    ^^^^
10 |         ...
   |
help: Rename `self` to `cls`
   |
8  |     @classmethod
   -     def badAllowed(self, x, /, other):
9  +     def badAllowed(cls, x, /, other):
10 |         ...
   |
note: This is an unsafe fix and may change runtime behavior

N804 [*] First argument of a class method should be named `cls`
  --> N804.py:13:18
   |
12 |     @classmethod
13 |     def stillBad(self, x, /, other):
   |                  ^^^^
14 |         ...
   |
help: Rename `self` to `cls`
   |
12 |     @classmethod
   -     def stillBad(self, x, /, other):
13 +     def stillBad(cls, x, /, other):
14 |         ...
   |
note: This is an unsafe fix and may change runtime behavior

N804 [*] First argument of a class method should be named `cls`
  --> N804.py:18:20
   |
17 | class MetaClass(ABCMeta):
18 |     def badAllowed(self):
   |                    ^^^^
19 |         pass
   |
help: Rename `self` to `cls`
   |
17 | class MetaClass(ABCMeta):
   -     def badAllowed(self):
18 +     def badAllowed(cls):
19 |         pass
   |
note: This is an unsafe fix and may change runtime behavior

N804 [*] First argument of a class method should be named `cls`
  --> N804.py:21:18
   |
19 |         pass
20 |
21 |     def stillBad(self):
   |                  ^^^^
22 |         pass
   |
help: Rename `self` to `cls`
   |
20 |
   -     def stillBad(self):
21 +     def stillBad(cls):
22 |         pass
   |
note: This is an unsafe fix and may change runtime behavior
