Avoid applying ignore-names to self and cls function names (#12… · astral-sh/ruff@2a64ccc (original) (raw)

1

1

`---

`

2

2

`source: crates/ruff_linter/src/rules/pep8_naming/mod.rs

`

3

3

`---

`

``

4

`` +

N805.py:7:20: N805 [*] First argument of a method should be named self

``

``

5

`+

|

`

``

6

`+

6 | class Class:

`

``

7

`+

7 | def badAllowed(this):

`

``

8

`+

| ^^^^ N805

`

``

9

`+

8 | pass

`

``

10

`+

|

`

``

11

`` +

= help: Rename this to self

``

``

12

+

``

13

`+

ℹ Unsafe fix

`

``

14

`+

4 4 |

`

``

15

`+

5 5 |

`

``

16

`+

6 6 | class Class:

`

``

17

`+

7 |- def badAllowed(this):

`

``

18

`+

7 |+ def badAllowed(self):

`

``

19

`+

8 8 | pass

`

``

20

`+

9 9 |

`

``

21

`+

10 10 | def stillBad(this):

`

``

22

+

4

23

`` N805.py:10:18: N805 [*] First argument of a method should be named self

``

5

24

` |

`

6

25

` 8 | pass

`

`` @@ -21,6 +40,26 @@ N805.py:10:18: N805 [*] First argument of a method should be named self

``

21

40

`12 12 |

`

22

41

`13 13 | if False:

`

23

42

``

``

43

`` +

N805.py:15:24: N805 [*] First argument of a method should be named self

``

``

44

`+

|

`

``

45

`+

13 | if False:

`

``

46

`+

14 |

`

``

47

`+

15 | def badAllowed(this):

`

``

48

`+

| ^^^^ N805

`

``

49

`+

16 | pass

`

``

50

`+

|

`

``

51

`` +

= help: Rename this to self

``

``

52

+

``

53

`+

ℹ Unsafe fix

`

``

54

`+

12 12 |

`

``

55

`+

13 13 | if False:

`

``

56

`+

14 14 |

`

``

57

`+

15 |- def badAllowed(this):

`

``

58

`+

15 |+ def badAllowed(self):

`

``

59

`+

16 16 | pass

`

``

60

`+

17 17 |

`

``

61

`+

18 18 | def stillBad(this):

`

``

62

+

24

63

`` N805.py🔞22: N805 [*] First argument of a method should be named self

``

25

64

` |

`

26

65

`16 | pass

`

`` @@ -41,6 +80,25 @@ N805.py🔞22: N805 [*] First argument of a method should be named self

``

41

80

`20 20 |

`

42

81

`21 21 | @pydantic.validator

`

43

82

``

``

83

`` +

N805.py:22:20: N805 [*] First argument of a method should be named self

``

``

84

`+

|

`

``

85

`+

21 | @pydantic.validator

`

``

86

`+

22 | def badAllowed(cls, my_field: str) -> str:

`

``

87

`+

| ^^^ N805

`

``

88

`+

23 | pass

`

``

89

`+

|

`

``

90

`` +

= help: Rename cls to self

``

``

91

+

``

92

`+

ℹ Unsafe fix

`

``

93

`+

19 19 | pass

`

``

94

`+

20 20 |

`

``

95

`+

21 21 | @pydantic.validator

`

``

96

`+

22 |- def badAllowed(cls, my_field: str) -> str:

`

``

97

`+

22 |+ def badAllowed(self, my_field: str) -> str:

`

``

98

`+

23 23 | pass

`

``

99

`+

24 24 |

`

``

100

`+

25 25 | @pydantic.validator

`

``

101

+

44

102

`` N805.py:26:18: N805 [*] First argument of a method should be named self

``

45

103

` |

`

46

104

`25 | @pydantic.validator

`

`` @@ -60,6 +118,25 @@ N805.py:26:18: N805 [*] First argument of a method should be named self

``

60

118

`28 28 |

`

61

119

`29 29 | @pydantic.validator("my_field")

`

62

120

``

``

121

`` +

N805.py:30:20: N805 [*] First argument of a method should be named self

``

``

122

`+

|

`

``

123

`+

29 | @pydantic.validator("my_field")

`

``

124

`+

30 | def badAllowed(cls, my_field: str) -> str:

`

``

125

`+

| ^^^ N805

`

``

126

`+

31 | pass

`

``

127

`+

|

`

``

128

`` +

= help: Rename cls to self

``

``

129

+

``

130

`+

ℹ Unsafe fix

`

``

131

`+

27 27 | pass

`

``

132

`+

28 28 |

`

``

133

`+

29 29 | @pydantic.validator("my_field")

`

``

134

`+

30 |- def badAllowed(cls, my_field: str) -> str:

`

``

135

`+

30 |+ def badAllowed(self, my_field: str) -> str:

`

``

136

`+

31 31 | pass

`

``

137

`+

32 32 |

`

``

138

`+

33 33 | @pydantic.validator("my_field")

`

``

139

+

63

140

`` N805.py:34:18: N805 [*] First argument of a method should be named self

``

64

141

` |

`

65

142

`33 | @pydantic.validator("my_field")

`

`` @@ -79,6 +156,15 @@ N805.py:34:18: N805 [*] First argument of a method should be named self

``

79

156

`36 36 |

`

80

157

`37 37 | @classmethod

`

81

158

``

``

159

`` +

N805.py:55:20: N805 First argument of a method should be named self

``

``

160

`+

|

`

``

161

`+

54 | class PosOnlyClass:

`

``

162

`+

55 | def badAllowed(this, blah, /, self, something: str):

`

``

163

`+

| ^^^^ N805

`

``

164

`+

56 | pass

`

``

165

`+

|

`

``

166

`` +

= help: Rename this to self

``

``

167

+

82

168

`` N805.py:58:18: N805 First argument of a method should be named self

``

83

169

` |

`

84

170

`56 | pass

`