]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-17206 Update code snippets to use new data attributes
authorWouter Admiraal <wouter.admiraal@sonarsource.com>
Tue, 23 Aug 2022 14:30:15 +0000 (16:30 +0200)
committersonartech <sonartech@sonarsource.com>
Wed, 24 Aug 2022 20:03:40 +0000 (20:03 +0000)
plugins/sonar-education-plugin/src/main/resources/org/sonar/education/2codeSnippets.html
plugins/sonar-education-plugin/src/main/resources/org/sonar/education/2completelyDifferentSnippets.html
plugins/sonar-education-plugin/src/main/resources/org/sonar/education/4codeSnippets.html

index f54da216cb9dd8b0c61e09372cab71eccdbed3e0..9889cbc5ebd687a3ad6282e2bc5612cee28edc55 100644 (file)
@@ -7,7 +7,7 @@
     <li> False negatives: when a loop condition is based on an element of an array or object. </li>
 </ul>
 <h2>Noncompliant Code Example</h2>
-<pre class="diff-id-1 diff-noncompliant">for (;;) {  // Noncompliant; end condition omitted
+<pre data-diff-id="example-1" data-diff-type="noncompliant">for (;;) {  // Noncompliant; end condition omitted
   // ...
 }
 
@@ -23,7 +23,7 @@ while (b) { // Noncompliant; constant end condition
 }
 </pre>
 <h2>Compliant Solution</h2>
-<pre class="diff-id-1 diff-noncompliant">while (true) { // break will potentially allow leaving the loop
+<pre data-diff-id="example-1" data-diff-type="compliant">while (true) { // break will potentially allow leaving the loop
   if (someCondition) {
     break;
   }
index ef08cfed3acd2c11941d2df4f7e0a318c7172f01..d251f4723c2c39badf4df6cc233f1e8ae2407bed 100644 (file)
@@ -1,7 +1,7 @@
 Example with 2 completely different code snippets
 
 <h2>Noncompliant Code Example</h2>
-<pre class="diff-id-1 diff-noncompliant">
+<pre data-diff-id="1" data-diff-type="noncompliant">
 while (true) { // Noncompliant; constant end condition
   j++;
 }
@@ -13,7 +13,7 @@ while (b) { // Noncompliant; constant end condition
 }
 </pre>
 <h2>Compliant Solution</h2>
-<pre class="diff-id-1 diff-compliant">while (true) { // break will potentially allow leaving the loop
+<pre data-diff-id="1" data-diff-type="compliant">while (true) { // break will potentially allow leaving the loop
 var x = 3;
 for(let i=2; i<4; i++) {
     console.log("Hello there");
index b14c53f8602ada7470eaa6f8cba36da21c7eb620..1dba5b4431bdf633202fa5645d8a921aade4c676 100644 (file)
@@ -2,14 +2,14 @@
     it bubble up automatically, but with more code and the additional detriment of leaving maintainers scratching their heads.</p>
 <p>Such clauses should either be eliminated or populated with the appropriate logic.</p>
 <h2>Noncompliant Code Example</h2>
-<pre class="diff-id-1 diff-noncompliant">try {
+<pre data-diff-id="1" data-diff-type="noncompliant">try {
   doSomething();
 } catch (ex) {  // Noncompliant
   throw ex;
 }
 </pre>
 <h2>Compliant Solution</h2>
-<pre class="diff-id-1 diff-compliant">try {
+<pre data-diff-id="1" data-diff-type="compliant">try {
   doSomething();
 } catch (ex) {
   console.err(ex);
 </pre>
 
 <h2>Noncompliant Code Example</h2>
-<pre class="diff-id-2 diff-noncompliant">try {
+<pre data-diff-id="2" data-diff-type="noncompliant">try {
   doSomethingElse();
 } catch (ex) {  // Noncompliant
   throw ex;
 }
 </pre>
 <h2>Compliant Solution</h2>
-<pre class="diff-id-2 diff-compliant">try {
+<pre data-diff-id="2" data-diff-type="compliant">try {
   doSomethingElse();
 } catch (ex) {
   console.err(ex);