Skip to content

Commit 8111b33

Browse files
guillaume-dequennesonartech
authored andcommitted
Update rules metadata (#1049)
GitOrigin-RevId: 5ad303c240cb4f260a5618f58d6c23872e59819f
1 parent 01f328c commit 8111b33

File tree

6 files changed

+26
-10
lines changed

6 files changed

+26
-10
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<p>This is an issue when a Flask error handler returns a response without explicitly specifying the HTTP status code.</p>
1+
<p>This rule raises an issue when a Flask error handler returns a response without explicitly specifying the HTTP status code.</p>
22
<h2>Why is this an issue?</h2>
33
<p>Flask error handlers do not automatically set the HTTP status code based on the error type they handle. When you register an error handler with
44
<code>@app.errorhandler(404)</code>, Flask does not automatically return a 404 status code from that handler.</p>

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,18 @@ <h2>Why is this an issue?</h2>
44
<code>key in dict.keys()</code>, you are being unnecessarily verbose.</p>
55
<p>The expression <code>key in dict</code> is the idiomatic Python way to check for key membership. It is:</p>
66
<ul>
7-
<li><em>more readable</em>: the intent is clearer and the code is shorter</li>
8-
<li><em>slightly more efficient</em>: it avoids creating an intermediate dictionary view object</li>
9-
<li><em>more Pythonic</em>: it follows Python's principle of having one obvious way to do it</li>
7+
<li><strong>more readable</strong>: the intent is clearer and the code is shorter</li>
8+
<li><strong>slightly more efficient</strong>: it avoids creating an intermediate dictionary view object</li>
9+
<li><strong>more Pythonic</strong>: it follows Pythons principle of having <em>one obvious way to do it</em></li>
1010
</ul>
1111
<p>The <code>.keys()</code> method exists primarily for cases where you need to perform set operations on dictionary keys or when you need an explicit
1212
view object. For simple membership testing, it is redundant because dictionaries are designed to support the <code>in</code> operator directly.</p>
13+
<h3>What is the potential impact?</h3>
14+
<p>Unnecessarily verbose code patterns accumulate over a codebase and reduce readability. Following Python idioms makes code easier to review and
15+
maintain, and helps new contributors understand the codebase faster.</p>
1316
<h2>How to fix it</h2>
14-
<p>Remove the <code>.keys()</code> call and use direct membership testing on the dictionary.</p>
17+
<p>Remove the <code>.keys()</code> call and use direct membership testing on the dictionary. This is the standard Python idiom for checking if a key
18+
exists in a dictionary.</p>
1519
<h3>Code examples</h3>
1620
<h4>Noncompliant code example</h4>
1721
<pre data-diff-id="1" data-diff-type="noncompliant">
@@ -33,3 +37,4 @@ <h3>Documentation</h3>
3337
<li>Python Documentation - <a href="https://docs.python.org/3/library/stdtypes.html#mapping-types-dict">Mapping Types — dict</a></li>
3438
<li>Python Documentation - <a href="https://docs.python.org/3/library/stdtypes.html#dictionary-view-objects">Dictionary view objects</a></li>
3539
</ul>
40+

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

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,21 @@
44
"status": "ready",
55
"remediation": {
66
"func": "Constant\/Issue",
7-
"constantCost": "2min"
7+
"constantCost": "1 min"
88
},
9-
"tags": [],
9+
"tags": [
10+
"pythonic",
11+
"idiom"
12+
],
1013
"defaultSeverity": "Minor",
1114
"ruleSpecification": "RSPEC-8521",
1215
"sqKey": "S8521",
1316
"scope": "All",
14-
"quickfix": "unknown"
17+
"quickfix": "unknown",
18+
"code": {
19+
"impacts": {
20+
"MAINTAINABILITY": "LOW"
21+
},
22+
"attribute": "CONVENTIONAL"
23+
}
1524
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@
225225
"S6795",
226226
"S6796",
227227
"S6799",
228+
"S6863",
228229
"S6882",
229230
"S6883",
230231
"S6887",

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@
329329
"S8414",
330330
"S8415",
331331
"S8504",
332-
"S8517"
332+
"S8517",
333+
"S8521"
333334
]
334335
}

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": "2026-03-31T15:01:06.932657Z",
6+
"latest-update": "2026-04-08T07:34:47.747313Z",
77
"options": {
88
"no-language-in-filenames": true,
99
"preserve-filenames": true

0 commit comments

Comments
 (0)