File tree Expand file tree Collapse file tree 8 files changed +27
-19
lines changed
python-checks/src/main/resources/org/sonar/l10n/py/rules/python Expand file tree Collapse file tree 8 files changed +27
-19
lines changed Original file line number Diff line number Diff line change 1
1
< p > Any issue to quality rule can be deactivated with the < code > NOSONAR</ code > marker. This marker is pretty useful to exclude false-positive results
2
2
but it can also be used abusively to hide real quality flaws.</ p >
3
3
< p > This rule raises an issue when < code > NOSONAR</ code > is used.</ p >
4
+ < h2 > Noncompliant Code Example</ h2 >
5
+ < pre >
6
+ for d in lib_dirs:
7
+ # NOSONAR: lib_dirs is undefined
8
+ pass
9
+ </ pre >
4
10
Original file line number Diff line number Diff line change 1
- < p > Unused parameters are misleading. Whatever the values passed to such parameters, the behavior will be the same.</ p >
1
+ < p > Unused parameters are misleading. Whatever the value passed to such parameters is , the behavior will be the same.</ p >
2
2
< h2 > Noncompliant Code Example</ h2 >
3
3
< pre >
4
- def do_something(a, b): # `a` is unused
5
- return compute(b )
4
+ def do_something(a, b): # "b" is unused
5
+ return compute(a )
6
6
</ pre >
7
7
< h2 > Compliant Solution</ h2 >
8
8
< pre >
9
- def do_something(b ):
10
- return compute(b )
9
+ def do_something(a ):
10
+ return compute(a )
11
11
</ pre >
12
12
< h2 > Exceptions</ h2 >
13
- < p > Functions in classes that override a class or implement interfaces are ignored.</ p >
13
+ < p > Overriding methods are ignored.</ p >
14
14
< pre >
15
- class Parent(object):
16
- def get_value(self, a, b):
17
- return compute(a + b);
18
-
19
- class Child(Patent):
20
- def get_value(self, a, b):
21
- return compute(b)
15
+ class C(B):
16
+ def do_something(self, a, b): # no issue reported on b
17
+ return self.compute(a)
18
+ }
19
+ </ pre >
20
+ < p > Throwaway variables < code > _</ code > .</ p >
21
+ < pre >
22
+ def do_something(a, _): # no issue reported on _
23
+ return compute(a)
22
24
</ pre >
23
25
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ <h2>Compliant Solution</h2>
37
37
</ pre >
38
38
< h2 > See</ h2 >
39
39
< ul >
40
- < li > < a href ="https://owasp.org/Top10/A03_2021-Injection / "> OWASP Top 10 2021 Category A4</ a > - Insecure Design </ li >
40
+ < li > < a href ="https://owasp.org/Top10/A04_2021-Insecure_Design / "> OWASP Top 10 2021 Category A4</ a > - Insecure Design </ li >
41
41
< li > < a href ="https://owasp.org/Top10/A05_2021-Security_Misconfiguration/ "> OWASP Top 10 2021 Category A5</ a > - Security Misconfiguration </ li >
42
42
< li > < a href ="https://www.owasp.org/index.php/Top_10-2017_A3-Sensitive_Data_Exposure "> OWASP Top 10 2017 Category A3</ a > - Sensitive Data Exposure
43
43
</ li >
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ <h2>Compliant Solution</h2>
37
37
< h2 > See</ h2 >
38
38
< ul >
39
39
< li > < a href ="https://owasp.org/Top10/A01_2021-Broken_Access_Control/ "> OWASP Top 10 2021 Category A1</ a > - Broken Access Control </ li >
40
- < li > < a href ="https://owasp.org/Top10/A03_2021-Injection / "> OWASP Top 10 2021 Category A4</ a > - Insecure Design </ li >
40
+ < li > < a href ="https://owasp.org/Top10/A04_2021-Insecure_Design / "> OWASP Top 10 2021 Category A4</ a > - Insecure Design </ li >
41
41
< li > < a href ="https://www.owasp.org/index.php/Top_10-2017_A5-Broken_Access_Control "> OWASP Top 10 2017 Category A5</ a > - Broken Access Control </ li >
42
42
< li > < a href ="https://www.owasp.org/index.php/Test_File_Permission_(OTG-CONFIG-009) "> OWASP File Permission</ a > </ li >
43
43
< li > < a href ="https://cwe.mitre.org/data/definitions/732.html "> MITRE, CWE-732</ a > - Incorrect Permission Assignment for Critical Resource </ li >
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ <h2>Compliant Solution</h2>
67
67
< h2 > See</ h2 >
68
68
< ul >
69
69
< li > < a href ="https://owasp.org/Top10/A01_2021-Broken_Access_Control/ "> OWASP Top 10 2021 Category A1</ a > - Broken Access Control </ li >
70
- < li > < a href ="https://owasp.org/Top10/A03_2021-Injection / "> OWASP Top 10 2021 Category A4</ a > - Insecure Design </ li >
70
+ < li > < a href ="https://owasp.org/Top10/A04_2021-Insecure_Design / "> OWASP Top 10 2021 Category A4</ a > - Insecure Design </ li >
71
71
< li > < a href ="https://owasp.org/www-project-top-ten/OWASP_Top_Ten_2017/Top_10-2017_A5-Broken_Access_Control "> OWASP Top 10 2017 Category A5</ a > -
72
72
Broken Access Control </ li >
73
73
< li > < a href ="https://cwe.mitre.org/data/definitions/352.html "> MITRE, CWE-352</ a > - Cross-Site Request Forgery (CSRF) </ li >
Original file line number Diff line number Diff line change 2
2
difficult to maintain.</ p >
3
3
< h2 > See</ h2 >
4
4
< ul >
5
- < li > < a href ="https://redirect .sonarsource.com/doc/cognitive-complexity.html "> Cognitive Complexity</ a > </ li >
5
+ < li > < a href ="https://www .sonarsource.com/docs/CognitiveComplexity.pdf "> Cognitive Complexity</ a > </ li >
6
6
</ ul >
7
7
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ <h2>See</h2>
35
35
Sheet</ a > - XSS Prevention Cheat Sheet </ li >
36
36
< li > < a href ="https://www.owasp.org/index.php/Top_10-2017_A7-Cross-Site_Scripting_(XSS) "> OWASP Top 10 2017 Category A7</ a > - Cross-Site Scripting
37
37
(XSS) </ li >
38
- < li > < a href ="https://www.owasp.org/index.php/Top_10-2017_A6-Security_Misconfiguration "> OWASP Top 10 2017 Category A9 </ a > - Security
38
+ < li > < a href ="https://www.owasp.org/index.php/Top_10-2017_A6-Security_Misconfiguration "> OWASP Top 10 2017 Category A6 </ a > - Security
39
39
Misconfiguration </ li >
40
40
< li > < a href ="https://cwe.mitre.org/data/definitions/79.html "> MITRE, CWE-79</ a > - Improper Neutralization of Input During Web Page Generation
41
41
('Cross-site Scripting') </ li >
Original file line number Diff line number Diff line change 3
3
"languages" : [
4
4
" PY"
5
5
],
6
- "latest-update" : " 2022-02-07T13:04 :10.465499Z " ,
6
+ "latest-update" : " 2022-03-22T09:43 :10.316991700Z " ,
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