From 5aaa1f182736f84f1613aa60f3f7da37103167c2 Mon Sep 17 00:00:00 2001 From: Amaury Levé Date: Tue, 26 Jun 2018 15:22:10 +0200 Subject: Rule S4650: 'calc' members should be correctly spaced or indented --- .../resources/org/sonar/l10n/css/rules/css/S4650.html | 19 +++++++++++++++++++ .../resources/org/sonar/l10n/css/rules/css/S4650.json | 16 ++++++++++++++++ .../sonar/l10n/css/rules/css/Sonar_way_profile.json | 1 + 3 files changed, 36 insertions(+) create mode 100644 sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4650.html create mode 100644 sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4650.json (limited to 'sonar-css-plugin/src/main/resources/org') 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 new file mode 100644 index 0000000..adca17a --- /dev/null +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4650.html @@ -0,0 +1,19 @@ +

calc is a CSS3 function that provides the possibility to do simple math in CSS (add, subtract, divide, multiply). Without spaces +around operators, calc will have no effect.

+

More precisely, before an operator, there must be a single whitespace or a newline plus indentation. After an operator, there must be a single +whitespace or a newline.

+

Noncompliant Code Example

+
+#div1 {
+    position: absolute;
+    width: calc(100%- 100px); // Noncompliant; no space after the % sign
+}
+
+

Compliant Solution

+
+#div1 {
+    position: absolute;
+    width: calc(100% - 100px);
+}
+
+ 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 new file mode 100644 index 0000000..5720374 --- /dev/null +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4650.json @@ -0,0 +1,16 @@ +{ + "title": "\"calc\" members should be correctly spaced or indented", + "type": "BUG", + "status": "ready", + "remediation": { + "func": "Constant\/Issue", + "constantCost": "1min" + }, + "tags": [ + + ], + "defaultSeverity": "Blocker", + "ruleSpecification": "RSPEC-4650", + "sqKey": "S4650", + "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 4fe2a7a..adbe829 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 @@ -6,6 +6,7 @@ "S4647", "S4648", "S4649", + "S4650", "S4651", "S4652", "S4653", -- cgit v1.2.3