aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/sonar-education-plugin
diff options
context:
space:
mode:
authorWouter Admiraal <wouter.admiraal@sonarsource.com>2022-08-23 16:30:15 +0200
committersonartech <sonartech@sonarsource.com>2022-08-24 20:03:40 +0000
commit0ef79cc3e2fbedce2e6209ed05e9cbf5ceabdda6 (patch)
tree757852109df7aa76b8d571305e559915c59fe672 /plugins/sonar-education-plugin
parent24d484518d9071a31b18ac8624e482654b2c10d6 (diff)
downloadsonarqube-0ef79cc3e2fbedce2e6209ed05e9cbf5ceabdda6.tar.gz
sonarqube-0ef79cc3e2fbedce2e6209ed05e9cbf5ceabdda6.zip
SONAR-17206 Update code snippets to use new data attributes
Diffstat (limited to 'plugins/sonar-education-plugin')
-rw-r--r--plugins/sonar-education-plugin/src/main/resources/org/sonar/education/2codeSnippets.html4
-rw-r--r--plugins/sonar-education-plugin/src/main/resources/org/sonar/education/2completelyDifferentSnippets.html4
-rw-r--r--plugins/sonar-education-plugin/src/main/resources/org/sonar/education/4codeSnippets.html8
3 files changed, 8 insertions, 8 deletions
diff --git a/plugins/sonar-education-plugin/src/main/resources/org/sonar/education/2codeSnippets.html b/plugins/sonar-education-plugin/src/main/resources/org/sonar/education/2codeSnippets.html
index f54da216cb9..9889cbc5ebd 100644
--- a/plugins/sonar-education-plugin/src/main/resources/org/sonar/education/2codeSnippets.html
+++ b/plugins/sonar-education-plugin/src/main/resources/org/sonar/education/2codeSnippets.html
@@ -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;
}
diff --git a/plugins/sonar-education-plugin/src/main/resources/org/sonar/education/2completelyDifferentSnippets.html b/plugins/sonar-education-plugin/src/main/resources/org/sonar/education/2completelyDifferentSnippets.html
index ef08cfed3ac..d251f4723c2 100644
--- a/plugins/sonar-education-plugin/src/main/resources/org/sonar/education/2completelyDifferentSnippets.html
+++ b/plugins/sonar-education-plugin/src/main/resources/org/sonar/education/2completelyDifferentSnippets.html
@@ -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");
diff --git a/plugins/sonar-education-plugin/src/main/resources/org/sonar/education/4codeSnippets.html b/plugins/sonar-education-plugin/src/main/resources/org/sonar/education/4codeSnippets.html
index b14c53f8602..1dba5b4431b 100644
--- a/plugins/sonar-education-plugin/src/main/resources/org/sonar/education/4codeSnippets.html
+++ b/plugins/sonar-education-plugin/src/main/resources/org/sonar/education/4codeSnippets.html
@@ -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);
@@ -18,14 +18,14 @@
</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);