diff options
| author | Amaury Levé | 2018-06-26 15:18:09 +0200 |
|---|---|---|
| committer | Amaury Levé | 2018-06-26 16:23:02 +0200 |
| commit | ee58ae41cf30e31f58555e2d736ade59559e7987 (patch) | |
| tree | a10a93588e18390ba458dcf90bcbcab5ba3762f3 /sonar-css-plugin/src/main/resources | |
| parent | 50e0ec766fe0aacb16f651571629b67910cabd95 (diff) | |
| download | sonar-css-ee58ae41cf30e31f58555e2d736ade59559e7987.tar.bz2 | |
Rule S4651: 'linear-gradient' directions should be valid
Diffstat (limited to 'sonar-css-plugin/src/main/resources')
3 files changed, 47 insertions, 0 deletions
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 @@ +<p><code>linear-gradient</code> 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.</p> +<p>This rule raises an issue when the first parameter of a <code>linear-gradient</code> is not a valid <code><side-or-corner></code> or +<code>angle</code>.</p> +<h2>Noncompliant Code Example</h2> +<pre> +.foo { + background: linear-gradient(top, #fff, #000); +} + +.bar { + background: linear-gradient(45, #fff, #000); +} +</pre> +<h2>Compliant Solution</h2> +<pre> +.foo { + background: linear-gradient(to top, #fff, #000); +} + +.bar { + background: linear-gradient(45deg, #fff, #000); +} +</pre> +<h2>See</h2> +<ul> + <li> <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/linear-gradient#Syntax">MDN Specification</a> - linear gradient </li> +</ul> + 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", |
