diff options
| author | Amaury Levé | 2018-06-26 18:22:35 +0200 | 
|---|---|---|
| committer | GitHub | 2018-06-26 18:22:35 +0200 | 
| commit | a54f0e2f4c99a8cc49676945486298400dcbdd40 (patch) | |
| tree | 98d26ab9c697eeb8c71b7a588ad6fe10737d2ac3 | |
| parent | 6ad2eec7823ef033f8a37a4e9606b803ade7023a (diff) | |
| download | sonar-css-a54f0e2f4c99a8cc49676945486298400dcbdd40.tar.bz2 | |
Update RSPEC metadata for implemented rules (#79)
26 files changed, 59 insertions, 48 deletions
| diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1116.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1116.html index b2bc4a3..4434acb 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1116.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1116.html @@ -1,6 +1,6 @@ -<p>Empty statements, i.e. <code>;</code>, are usually introduced by mistake, for example because:</p> +<p>Extra semicolons are usually introduced by mistake, for example because:</p>  <ul> -  <li> It was meant to be replaced by an actual statement, but this was forgotten. </li> +  <li> It was meant to be replaced by one more property declaration, but this was forgotten. </li>    <li> There was a typo which lead the semicolon to be doubled, i.e. <code>;;</code>. </li>  </ul>  <h2>See</h2> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1116.json b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1116.json index d2937b8..bc11c2b 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1116.json +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1116.json @@ -1,5 +1,5 @@  { -  "title": "Empty statements should be removed", +  "title": "Extra semicolons should be removed",    "type": "CODE_SMELL",    "status": "ready",    "remediation": { diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.html index 8dde5aa..bb0ea45 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.html @@ -1,6 +1,5 @@ -<p>The imports part of a file should be handled by the Integrated Development Environment (IDE), not manually by the developer.</p> -<p>Unused and useless imports should not occur if that is the case.</p> -<p>Leaving them in reduces the code's readability, since their presence can be confusing.</p> +<p>Having the import of the same file twice, makes one of them useless. Leaving them in reduces the code's readability, since their presence can be +confusing.</p>  <h2>Noncompliant Code Example</h2>  <pre>  @import 'a.css'; @@ -9,4 +8,6 @@  @import url("a.css");  @import url("a.css"); // Noncompliant  </pre> +<h2>Exceptions</h2> +<p>This rule ignores <code>@import</code> in <code>less</code> files.</p> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.json b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.json index 1f7d8bc..c7a9124 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.json +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.json @@ -1,5 +1,5 @@  { -  "title": "Useless imports should be removed", +  "title": "Duplicate imports should be removed",    "type": "CODE_SMELL",    "status": "ready",    "remediation": { diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4647.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4647.html index 10aa560..461b6cb 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4647.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4647.html @@ -1,16 +1,16 @@  <p>An invalid color definition will by default be interpreted as black, which is likely to have unintended impacts on the expected look and feel of  the website.</p> -<p>This rule raises an issue when a color definition <code>color</code>, <code>background-color</code> is not valid. The color definition is +<p>This rule raises an issue when a color definition (<code>color</code>, <code>background-color</code>) is not valid. The color definition is  considered valid when it is made of hexadecimal characters:</p>  <p>- longhand: 6 or 8 characters (when alpha is defined)</p>  <p>- shorthand variant: 3 or 4 characters (when alpha is defined)</p>  <h2>Noncompliant Code Example</h2>  <pre>  a { - color: #3c; // Noncompliant: shorthand should be made of 3 characters + color: #3c; /* Noncompliant; shorthand should be made of 3 characters */  }  div { -  background-color: #3cb371a; // Noncompliant: alpha should have 2 characters +  background-color: #3cb371a; /* Noncompliant; alpha should have 2 characters */  }  </pre>  <h2>Compliant Solution</h2> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4648.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4648.html index 02b3570..ccfd068 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4648.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4648.html @@ -4,7 +4,7 @@ it. This rule raises an issue when <code>font</code> or <code>font-family</code>  <h2>Noncompliant Code Example</h2>  <pre>  a { -  font-family: 'Georgia', Georgia, serif; +  font-family: 'Georgia', Georgia, serif; /* Noncompliant; 'Georgia' is duplicated */  }  </pre>  <h2>Compliant Solution</h2> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4649.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4649.html index 0816eb7..f1c1823 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4649.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4649.html @@ -6,7 +6,7 @@ a list of generic font matching these families: <code>Serif</code>, <code>Sans-s  <h2>Noncompliant Code Example</h2>  <pre>  a { -  font-family: Helvetica, Arial, Verdana, Tahoma; +  font-family: Helvetica, Arial, Verdana, Tahoma; /* Noncompliant; there is no generic font family in the list */  }  </pre>  <h2>Compliant Solution</h2> @@ -17,6 +17,6 @@ a {  </pre>  <h2>See</h2>  <ul> -  <li> https://www.w3.org/TR/CSS2/fonts.html#generic-font-families </li> +  <li> <a href="https://www.w3.org/TR/CSS2/fonts.html#generic-font-families">CSS Specification</a> - Generic font families </li>  </ul> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4650.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4650.html index adca17a..1eb4e9f 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4650.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4650.html @@ -6,7 +6,7 @@ whitespace or a newline.</p>  <pre>  #div1 {      position: absolute; -    width: calc(100%- 100px); // Noncompliant; no space after the % sign +    width: calc(100%- 100px); /* Noncompliant; no space after the % sign */  }  </pre>  <h2>Compliant Solution</h2> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4650.json b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4650.json index 5720374..483cc1c 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4650.json +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4650.json @@ -1,5 +1,5 @@  { -  "title": "\"calc\" members should be correctly spaced or indented", +  "title": "\"calc\" operands should be correctly spaced",    "type": "BUG",    "status": "ready",    "remediation": { diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4651.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4651.html index 20d64bb..68b9085 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4651.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4651.html @@ -25,6 +25,7 @@ the expected gradient in the latest browser versions that support CSS3.</p>  </pre>  <h2>See</h2>  <ul> -  <li> <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient#Syntax">MDN Specification</a> - linear gradient </li> +  <li> <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient">Mozilla Web Technology for Developers</a> - +  <code>linear-gradient</code> </li>  </ul> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4653.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4653.html index 283bf5d..1c6a554 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4653.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4653.html @@ -4,7 +4,7 @@ to be a typo and will be seen as a UI bug by the user.</p>  <h2>Noncompliant Code Example</h2>  <pre>  a { -  width: 10pixels; +  width: 10pixels; /* Noncompliant; "pixels" is not a valid unit */  }  </pre>  <h2>Compliant Solution</h2> @@ -15,6 +15,6 @@ a {  </pre>  <h2>See</h2>  <ul> -  <li> https://www.w3.org/TR/css3-values/#lengths </li> +  <li> <a href="https://www.w3.org/TR/css3-values/#lengths">CSS Specification</a> - Distance units </li>  </ul> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4654.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4654.html index 18f759a..caba977 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4654.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4654.html @@ -6,7 +6,7 @@ in the final rendering.</p>  <h2>Noncompliant Code Example</h2>  <pre>  a { -  colour: blue; // Noncompliant: colour is not part of the specifications +  colour: blue; /* Noncompliant; colour is not part of the specifications */  }  </pre>  <h2>Compliant Solution</h2> @@ -15,8 +15,4 @@ a {    color: blue;  }  </pre> -<h2>See</h2> -<ul> -  <li> https://github.com/known-css/known-css-properties#source </li> -</ul> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4655.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4655.html index e0653cf..975cdc6 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4655.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4655.html @@ -18,6 +18,7 @@ among all browsers.</p>  </pre>  <h2>See</h2>  <ul> -  <li> https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes#!important_in_a_keyframe </li> +  <li> <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes#!important_in_a_keyframe">Mozilla Web Technology for Developers</a> - +  <code>!important</code> in a keyframe </li>  </ul> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4657.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4657.html index ae083b9..4e9c92a 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4657.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4657.html @@ -4,18 +4,19 @@ useless. The code should be refactored to consider the longhand property or to r  <pre>  a {    padding-left: 10px; -  padding: 20px; // Noncompliant; padding is overriding padding-left making it useless +  padding: 20px; /* Noncompliant; padding is overriding padding-left making it useless */  }  </pre>  <h2>Compliant Solution</h2>  <pre>  a { -  padding: 10px; // Compliant; padding is defining a general behaviour and padding-left, just after, is precising the left case +  padding: 10px; /* Compliant; padding is defining a general behaviour and padding-left, just after, is precising the left case */    padding-left: 20px;  }  </pre>  <h2>See</h2>  <ul> -  <li> https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties </li> +  <li> <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties">Mozilla Web Technology for Developers</a> - shorthand +  properties </li>  </ul> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4659.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4659.html index 56ee433..9254024 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4659.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4659.html @@ -2,7 +2,7 @@  the expected impact in the final rendering.</p>  <h2>Noncompliant Code Example</h2>  <pre> -a:hoverr { +a:hoverr { /* Noncompliant; there is a typo on the word "hover" */  ...  }  </pre> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4660.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4660.html index 8c03492..4449f16 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4660.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4660.html @@ -2,7 +2,7 @@  get the expected impact in the final rendering.</p>  <h2>Noncompliant Code Example</h2>  <pre> -a::beforre { +a::beforre { /* Noncompliant; there is a typo on the word "before" */  ...  }  </pre> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4661.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4661.html index 1c94ee3..72668cb 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4661.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4661.html @@ -10,6 +10,6 @@ impact in the final rendering.</p>  </pre>  <h2>See</h2>  <ul> -  <li> https://www.w3schools.com/cssref/css3_pr_mediaquery.asp </li> +  <li> <a href="https://www.w3schools.com/cssref/css3_pr_mediaquery.asp">CSS Specification</a> - <code>@media</code> rule </li>  </ul> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4662.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4662.html index 96e4255..9365a75 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4662.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4662.html @@ -2,10 +2,10 @@  the expected impact in the final rendering.</p>  <h2>Noncompliant Code Example</h2>  <pre> -@unknown {} +@encoding "utf-8";  </pre>  <h2>Compliant Solution</h2>  <pre> -@media (max-width: 960px) {} +@charset "utf-8";  </pre> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4663.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4663.html index 2b11dea..3db3a1c 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4663.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4663.html @@ -1,4 +1,5 @@ -<p>An empty comment is likely to be a mistake and doesn't help to improve the readability of the code. For these reasons, it should be removed.</p> +<p>An empty multi-line comment is likely to be a mistake and doesn't help to improve the readability of the code. For these reasons, it should be +removed.</p>  <h2>Noncompliant Code Example</h2>  <pre>  /* */ diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4663.json b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4663.json index 70b312a..e3b690e 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4663.json +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4663.json @@ -1,5 +1,5 @@  { -  "title": "Comments should not be empty", +  "title": "Multi-line comments should not be empty",    "type": "CODE_SMELL",    "status": "ready",    "remediation": { diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4666.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4666.html index 9521f64..7899f98 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4666.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4666.html @@ -1,14 +1,20 @@ -<p>When a selector appears more than once in a statement, this is not a bug but probably a mistake that reduces the readability of the source code. -Therefore, selectors should not be duplicated.</p> +<p>Duplication of selectors might indicate a copy-paste mistake. The rule detects the following kinds of duplications:</p> +<ul> +  <li> within a list of selectors in a single rule set </li> +  <li> for duplicated selectors in different rule sets within a single stylesheet. </li> +</ul>  <h2>Noncompliant Code Example</h2>  <pre> -.foo, -.bar, -.foo {} +.foo, .bar, .foo { ... }  /* Noncompliant */ + +.class1 { ... } +.class1 { ... }  /* Noncompliant */  </pre>  <h2>Compliant Solution</h2>  <pre> -.bar, -.foo {} +.foo, .bar { ... } + +.class1 { ... } +.class2 { ... }  </pre> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4666.json b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4666.json index f8be3d1..3f9d45e 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4666.json +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4666.json @@ -9,7 +9,7 @@    "tags": [    ], -  "defaultSeverity": "Minor", +  "defaultSeverity": "Major",    "ruleSpecification": "RSPEC-4666",    "sqKey": "S4666",    "scope": "Main" diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4668.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4668.html index 5c20c9d..9bb6b27 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4668.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4668.html @@ -2,10 +2,14 @@  can lead to unexpected results.</p>  <h2>Noncompliant Code Example</h2>  <pre> -a { // color: pink; } +// some comment +a { color: pink; }  </pre>  <h2>Compliant Solution</h2>  <pre> -a { /* color: pink; */ } +/* some comment */ +a { color: pink; }  </pre> +<h2>Exceptions</h2> +<p>This rule ignores single line comments in <code>less</code> and <code>scss</code> files.</p> diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4668.json b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4668.json index 981082e..1f0e0a1 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4668.json +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4668.json @@ -1,5 +1,5 @@  { -  "title": "Comment formatting should be valid", +  "title": "Single line comment syntax should not be used",    "type": "BUG",    "status": "ready",    "remediation": { diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/Sonar_way_profile.json b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/Sonar_way_profile.json index ce1c647..23df97d 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/Sonar_way_profile.json +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/Sonar_way_profile.json @@ -26,4 +26,4 @@      "S4668",      "S4670"    ] -}
 +} diff --git a/sonarpedia.json b/sonarpedia.json index 26f40e5..d7ce5e6 100644 --- a/sonarpedia.json +++ b/sonarpedia.json @@ -3,8 +3,8 @@    "languages": [      "CSS"    ], -  "latest-update": "2018-06-22T12:40:51.596Z", +  "latest-update": "2018-06-26T15:59:44.207Z",    "options": {      "no-language-in-filenames": true    } -}
\ No newline at end of file +} | 
