Skip to content

Commit

Permalink
SONARHTML-175 Update rule metadata with clean code taxonomy attributes (
Browse files Browse the repository at this point in the history
  • Loading branch information
saberduck committed Aug 17, 2023
1 parent 1465444 commit c877f85
Show file tree
Hide file tree
Showing 32 changed files with 190 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Sections of code should not be commented out",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "CLEAR"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Attributes should be quoted using double quotes rather than single ones",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "LOW"
},
"attribute": "CONVENTIONAL"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<h2>Why is this an issue?</h2>
<p>A source file that grows too much tends to aggregate too many responsibilities and inevitably becomes harder to understand and, therefore, to
maintain.</p>
<p>When a source file grows too much, it can accumulate numerous responsibilities and become challenging to understand and maintain.</p>
<p>Above a specific threshold, refactor the file into smaller files whose code focuses on well-defined tasks. Those smaller files will be easier to
understand and easier to test.</p>
understand and test.</p>

Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Files should not have too many lines",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "FOCUSED"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Track lack of copyright and license headers",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "HIGH"
},
"attribute": "LAWFUL"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Track uses of disallowed namespaces in XHTML documents",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "CONVENTIONAL"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Tabulation characters should not be used",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "LOW"
},
"attribute": "FORMATTED"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Image, area and button with image tags should have an \"alt\" attribute",
"type": "BUG",
"code": {
"impacts": {
"RELIABILITY": "LOW"
},
"attribute": "COMPLETE"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Javascript scriptlets should not have too many lines of code",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "FOCUSED"
},
"status": "ready",
"remediation": {
"func": "Linear",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Lines should not be too long",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "FORMATTED"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Mouse events should have corresponding keyboard events",
"type": "BUG",
"code": {
"impacts": {
"RELIABILITY": "LOW"
},
"attribute": "COMPLETE"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ <h2>Why is this an issue?</h2>
<p><code>FIXME</code> tags are commonly used to mark places where a bug is suspected, but which the developer wants to deal with later.</p>
<p>Sometimes the developer will not have the time or will simply forget to get back to that tag.</p>
<p>This rule is meant to track those tags and to ensure that they do not go unnoticed.</p>
<h3>Noncompliant code example</h3>
<pre>
&lt;html&gt;
&lt;!-- FIXME support small device --&gt;
...
&lt;/html&gt;
</pre>
<h2>Resources</h2>
<h3>Documentation</h3>
<ul>
<li> <a href="https://cwe.mitre.org/data/definitions/546">MITRE, CWE-546</a> - Suspicious Comment </li>
<li> <a href="https://cwe.mitre.org/data/definitions/546">MITRE, CWE-546 - Suspicious Comment</a> </li>
</ul>

Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Track uses of \"FIXME\" tags",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "COMPLETE"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand All @@ -18,5 +24,5 @@
546
]
},
"quickfix": "unknown"
"quickfix": "infeasible"
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
<h2>Why is this an issue?</h2>
<p><code>TODO</code> tags are commonly used to mark places where some more code is required, but which the developer wants to implement later.</p>
<p>Sometimes the developer will not have the time or will simply forget to get back to that tag.</p>
<p>This rule is meant to track those tags and to ensure that they do not go unnoticed.</p>
<p>Developers often use <code>TOOO</code> tags to mark areas in the code where additional work or improvements are needed but are not implemented
immediately. However, these <code>TODO</code> tags sometimes get overlooked or forgotten, leading to incomplete or unfinished code. This code smell
class aims to identify and address such unattended <code>TODO</code> tags to ensure a clean and maintainable codebase. This description will explore
why this is a problem and how it can be fixed to improve the overall code quality.</p>
<h3>What is the potential impact?</h3>
<p>Unattended <code>TODO</code> tags in code can have significant implications for the development process and the overall codebase.</p>
<p>Incomplete Functionality: When developers leave <code>TODO</code> tags without implementing the corresponding code, it results in incomplete
functionality within the software. This can lead to unexpected behavior or missing features, adversely affecting the end-user experience.</p>
<p>Missed Bug Fixes: If developers do not promptly address <code>TODO</code> tags, they might overlook critical bug fixes and security updates.
Delayed bug fixes can result in more severe issues and increase the effort required to resolve them later.</p>
<p>Impact on Collaboration: In team-based development environments, unattended <code>TODO</code> tags can hinder collaboration. Other team members
might not be aware of the intended changes, leading to conflicts or redundant efforts in the codebase.</p>
<p>Codebase Bloat: Accumulation of unattended <code>TODO</code> tags over time can clutter the codebase and make it difficult to distinguish between
work in progress and completed code. This bloat can make it challenging to maintain an organized and efficient codebase.</p>
<p>Addressing this code smell is essential to ensure a maintainable, readable, reliable codebase and promote effective collaboration among
developers.</p>
<h3>Noncompliant code example</h3>
<pre>
&lt;html&gt;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Track uses of \"TODO\" tags",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "LOW"
},
"attribute": "COMPLETE"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Track lack of required an element with the required \"id\"",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "CONVENTIONAL"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Attributes deprecated in HTML5 should not be used",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "CONVENTIONAL"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Videos should have subtitles",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "COMPLETE"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "\u003cscript\u003e...\u003c\/script\u003e elements should not be nested",
"type": "BUG",
"code": {
"impacts": {
"RELIABILITY": "MEDIUM"
},
"attribute": "LOGICAL"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Authorizing an opened window to access back to the originating window is security-sensitive",
"type": "SECURITY_HOTSPOT",
"code": {
"impacts": {
"SECURITY": "LOW"
},
"attribute": "COMPLETE"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "\"\u003chtml\u003e\" element should have a language attribute",
"type": "BUG",
"code": {
"impacts": {
"RELIABILITY": "MEDIUM"
},
"attribute": "COMPLETE"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "\"aria-label\" or \"aria-labelledby\" attributes should be used to differentiate similar elements",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "COMPLETE"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Tables should have headers",
"type": "BUG",
"code": {
"impacts": {
"RELIABILITY": "MEDIUM"
},
"attribute": "COMPLETE"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "HTML \"\u003ctable\u003e\" should not be used for layout purposes",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "MEDIUM"
},
"attribute": "LOGICAL"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Tables used for layout should not include semantic markup",
"type": "BUG",
"code": {
"impacts": {
"RELIABILITY": "HIGH"
},
"attribute": "LOGICAL"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Table cells should reference their headers",
"type": "BUG",
"code": {
"impacts": {
"RELIABILITY": "HIGH"
},
"attribute": "CLEAR"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "\"\u003cobject\u003e\" tags should provide an alternative content",
"type": "CODE_SMELL",
"code": {
"impacts": {
"MAINTAINABILITY": "LOW"
},
"attribute": "COMPLETE"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "Using remote artifacts without integrity checks is security-sensitive",
"type": "SECURITY_HOTSPOT",
"code": {
"impacts": {
"SECURITY": "LOW"
},
"attribute": "COMPLETE"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"title": "All HTML tags should be closed ",
"type": "BUG",
"code": {
"impacts": {
"RELIABILITY": "LOW"
},
"attribute": "COMPLETE"
},
"status": "ready",
"remediation": {
"func": "Constant\/Issue",
Expand Down
Loading

0 comments on commit c877f85

Please sign in to comment.