Skip to content

Commit

Permalink
Deploying to gh-pages from @ 9ab2702 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
vdiez committed Apr 19, 2024
1 parent de25533 commit 49873eb
Show file tree
Hide file tree
Showing 9 changed files with 59 additions and 167 deletions.
41 changes: 27 additions & 14 deletions rules/S1093/default-description.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,56 @@ <h2 id="_description">Description</h2>
<h2 id="_why_is_this_an_issue">Why is this an issue?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Using a <code>&lt;li&gt;</code> or <code>&lt;dt&gt;</code> item tag outside of a <code>&lt;ul&gt;</code>, <code>&lt;ol&gt;</code> or <code>&lt;dl&gt;</code> one does not make sense and indicates a bug.</p>
<p>The <code>&lt;dt&gt;</code> HTML element specifies a term in a description or definition list, and as such must be used inside a <code>&lt;dl&gt;</code> element, which represents a description list. Common uses for this element are to implement a glossary or to display metadata.</p>
</div>
<div class="paragraph">
<p>The <code>&lt;li&gt;</code> HTML element is used to represent an item in a list. It must be contained in a parent element: an ordered list (<code>&lt;ol&gt;</code>), an unordered list (<code>&lt;ul&gt;</code>), or a menu (<code>&lt;menu&gt;</code>).</p>
</div>
<div class="paragraph">
<p>Using a <code>&lt;li&gt;</code> or <code>&lt;dt&gt;</code> item tag outside of the aforementioned parent elements does not follow the HTML specification.</p>
</div>
<div class="sect2">
<h3 id="_noncompliant_code_example">Noncompliant code example</h3>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-html" data-lang="html">&lt;li&gt;Apple&lt;/li&gt; &lt;!-- Noncompliant --&gt;
&lt;li&gt;Strawberry&lt;/li&gt; &lt;!-- Noncompliant --&gt;

&lt;li&gt;Apple&lt;/li&gt; &lt;!-- Noncompliant --&gt;
&lt;li&gt;Strawberry&lt;/li&gt; &lt;!-- Noncompliant --&gt;

&lt;dt&gt;Apple&lt;/dt&gt; &lt;!-- Noncompliant --&gt;
&lt;dt&gt;Strawberry&lt;/dt&gt; &lt;!-- Noncompliant --&gt;</code></pre>
</div>
</div>
<div class="paragraph">
<p>To fix this issue, enclose <code>&lt;li&gt;</code> and <code>&lt;dt&gt;</code> with their respective allowed parent tags.</p>
</div>
<div class="sect2">
<h3 id="_compliant_solution">Compliant solution</h3>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-html" data-lang="html">&lt;ul&gt;
<pre class="highlight"><code class="language-html" data-lang="html">&lt;ul&gt; &lt;!-- or &lt;ul&gt; or &lt;menu&gt; --&gt;
&lt;li&gt;Apple&lt;/li&gt;
&lt;li&gt;Strawberry&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Apple&lt;/li&gt;
&lt;li&gt;Strawberry&lt;/li&gt;
&lt;/ol&gt;

&lt;dl&gt;
&lt;dt&gt;Apple&lt;/dt&gt;
&lt;dt&gt;Strawberry&lt;/dt&gt;
&lt;/dl&gt;</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_resources">Resources</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_documentation">Documentation</h3>
<div class="ulist">
<ul>
<li>
<p>MDN web docs - <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li"><code>&lt;li&gt;</code>: The List Item element</a></p>
</li>
<li>
<p>MDN web docs - <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dt"><code>&lt;dt&gt;</code>: The Description Term element</a></p>
</li>
</ul>
</div>
<hr>
</div>
</div>
Expand Down
41 changes: 27 additions & 14 deletions rules/S1093/html-description.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,56 @@ <h2 id="_description">Description</h2>
<h2 id="_why_is_this_an_issue">Why is this an issue?</h2>
<div class="sectionbody">
<div class="paragraph">
<p>Using a <code>&lt;li&gt;</code> or <code>&lt;dt&gt;</code> item tag outside of a <code>&lt;ul&gt;</code>, <code>&lt;ol&gt;</code> or <code>&lt;dl&gt;</code> one does not make sense and indicates a bug.</p>
<p>The <code>&lt;dt&gt;</code> HTML element specifies a term in a description or definition list, and as such must be used inside a <code>&lt;dl&gt;</code> element, which represents a description list. Common uses for this element are to implement a glossary or to display metadata.</p>
</div>
<div class="paragraph">
<p>The <code>&lt;li&gt;</code> HTML element is used to represent an item in a list. It must be contained in a parent element: an ordered list (<code>&lt;ol&gt;</code>), an unordered list (<code>&lt;ul&gt;</code>), or a menu (<code>&lt;menu&gt;</code>).</p>
</div>
<div class="paragraph">
<p>Using a <code>&lt;li&gt;</code> or <code>&lt;dt&gt;</code> item tag outside of the aforementioned parent elements does not follow the HTML specification.</p>
</div>
<div class="sect2">
<h3 id="_noncompliant_code_example">Noncompliant code example</h3>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-html" data-lang="html">&lt;li&gt;Apple&lt;/li&gt; &lt;!-- Noncompliant --&gt;
&lt;li&gt;Strawberry&lt;/li&gt; &lt;!-- Noncompliant --&gt;

