File tree Expand file tree Collapse file tree 4 files changed +19
-2
lines changed
python-checks/src/main/resources/org/sonar/l10n/py/rules/python Expand file tree Collapse file tree 4 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,19 @@ <h3>Exceptions</h3>
16
16
def do_something(a, _): # no issue reported on _
17
17
return compute(a)
18
18
</ pre >
19
+ < p > The rule also won’t raise an issue if the parameter is referenced in a docstring or a comment:</ p >
20
+ < pre >
21
+ class MyClass:
22
+ def do_something(self, my_param): # no issue reported
23
+ # Overrides may use my_param to ...
24
+ return compute(a)
25
+ </ pre >
26
+ < pre >
27
+ class MyClass:
28
+ def do_something(self, my_param): # no issue reported
29
+ """Overrides may use my_param to ..."""
30
+ return compute(a)
31
+ </ pre >
19
32
< h2 > How to fix it</ h2 >
20
33
< p > Having unused function parameters in your code can lead to confusion and misunderstanding of a developer’s intention. They reduce code readability
21
34
and introduce the potential for errors. To avoid these problems, developers should remove unused parameters from function declarations.</ p >
Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ <h4>Noncompliant code example</h4>
22
22
< pre data-diff-id ="1 " data-diff-type ="noncompliant ">
23
23
import jwt
24
24
25
- jwt.decode(token, verify= False) # Noncompliant
25
+ jwt.decode(token, options={"verify_signature": False} ) # Noncompliant
26
26
</ pre >
27
27
< h4 > Compliant solution</ h4 >
28
28
< p > By default, verification is enabled for the method < code > decode</ code > .</ p >
Original file line number Diff line number Diff line change 156
156
" S5869" ,
157
157
" S5886" ,
158
158
" S5890" ,
159
+ " S5899" ,
159
160
" S5905" ,
161
+ " S5906" ,
160
162
" S5914" ,
163
+ " S5915" ,
164
+ " S5918" ,
161
165
" S5994" ,
162
166
" S5996" ,
163
167
" S6001" ,
Original file line number Diff line number Diff line change 3
3
"languages" : [
4
4
" PY"
5
5
],
6
- "latest-update" : " 2023-11-21T10:24:38.395541Z " ,
6
+ "latest-update" : " 2023-12-04T08:58:08.586319Z " ,
7
7
"options" : {
8
8
"no-language-in-filenames" : true ,
9
9
"preserve-filenames" : true
You can’t perform that action at this time.
0 commit comments