From a54f0e2f4c99a8cc49676945486298400dcbdd40 Mon Sep 17 00:00:00 2001 From: Amaury Levé Date: Tue, 26 Jun 2018 18:22:35 +0200 Subject: Update RSPEC metadata for implemented rules (#79) --- .../org/sonar/l10n/css/rules/css/S1116.html | 4 ++-- .../org/sonar/l10n/css/rules/css/S1116.json | 2 +- .../org/sonar/l10n/css/rules/css/S1128.html | 7 ++++--- .../org/sonar/l10n/css/rules/css/S1128.json | 2 +- .../org/sonar/l10n/css/rules/css/S4647.html | 6 +++--- .../org/sonar/l10n/css/rules/css/S4648.html | 2 +- .../org/sonar/l10n/css/rules/css/S4649.html | 4 ++-- .../org/sonar/l10n/css/rules/css/S4650.html | 2 +- .../org/sonar/l10n/css/rules/css/S4650.json | 2 +- .../org/sonar/l10n/css/rules/css/S4651.html | 3 ++- .../org/sonar/l10n/css/rules/css/S4653.html | 4 ++-- .../org/sonar/l10n/css/rules/css/S4654.html | 6 +----- .../org/sonar/l10n/css/rules/css/S4655.html | 3 ++- .../org/sonar/l10n/css/rules/css/S4657.html | 7 ++++--- .../org/sonar/l10n/css/rules/css/S4659.html | 2 +- .../org/sonar/l10n/css/rules/css/S4660.html | 2 +- .../org/sonar/l10n/css/rules/css/S4661.html | 2 +- .../org/sonar/l10n/css/rules/css/S4662.html | 4 ++-- .../org/sonar/l10n/css/rules/css/S4663.html | 3 ++- .../org/sonar/l10n/css/rules/css/S4663.json | 2 +- .../org/sonar/l10n/css/rules/css/S4666.html | 20 +++++++++++++------- .../org/sonar/l10n/css/rules/css/S4666.json | 2 +- .../org/sonar/l10n/css/rules/css/S4668.html | 8 ++++++-- .../org/sonar/l10n/css/rules/css/S4668.json | 2 +- .../sonar/l10n/css/rules/css/Sonar_way_profile.json | 2 +- 25 files changed, 57 insertions(+), 46 deletions(-) (limited to 'sonar-css-plugin/src') 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 @@ -
Empty statements, i.e. ;, are usually introduced by mistake, for example because:
Extra semicolons are usually introduced by mistake, for example because:
;;. The imports part of a file should be handled by the Integrated Development Environment (IDE), not manually by the developer.
-Unused and useless imports should not occur if that is the case.
-Leaving them in reduces the code's readability, since their presence can be confusing.
+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.
 @import 'a.css';
@@ -9,4 +8,6 @@
 @import url("a.css");
 @import url("a.css"); // Noncompliant
 
+This rule ignores @import in less files.
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.
-This rule raises an issue when a color definition color, background-color is not valid. The color definition is
+
This rule raises an issue when a color definition (color, background-color) is not valid. The color definition is
 considered valid when it is made of hexadecimal characters:
- longhand: 6 or 8 characters (when alpha is defined)
- shorthand variant: 3 or 4 characters (when alpha is defined)
 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 */
 }
 
 font or font-family
 
 a {
-  font-family: 'Georgia', Georgia, serif;
+  font-family: 'Georgia', Georgia, serif; /* Noncompliant; 'Georgia' is duplicated */
 }
 
 Serif, Sans-s
 Noncompliant Code Example
 
 a {
-  font-family: Helvetica, Arial, Verdana, Tahoma;
+  font-family: Helvetica, Arial, Verdana, Tahoma; /* Noncompliant; there is no generic font family in the list */
 }
 
 Compliant Solution
@@ -17,6 +17,6 @@ a {
 
 See
 
-  -  https://www.w3.org/TR/CSS2/fonts.html#generic-font-families +
-  CSS Specification - Generic font families 
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.
 #div1 {
     position: absolute;
-    width: calc(100%- 100px); // Noncompliant; no space after the % sign
+    width: calc(100%- 100px); /* Noncompliant; no space after the % sign */
 }
 
 Compliant Solution
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.
 
 See
 
-  -  MDN Specification - linear gradient +
-  Mozilla Web Technology for Developers -
+  linear-gradient
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.Noncompliant Code Example
 
 a {
-  width: 10pixels;
+  width: 10pixels; /* Noncompliant; "pixels" is not a valid unit */
 }
 
 Compliant Solution
@@ -15,6 +15,6 @@ a {
 
 See
 
-  -  https://www.w3.org/TR/css3-values/#lengths +
-  CSS Specification - Distance units 
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.Noncompliant Code Example
 
 a {
-  colour: blue; // Noncompliant: colour is not part of the specifications
+  colour: blue; /* Noncompliant; colour is not part of the specifications */
 }
 
 Compliant Solution
@@ -15,8 +15,4 @@ a {
   color: blue;
 }
 
-See
-
-  -  https://github.com/known-css/known-css-properties#source -
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.See
 
-  -  https://developer.mozilla.org/en-US/docs/Web/CSS/@keyframes#!important_in_a_keyframe +
-  Mozilla Web Technology for Developers -
+  !importantin a keyframe
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
 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 */
 }
 
 Compliant Solution
 
 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;
 }
 
 See
 
-  -  https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties +
-  Mozilla Web Technology for Developers - shorthand
+  properties 
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.Noncompliant Code Example
 
-a:hoverr {
+a:hoverr { /* Noncompliant; there is a typo on the word "hover" */
 ...
 }
 
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.
 Noncompliant Code Example
 
-a::beforre {
+a::beforre { /* Noncompliant; there is a typo on the word "before" */
 ...
 }
 
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.
 
 See
 
-  -  https://www.w3schools.com/cssref/css3_pr_mediaquery.asp +
-  CSS Specification - @mediarule
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.Noncompliant Code Example
 
-@unknown {}
+@encoding "utf-8";
 
 Compliant Solution
 
-@media (max-width: 960px) {}
+@charset "utf-8";
 
 
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 @@
-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.
+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.
 Noncompliant Code Example
 
 /* */
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 @@
-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.
+Duplication of selectors might indicate a copy-paste mistake. The rule detects the following kinds of duplications:
+
+  -  within a list of selectors in a single rule set +
-  for duplicated selectors in different rule sets within a single stylesheet. +
Noncompliant Code Example
 
-.foo,
-.bar,
-.foo {}
+.foo, .bar, .foo { ... }  /* Noncompliant */
+
+.class1 { ... }
+.class1 { ... }  /* Noncompliant */
 
 Compliant Solution
 
-.bar,
-.foo {}
+.foo, .bar { ... }
+
+.class1 { ... }
+.class2 { ... }
 
 
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.
 Noncompliant Code Example
 
-a { // color: pink; }
+// some comment
+a { color: pink; }
 
 Compliant Solution
 
-a { /* color: pink; */ }
+/* some comment */
+a { color: pink; }
 
+Exceptions
+This rule ignores single line comments in less and scss files.
 
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"
   ]
-}
+}
-- 
cgit v1.2.3