From e78f845d7f25952cd5703296455e4e4825d9ec8e Mon Sep 17 00:00:00 2001 From: Amaury Levé Date: Mon, 25 Jun 2018 13:44:45 +0200 Subject: Rule S4657: Shorthand properties that override related longhand properties should be avoided --- .../org/sonar/l10n/css/rules/css/S4657.html | 21 +++++++++++++++++++++ .../org/sonar/l10n/css/rules/css/S4657.json | 16 ++++++++++++++++ .../sonar/l10n/css/rules/css/Sonar_way_profile.json | 1 + 3 files changed, 38 insertions(+) create mode 100644 sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4657.html create mode 100644 sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4657.json (limited to 'sonar-css-plugin/src/main/resources') 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 @@ +
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.
+
+a {
+ padding-left: 10px;
+ padding: 20px; // Noncompliant; padding is overriding padding-left making it useless
+}
+
+
+a {
+ padding: 10px; // Compliant; padding is defining a general behaviour and padding-left, just after, is precising the left case
+ padding-left: 20px;
+}
+
+