aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-css-plugin/src/main/resources
diff options
context:
space:
mode:
authorAmaury Levé2018-06-25 13:44:45 +0200
committerElena Vilchik2018-06-26 11:16:30 +0200
commite78f845d7f25952cd5703296455e4e4825d9ec8e (patch)
tree967d611823663b62f0feb814ca167de482961014 /sonar-css-plugin/src/main/resources
parent12d9eddb516233de212434b329a35e114c387c5c (diff)
downloadsonar-css-e78f845d7f25952cd5703296455e4e4825d9ec8e.tar.bz2
Rule S4657: Shorthand properties that override related longhand properties should be avoided
Diffstat (limited to 'sonar-css-plugin/src/main/resources')
-rw-r--r--sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4657.html21
-rw-r--r--sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4657.json16
-rw-r--r--sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/Sonar_way_profile.json1
3 files changed, 38 insertions, 0 deletions
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
new file mode 100644
index 0000000..ae083b9
--- /dev/null
+++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4657.html
@@ -0,0 +1,21 @@
+<p>A shorthand property defined after a longhand property will completely override the value defined in the longhand property making the longhand one
+useless. The code should be refactored to consider the longhand property or to remove it completely.</p>
+<h2>Noncompliant Code Example</h2>
+<pre>
+a {
+ padding-left: 10px;
+ 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-left: 20px;
+}
+</pre>
+<h2>See</h2>
+<ul>
+ <li> https://developer.mozilla.org/en-US/docs/Web/CSS/Shorthand_properties </li>
+</ul>
+
diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4657.json b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4657.json
new file mode 100644
index 0000000..6ac7d97
--- /dev/null
+++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4657.json
@@ -0,0 +1,16 @@
+{
+ "title": "Shorthand properties that override related longhand properties should be avoided",
+ "type": "BUG",
+ "status": "ready",
+ "remediation": {
+ "func": "Constant\/Issue",
+ "constantCost": "5min"
+ },
+ "tags": [
+
+ ],
+ "defaultSeverity": "Critical",
+ "ruleSpecification": "RSPEC-4657",
+ "sqKey": "S4657",
+ "scope": "Main"
+}
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 5c03bb6..aa28914 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
@@ -11,6 +11,7 @@
"S4654",
"S4655",
"S4656",
+ "S4657",
"S4658",
"S4663",
"S4667"