Skip to content

Commit 490126e

Browse files
guillaume-dequennesonartech
authored andcommitted
SONARPY-3327 Update rules metadata (#481)
GitOrigin-RevId: 65ade05b48078bb9e99469ce89d5ae0da06367db
1 parent b8ab64d commit 490126e

9 files changed

Lines changed: 22 additions & 12 deletions

File tree

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S4784.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<p>This rule is deprecated; use {rule:python:S5852}, {rule:pythonsecurity:S2631} instead.</p>
1+
<p>This rule is deprecated; use {rule:python:S5852} instead.</p>
22
<p>Using regular expressions is security-sensitive. It has led in the past to the following vulnerabilities:</p>
33
<ul>
44
<li> <a href="https://www.cve.org/CVERecord?id=CVE-2017-16021">CVE-2017-16021</a> </li>

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S6554.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,7 @@ <h4>Compliant solution</h4>
2626
</pre>
2727
<h2>Resources</h2>
2828
<h3>Documentation</h3>
29-
<p><a href="https://docs.djangoproject.com/en/4.1/ref/models/instances/#django.db.models.Model.<em>str</em>">Django Model.<em>str</em>()</a></p>
29+
<p><a
30+
href="https://docs.djangoproject.com/en/4.1/ref/models/instances/#django.db.models.Model">https://docs.djangoproject.com/en/4.1/ref/models/instances/#django.db.models.Model</a>.<em>str</em>[Django
31+
Model.<em>str</em>()]</p>
3032

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S6662.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ <h4>Compliant solution</h4>
3131
<h2>Resources</h2>
3232
<h3>Documentation</h3>
3333
<ul>
34-
<li> Python Documentation - <a href="https://docs.python.org/3/reference/datamodel.html#object.<em>hash</em>">object.<em>hash</em></a> </li>
34+
<li> Python Documentation - <a
35+
href="https://docs.python.org/3/reference/datamodel.html#object">https://docs.python.org/3/reference/datamodel.html#object</a>.<em>hash</em>[object.<em>hash</em>] </li>
3536
<li> Python Documentation - <a href="https://docs.python.org/3/library/functions.html#hash">the hash built-in function</a> </li>
3637
</ul>
3738

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S6663.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,7 @@ <h4>Compliant solution</h4>
3434
</pre>
3535
<h2>Resources</h2>
3636
<h3>Documentation</h3>
37-
<p>Python Documentation - <a href="https://docs.python.org/3/library/operator.html#operator.<em>index</em>"><em>index</em> method</a></p>
37+
<p>Python Documentation - <a
38+
href="https://docs.python.org/3/library/operator.html#operator">https://docs.python.org/3/library/operator.html#operator</a>.<em>index</em>[<em>index</em>
39+
method]</p>
3840

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S7613.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ <h3>Documentation</h3>
6464
<li> AWS Documentation - <a href="https://docs.aws.amazon.com/lambda/latest/dg/python-handler.html#python-handler-return">Define Lambda function
6565
handler in Python </a> </li>
6666
<li> Python Documentation - <a href="https://docs.python.org/3/library/json.html">json — JSON encoder and decoder</a> </li>
67-
<li> Python Documentation - <a href="https://docs.python.org/3/reference/datamodel.html#object.<em>dict</em>">object.__dict__ field</a> </li>
67+
<li> Python Documentation - <a
68+
href="https://docs.python.org/3/reference/datamodel.html#object">https://docs.python.org/3/reference/datamodel.html#object</a>.<em>dict</em>[object.__dict__ field] </li>
6869
<li> Python Documentation - <a href="https://docs.python.org/3/library/datetime.html#datetime.date.isoformat">datetime.date.isoformat()</a> </li>
6970
<li> Python Documentation - <a href="https://docs.python.org/3/library/dataclasses.html#dataclasses.asdict">dateclasses.asdict()</a> </li>
7071
</ul>

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S7614.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"defaultSeverity": "Minor",
1111
"ruleSpecification": "RSPEC-7614",
1212
"sqKey": "S7614",
13-
"scope": "All",
13+
"scope": "Main",
1414
"quickfix": "unknown",
1515
"code": {
1616
"impacts": {

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/S7632.html

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ <h2>How to fix it</h2>
1616
<ul>
1717
<li> Use <code># NOSONAR</code> alone to suppress all issues on the line </li>
1818
<li> Use <code># NOSONAR()</code> with empty parentheses to suppress all issues </li>
19-
<li> Use <code># NOSONAR(rule1, rule2)</code> to suppress specific rules </li>
19+
<li> Use <code># NOSONAR(ruleKey1, ruleKey2)</code> to suppress specific rules </li>
2020
<li> Don’t use redundant commas in the parentheses, e.g. <code># NOSONAR(,)</code> </li>
21+
<li> The rule keys should only consist of alphanumeric characters, like <code>S7632</code> or <code>NoSonar</code> </li>
2122
<li> Close all parentheses properly </li>
2223
</ul>
2324
<p>For <code># noqa</code>:</p>
@@ -34,17 +35,19 @@ <h4>Noncompliant code example</h4>
3435
x = 1 # NOSONAR( # Noncompliant
3536
y = 2 # NOSONAR(a,) # Noncompliant
3637
z = 3 # NOSONAR)( # Noncompliant
37-
a = 4 # noqa: ,rule1 # Noncompliant
38-
b = 5 # noqa- rule1,rule2 # Noncompliant
38+
a = 4 # NOSONAR(python:S7632) # Noncompliant
39+
b = 5 # noqa: ,rule1 # Noncompliant
40+
c = 6 # noqa- rule1,rule2 # Noncompliant
3941
</pre>
4042
<h4>Compliant solution</h4>
4143
<pre data-diff-id="1" data-diff-type="compliant">
4244
def example():
4345
x = 1 # NOSONAR
4446
y = 2 # NOSONAR(a)
4547
z = 3 # NOSONAR
46-
a = 4 # noqa: rule1
47-
b = 5 # noqa: rule1,rule2
48+
a = 4 # NOSONAR(S7632)
49+
b = 5 # noqa: rule1
50+
c = 6 # noqa: rule1,rule2
4851
</pre>
4952
<h2>Resources</h2>
5053
<h3>Documentation</h3>

python-checks/src/main/resources/org/sonar/l10n/py/rules/python/Sonar_way_profile.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@
294294
"S7608",
295295
"S7609",
296296
"S7613",
297+
"S7614",
297298
"S7617",
298299
"S7618",
299300
"S7619",

sonarpedia.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"languages": [
44
"PY"
55
],
6-
"latest-update": "2025-08-18T14:36:17.206114098Z",
6+
"latest-update": "2025-09-03T07:23:40.081513Z",
77
"options": {
88
"no-language-in-filenames": true,
99
"preserve-filenames": true

0 commit comments

Comments
 (0)