&lt;li&gt;Apple&lt;/li&gt; &lt;!-- Noncompliant --&gt;
&lt;li&gt;Strawberry&lt;/li&gt; &lt;!-- Noncompliant --&gt;

&lt;dt&gt;Apple&lt;/dt&gt; &lt;!-- Noncompliant --&gt;
&lt;dt&gt;Strawberry&lt;/dt&gt; &lt;!-- Noncompliant --&gt;</code></pre>
</div>
</div>
<div class="paragraph">
<p>To fix this issue, enclose <code>&lt;li&gt;</code> and <code>&lt;dt&gt;</code> with their respective allowed parent tags.</p>
</div>
<div class="sect2">
<h3 id="_compliant_solution">Compliant solution</h3>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-html" data-lang="html">&lt;ul&gt;
<pre class="highlight"><code class="language-html" data-lang="html">&lt;ul&gt; &lt;!-- or &lt;ul&gt; or &lt;menu&gt; --&gt;
&lt;li&gt;Apple&lt;/li&gt;
&lt;li&gt;Strawberry&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;Apple&lt;/li&gt;
&lt;li&gt;Strawberry&lt;/li&gt;
&lt;/ol&gt;

&lt;dl&gt;
&lt;dt&gt;Apple&lt;/dt&gt;
&lt;dt&gt;Strawberry&lt;/dt&gt;
&lt;/dl&gt;</code></pre>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_resources">Resources</h2>
<div class="sectionbody">
<div class="sect2">
<h3 id="_documentation">Documentation</h3>
<div class="ulist">
<ul>
<li>
<p>MDN web docs - <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li"><code>&lt;li&gt;</code>: The List Item element</a></p>
</li>
<li>
<p>MDN web docs - <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dt"><code>&lt;dt&gt;</code>: The Description Term element</a></p>
</li>
</ul>
</div>
<hr>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion rules/S5255/default-metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"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","constantCost":"5min"},"tags":["accessibility","wcag2-a"],"extra":{"replacementRules":[],"legacyKeys":[]},"defaultSeverity":"Major","ruleSpecification":"RSPEC-5255","sqKey":"S5255","scope":"Main","defaultQualityProfiles":["Sonar way"],"quickfix":"unknown","allKeys":["S5255"],"prUrl":"https://github.com/SonarSource/rspec/pull/3872","branch":"rule/S5255-add-javascript","languagesSupport":[{"name":"html","status":"ready"},{"name":"javascript","status":"ready"}]}
{"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","constantCost":"5min"},"tags":["accessibility","wcag2-a"],"extra":{"replacementRules":[],"legacyKeys":[]},"defaultSeverity":"Major","ruleSpecification":"RSPEC-5255","sqKey":"S5255","scope":"Main","defaultQualityProfiles":["Sonar way"],"quickfix":"unknown","allKeys":["S5255"],"branch":"master","languagesSupport":[{"name":"html","status":"ready"}]}
2 changes: 1 addition & 1 deletion rules/S5255/html-metadata.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"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","constantCost":"5min"},"tags":["accessibility","wcag2-a"],"extra":{"replacementRules":[],"legacyKeys":[]},"defaultSeverity":"Major","ruleSpecification":"RSPEC-5255","sqKey":"S5255","scope":"Main","defaultQualityProfiles":["Sonar way"],"quickfix":"unknown","allKeys":["S5255"],"prUrl":"https://github.com/SonarSource/rspec/pull/3872","branch":"rule/S5255-add-javascript","languagesSupport":[{"name":"html","status":"ready"},{"name":"javascript","status":"ready"}]}
{"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","constantCost":"5min"},"tags":["accessibility","wcag2-a"],"extra":{"replacementRules":[],"legacyKeys":[]},"defaultSeverity":"Major","ruleSpecification":"RSPEC-5255","sqKey":"S5255","scope":"Main","defaultQualityProfiles":["Sonar way"],"quickfix":"unknown","allKeys":["S5255"],"branch":"master","languagesSupport":[{"name":"html","status":"ready"}]}
133 changes: 0 additions & 133 deletions rules/S5255/javascript-description.html

