---
source: crates/ruff_linter/src/rules/pep8_naming/mod.rs
---
N805 [*] First argument of a method should be named `self`
 --> N805.py:7:20
  |
6 | class Class:
7 |     def bad_method(this):
  |                    ^^^^
8 |         pass
  |
help: Rename `this` to `self`
  |
6 | class Class:
  -     def bad_method(this):
7 +     def bad_method(self):
8 |         pass
  |
note: This is an unsafe fix and may change runtime behavior

N805 [*] First argument of a method should be named `self`
  --> N805.py:11:30
   |
10 |     if False:
11 |         def extra_bad_method(this):
   |                              ^^^^
12 |             pass
   |
help: Rename `this` to `self`
   |
10 |     if False:
   -         def extra_bad_method(this):
11 +         def extra_bad_method(self):
12 |             pass
   |
note: This is an unsafe fix and may change runtime behavior

N805 [*] First argument of a method should be named `self`
  --> N805.py:63:29
   |
61 |         pass
62 |
63 |     def bad_method_pos_only(this, blah, /, something: str):
   |                             ^^^^
64 |         pass
   |
help: Rename `this` to `self`
   |
62 |
   -     def bad_method_pos_only(this, blah, /, something: str):
63 +     def bad_method_pos_only(self, blah, /, something: str):
64 |         pass
   |
note: This is an unsafe fix and may change runtime behavior

N805 [*] First argument of a method should be named `self`
  --> N805.py:69:13
   |
67 | class ModelClass:
68 |     @hybrid_property
69 |     def bad(cls):
   |             ^^^
70 |         pass
   |
help: Rename `cls` to `self`
   |
68 |     @hybrid_property
   -     def bad(cls):
69 +     def bad(self):
70 |         pass
   |
note: This is an unsafe fix and may change runtime behavior

N805 [*] First argument of a method should be named `self`
  --> N805.py:77:13
   |
76 |     @bad.wtf
77 |     def bad(cls):
   |             ^^^
78 |         pass
   |
help: Rename `cls` to `self`
   |
76 |     @bad.wtf
   -     def bad(cls):
77 +     def bad(self):
78 |         pass
   |
note: This is an unsafe fix and may change runtime behavior

N805 [*] First argument of a method should be named `self`
  --> N805.py:93:19
   |
92 |     @foobar.thisisstatic
93 |     def badstatic(foo):
   |                   ^^^
94 |         pass
   |
help: Rename `foo` to `self`
   |
92 |     @foobar.thisisstatic
   -     def badstatic(foo):
93 +     def badstatic(self):
94 |         pass
   |
note: This is an unsafe fix and may change runtime behavior

N805 First argument of a method should be named `self`
  --> N805.py:98:26
   |
97 | class SelfInArgsClass:
98 |     def self_as_argument(this, self):
   |                          ^^^^
99 |         pass
   |
help: Rename `this` to `self`

N805 First argument of a method should be named `self`
   --> N805.py:101:35
    |
 99 |         pass
100 |
101 |     def self_as_pos_only_argument(this, self, /):
    |                                   ^^^^
102 |         pass
    |
help: Rename `this` to `self`

N805 First argument of a method should be named `self`
   --> N805.py:104:34
    |
102 |         pass
103 |
104 |     def self_as_kw_only_argument(this, *, self):
    |                                  ^^^^
105 |         pass
    |
help: Rename `this` to `self`

N805 First argument of a method should be named `self`
   --> N805.py:107:24
    |
105 |         pass
106 |
107 |     def self_as_varags(this, *self):
    |                        ^^^^
108 |         pass
    |
help: Rename `this` to `self`

N805 First argument of a method should be named `self`
   --> N805.py:110:24
    |
108 |         pass
109 |
110 |     def self_as_kwargs(this, **self):
    |                        ^^^^
111 |         pass
    |
help: Rename `this` to `self`

N805 [*] First argument of a method should be named `self`
   --> N805.py:115:20
    |
114 | class RenamingInMethodBodyClass:
115 |     def bad_method(this):
    |                    ^^^^
116 |         this = this
117 |         this
    |
help: Rename `this` to `self`
    |
114 | class RenamingInMethodBodyClass:
    -     def bad_method(this):
    -         this = this
    -         this
115 +     def bad_method(self):
116 +         self = self
117 +         self
118 |
    |
note: This is an unsafe fix and may change runtime behavior

N805 First argument of a method should be named `self`
   --> N805.py:119:20
    |
117 |         this
118 |
119 |     def bad_method(this):
    |                    ^^^^
120 |         self = this
    |
help: Rename `this` to `self`

N805 [*] First argument of a method should be named `self`
   --> N805.py:124:17
    |
123 | class RenamingWithNFKC:
124 |     def formula(household):
    |                 ^^^^^^^^^
125 |         hºusehold(1)
    |
help: Rename `household` to `self`
    |
123 | class RenamingWithNFKC:
    -     def formula(household):
    -         hºusehold(1)
124 +     def formula(self):
125 +         self(1)
126 |
    |
note: This is an unsafe fix and may change runtime behavior

N805 First argument of a method should be named `self`
   --> N805.py:141:11
    |
139 | # https://github.com/astral-sh/ruff/issues/18459
140 | class C:
141 |     def f(this):
    |           ^^^^
142 |         self = 123
    |
help: Rename `this` to `self`
