From 3dfb3ea3d27ef143f992dc90faf6054d55953958 Mon Sep 17 00:00:00 2001 From: Amaury Levé Date: Thu, 28 Jun 2018 10:25:22 +0200 Subject: Update RSPEC metadata (#97) --- .../org/sonar/l10n/css/rules/css/S4652.html | 2 +- .../org/sonar/l10n/css/rules/css/S4657.html | 2 +- .../org/sonar/l10n/css/rules/css/S4664.html | 31 ++++++++++------------ .../org/sonar/l10n/css/rules/css/S4664.json | 2 +- 4 files changed, 17 insertions(+), 20 deletions(-) (limited to 'sonar-css-plugin') diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4652.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4652.html index ae6f801..6864535 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4652.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4652.html @@ -21,6 +21,6 @@ a {

See

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 4e9c92a..1b57deb 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 @@ -16,7 +16,7 @@ a {

See

diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4664.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4664.html index 6f501e2..5064402 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4664.html +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4664.html @@ -1,28 +1,25 @@ -

Order of instructions in CSS is important: instructions that occur last in the file take the priority. When a selector with high specificity (eg -#container a top: 10px; ) comes before the selector it overrides (eg: a top: 0; ), the priority is given to the high -specificity definition which violates the principle of the last instruction takes the priority.

-

CSS are most legible when overriding selectors always come after the selectors they override. That way both mechanisms, source order and -specificity, work together nicely.

+

Order of instructions in CSS is important: instructions with equal specificity that occur later in the file take the priority. But when a selector +with a higher specificity (e.g. p a { color: green;}) comes before the selector it overrides (e.g.: a { color: green;}), the +priority is given to the first one. Even if it works properly, this is harder to anticipate the behaviour of the stylesheet while reading as it goes +against the principle that the last instruction takes the priority.

Noncompliant Code Example

-b a {}
-a {}
-
+p a {
+  color: green;
+}
 
-@media print {
-  #c a {}
-  a {}
+a {
+  color: blue;
 }
 

Compliant Solution

-a {}
-b a {}
-
+a {
+  color: blue;
+}
 
-@media print {
-  a {}
-  #c a {}
+p a {
+  color: green;
 }
 
diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4664.json b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4664.json index ebcea71..9e12c25 100644 --- a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4664.json +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4664.json @@ -1,6 +1,6 @@ { "title": "Selectors of lower specificity should come before overriding selectors of higher specificity", - "type": "BUG", + "type": "CODE_SMELL", "status": "ready", "remediation": { "func": "Constant\/Issue", -- cgit v1.2.3