---
source: crates/ruff_linter/src/rules/pep8_naming/mod.rs
---
N805.py:7:20: N805 [*] First argument of a method should be named `self`
  |
6 | class Class:
7 |     def bad_method(this):
  |                    ^^^^ N805
8 |         pass
  |
  = help: Rename `this` to `self`

ℹ Unsafe fix
4 4 | 
5 5 | 
6 6 | class Class:
7   |-    def bad_method(this):
  7 |+    def bad_method(self):
8 8 |         pass
9 9 | 
10 10 |     if False:

N805.py:11:30: N805 [*] First argument of a method should be named `self`
   |
10 |     if False:
11 |         def extra_bad_method(this):
   |                              ^^^^ N805
12 |             pass
   |
   = help: Rename `this` to `self`

ℹ Unsafe fix
8  8  |         pass
9  9  | 
10 10 |     if False:
11    |-        def extra_bad_method(this):
   11 |+        def extra_bad_method(self):
12 12 |             pass
13 13 | 
14 14 |     def good_method(self):

N805.py:63:29: N805 [*] First argument of a method should be named `self`
   |
61 |         pass
62 |
63 |     def bad_method_pos_only(this, blah, /, something: str):
   |                             ^^^^ N805
64 |         pass
   |
   = help: Rename `this` to `self`

ℹ Unsafe fix
60 60 |     def good_method_pos_only(self, blah, /, something: str):
61 61 |         pass
62 62 | 
63    |-    def bad_method_pos_only(this, blah, /, something: str):
   63 |+    def bad_method_pos_only(self, blah, /, something: str):
64 64 |         pass
65 65 | 
66 66 | 

N805.py:69:13: N805 [*] First argument of a method should be named `self`
   |
67 | class ModelClass:
68 |     @hybrid_property
69 |     def bad(cls):
   |             ^^^ N805
70 |         pass
   |
   = help: Rename `cls` to `self`

ℹ Unsafe fix
66 66 | 
67 67 | class ModelClass:
68 68 |     @hybrid_property
69    |-    def bad(cls):
   69 |+    def bad(self):
70 70 |         pass
71 71 | 
72 72 |     @bad.expression

N805.py:77:13: N805 [*] First argument of a method should be named `self`
   |
76 |     @bad.wtf
77 |     def bad(cls):
   |             ^^^ N805
78 |         pass
   |
   = help: Rename `cls` to `self`

ℹ Unsafe fix
74 74 |         pass
75 75 | 
76 76 |     @bad.wtf
77    |-    def bad(cls):
   77 |+    def bad(self):
78 78 |         pass
79 79 | 
80 80 |     @hybrid_property

N805.py:93:19: N805 [*] First argument of a method should be named `self`
   |
92 |     @foobar.thisisstatic
93 |     def badstatic(foo):
   |                   ^^^ N805
94 |         pass
   |
   = help: Rename `foo` to `self`

ℹ Unsafe fix
90 90 |         pass
91 91 | 
92 92 |     @foobar.thisisstatic
93    |-    def badstatic(foo):
   93 |+    def badstatic(self):
94 94 |         pass
95 95 | 
96 96 | 

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

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

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

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

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

N805.py:115:20: N805 [*] First argument of a method should be named `self`
    |
114 | class RenamingInMethodBodyClass:
115 |     def bad_method(this):
    |                    ^^^^ N805
116 |         this = this
117 |         this
    |
    = help: Rename `this` to `self`

ℹ Unsafe fix
112 112 | 
113 113 | 
114 114 | class RenamingInMethodBodyClass:
115     |-    def bad_method(this):
116     |-        this = this
117     |-        this
    115 |+    def bad_method(self):
    116 |+        self = self
    117 |+        self
118 118 | 
119 119 |     def bad_method(this):
120 120 |         self = this

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

ℹ Unsafe fix
116 116 |         this = this
117 117 |         this
118 118 | 
119     |-    def bad_method(this):
120     |-        self = this
    119 |+    def bad_method(self):
    120 |+        self = self
121 121 | 
122 122 | 
123 123 | class RenamingWithNFKC:

N805.py:124:17: N805 [*] First argument of a method should be named `self`
    |
123 | class RenamingWithNFKC:
124 |     def formula(household):
    |                 ^^^^^^^^^ N805
125 |         hºusehold(1)
    |
    = help: Rename `household` to `self`

ℹ Unsafe fix
121 121 | 
122 122 | 
123 123 | class RenamingWithNFKC:
124     |-    def formula(household):
125     |-        hºusehold(1)
    124 |+    def formula(self):
    125 |+        self(1)
126 126 | 
127 127 | 
128 128 | from typing import Protocol
