From 0ef79cc3e2fbedce2e6209ed05e9cbf5ceabdda6 Mon Sep 17 00:00:00 2001 From: Wouter Admiraal Date: Tue, 23 Aug 2022 16:30:15 +0200 Subject: [PATCH] SONAR-17206 Update code snippets to use new data attributes --- .../main/resources/org/sonar/education/2codeSnippets.html | 4 ++-- .../org/sonar/education/2completelyDifferentSnippets.html | 4 ++-- .../main/resources/org/sonar/education/4codeSnippets.html | 8 ++++---- 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 @@
  • False negatives: when a loop condition is based on an element of an array or object.
  • Noncompliant Code Example

    -
    for (;;) {  // Noncompliant; end condition omitted
    +
    for (;;) {  // Noncompliant; end condition omitted
       // ...
     }
     
    @@ -23,7 +23,7 @@ while (b) { // Noncompliant; constant end condition
     }
     

    Compliant Solution

    -
    while (true) { // break will potentially allow leaving the loop
    +
    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
     
     

    Noncompliant Code Example

    -
    +
     while (true) { // Noncompliant; constant end condition
       j++;
     }
    @@ -13,7 +13,7 @@ while (b) { // Noncompliant; constant end condition
     }
     

    Compliant Solution

    -
    while (true) { // break will potentially allow leaving the loop
    +
    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.

    Such clauses should either be eliminated or populated with the appropriate logic.

    Noncompliant Code Example

    -
    try {
    +
    try {
       doSomething();
     } catch (ex) {  // Noncompliant
       throw ex;
     }
     

    Compliant Solution

    -
    try {
    +
    try {
       doSomething();
     } catch (ex) {
       console.err(ex);
    @@ -18,14 +18,14 @@
     

    Noncompliant Code Example

    -
    try {
    +
    try {
       doSomethingElse();
     } catch (ex) {  // Noncompliant
       throw ex;
     }
     

    Compliant Solution

    -
    try {
    +
    try {
       doSomethingElse();
     } catch (ex) {
       console.err(ex);
    -- 
    2.39.5