This file was deleted.

1 change: 0 additions & 1 deletion rules/S5255/javascript-metadata.json

This file was deleted.

2 changes: 1 addition & 1 deletion rules/rule-index-aggregates.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"langs":{"abap":123,"apex":70,"cfamily":898,"csharp":589,"default":3518,"flex":100,"go":56,"java":970,"javascript":557,"jcl":19,"kotlin":158,"php":326,"python":415,"rpg":94,"ruby":42,"scala":43,"swift":149,"plsql":216,"vbnet":263,"html":103,"pli":34,"tsql":86,"vb6":65,"xml":60,"cobol":225,"css":28,"azureresourcemanager":32,"cloudformation":28,"docker":35,"kubernetes":24,"terraform":51,"secrets":63,"text":1},"tags":{"convention":207,"cert":300,"misra-c++2008":59,"pitfall":306,"based-on-misra":206,"cppcoreguidelines":86,"suspicious":174,"brain-overload":84,"misra":28,"bad-practice":126,"unused":84,"clumsy":179,"lock-in":49,"cwe":370,"error-handling":62,"psr2":8,"error-reporting":3,"user-experience":26,"sql":103,"obsolete":58,"android":26,"accessibility":48,"react":77,"wcag2-a":10,"injection":1,"html5":5,"cross-browser":4,"design":49,"bug":37,"confusing":131,"unpredictable":44,"es2015":22,"type-dependent":72,"redundant":25,"performance":191,"since-c++11":60,"multi-threading":55,"leak":16,"denial-of-service":16,"symbolic-execution":62,"microfocus":1,"logging":15,"jsp-jsf":6,"preprocessor":11,"java8":24,"tests":65,"junit":23,"phpunit":12,"security":5,"python3":10,"psr1":3,"per":2,"finding":12,"i18n":1,"serialization":18,"hibernate":9,"spring":47,"express.js":17,"privacy":13,"api-design":31,"singleton":1,"AWS":1,"overflow":3,"jasmine":1,"jest":1,"mocha":4,"node":1,"struts":4,"misra-c2012":12,"backbone":3,"misra-c2004":19,"docker":2,"angularjs":1,"ejb":3,"jee":6,"chai":5,"jquery":1,"assertj":7,"mockito":5,"msvc":1,"swing":1,"deadlock":3,"async-await":8,"php-ini":6,"maven":9,"since-c++14":5,"c11":1,"gnu":3,"xsd":18,"localisation":4,"duplicate":1,"mef":3,"winforms":1,"event":1,"regex":39,"wpf":1,"xaml":1,"proficiency":5,"aws":33,"azure":24,"gcp":20,"rules":1,"antipattern":1,"jsx":8,"yield":1,"django":1,"flask":1,"debug":1,"java7":1,"guava":1,"java9":2,"full-project":3,"ssl":2,"phishing":1,"java14":6,"dockerfile":11,"governor-limits":5,"since-c++17":23,"unittest":1,"java15":1,"since-c++20":65,"java16":12,"java10":1,"java17":1,"startup-time":2,"coroutines":12,"cwe-284":1,"javadoc":12,"java18":9,"floating-point":1,"numbers":1,"precision":1,"architecture":4,"async":1,"promise":1,"sans-top25-insecure":1,"enum":2,"object":1,"string":1,"shell":1,"assertion":1,"function":1,"type":1,"es2020":1,"nullish-coalescing":1,"rspec-showcase":3,"Gradle":2,"gradle":10,"es2022":1,"es2018":1,"jspecify":1,"nullability":1,"data-science":19,"numpy":12,"pandas":8,"blazor":9,"paths":1,"best-practice":1,"java21":15,"sustainability":10,"java":1,"jpa":1,"susceptibility":1,"asp.net":10,"assembler":1},"qualityProfiles":{"Sonar way":2345,"Drupal":1}}
{"langs":{"abap":123,"apex":70,"cfamily":898,"csharp":589,"default":3518,"flex":100,"go":56,"java":970,"javascript":556,"jcl":19,"kotlin":158,"php":326,"python":415,"rpg":94,"ruby":42,"scala":43,"swift":149,"plsql":216,"vbnet":263,"html":103,"pli":34,"tsql":86,"vb6":65,"xml":60,"cobol":225,"css":28,"azureresourcemanager":32,"cloudformation":28,"docker":35,"kubernetes":24,"terraform":51,"secrets":63,"text":1},"tags":{"convention":207,"cert":300,"misra-c++2008":59,"pitfall":306,"based-on-misra":206,"cppcoreguidelines":86,"suspicious":174,"brain-overload":84,"misra":28,"bad-practice":126,"unused":84,"clumsy":179,"lock-in":49,"cwe":370,"error-handling":62,"psr2":8,"error-reporting":3,"user-experience":26,"sql":103,"obsolete":58,"android":26,"accessibility":48,"react":77,"wcag2-a":10,"injection":1,"html5":5,"cross-browser":4,"design":49,"bug":37,"confusing":131,"unpredictable":44,"es2015":22,"type-dependent":72,"redundant":25,"performance":191,"since-c++11":60,"multi-threading":55,"leak":16,"denial-of-service":16,"symbolic-execution":62,"microfocus":1,"logging":15,"jsp-jsf":6,"preprocessor":11,"java8":24,"tests":65,"junit":23,"phpunit":12,"security":5,"python3":10,"psr1":3,"per":2,"finding":12,"i18n":1,"serialization":18,"hibernate":9,"spring":47,"express.js":17,"privacy":13,"api-design":31,"singleton":1,"AWS":1,"overflow":3,"jasmine":1,"jest":1,"mocha":4,"node":1,"struts":4,"misra-c2012":12,"backbone":3,"misra-c2004":19,"docker":2,"angularjs":1,"ejb":3,"jee":6,"chai":5,"jquery":1,"assertj":7,"mockito":5,"msvc":1,"swing":1,"deadlock":3,"async-await":8,"php-ini":6,"maven":9,"since-c++14":5,"c11":1,"gnu":3,"xsd":18,"localisation":4,"duplicate":1,"mef":3,"winforms":1,"event":1,"regex":39,"wpf":1,"xaml":1,"proficiency":5,"aws":33,"azure":24,"gcp":20,"rules":1,"antipattern":1,"jsx":8,"yield":1,"django":1,"flask":1,"debug":1,"java7":1,"guava":1,"java9":2,"full-project":3,"ssl":2,"phishing":1,"java14":6,"dockerfile":11,"governor-limits":5,"since-c++17":23,"unittest":1,"java15":1,"since-c++20":65,"java16":12,"java10":1,"java17":1,"startup-time":2,"coroutines":12,"cwe-284":1,"javadoc":12,"java18":9,"floating-point":1,"numbers":1,"precision":1,"architecture":4,"async":1,"promise":1,"sans-top25-insecure":1,"enum":2,"object":1,"string":1,"shell":1,"assertion":1,"function":1,"type":1,"es2020":1,"nullish-coalescing":1,"rspec-showcase":3,"Gradle":2,"gradle":10,"es2022":1,"es2018":1,"jspecify":1,"nullability":1,"data-science":19,"numpy":12,"pandas":8,"blazor":9,"paths":1,"best-practice":1,"java21":15,"sustainability":10,"java":1,"jpa":1,"susceptibility":1,"asp.net":10,"assembler":1},"qualityProfiles":{"Sonar way":2345,"Drupal":1}}
2 changes: 1 addition & 1 deletion rules/rule-index-store.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion rules/rule-index.json

Large diffs are not rendered by default.

0 comments on commit 49873eb

Please sign in to comment.