From ee58ae41cf30e31f58555e2d736ade59559e7987 Mon Sep 17 00:00:00 2001 From: Amaury Levé Date: Tue, 26 Jun 2018 15:18:09 +0200 Subject: Rule S4651: 'linear-gradient' directions should be valid --- .../org/sonar/l10n/css/rules/css/S4651.html | 30 ++++++++++++++++++++++ .../org/sonar/l10n/css/rules/css/S4651.json | 16 ++++++++++++ .../l10n/css/rules/css/Sonar_way_profile.json | 1 + 3 files changed, 47 insertions(+) create mode 100644 sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4651.html create mode 100644 sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4651.json (limited to 'sonar-css-plugin/src/main/resources') 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 new file mode 100644 index 0000000..20d64bb --- /dev/null +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4651.html @@ -0,0 +1,30 @@ +

linear-gradient was standardized with CSS3. Before that, it was possible to use different non-standard values to define the gradient's +direction. Because these values are not standard, they are not supported in all browsers and therefore they should no longer be used in order to get +the expected gradient in the latest browser versions that support CSS3.

+

This rule raises an issue when the first parameter of a linear-gradient is not a valid <side-or-corner> or +angle.

+

Noncompliant Code Example

+
+.foo {
+  background: linear-gradient(top, #fff, #000);
+}
+
+.bar {
+  background: linear-gradient(45, #fff, #000);
+}
+
+

Compliant Solution

+
+.foo {
+  background: linear-gradient(to top, #fff, #000);
+}
+
+.bar {
+  background: linear-gradient(45deg, #fff, #000);
+}
+
+

See

+ + diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4651.json b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4651.json new file mode 100644 index 0000000..a383afd --- /dev/null +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4651.json @@ -0,0 +1,16 @@ +{ + "title": "\"linear-gradient\" directions should be valid", + "type": "BUG", + "status": "ready", + "remediation": { + "func": "Constant\/Issue", + "constantCost": "1min" + }, + "tags": [ + + ], + "defaultSeverity": "Critical", + "ruleSpecification": "RSPEC-4651", + "sqKey": "S4651", + "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 823c793..4fe2a7a 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", + "S4651", "S4652", "S4653", "S4654", -- cgit v1.2.3