aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-css-plugin/src/main/resources
diff options
context:
space:
mode:
authorElena Vilchik2018-06-14 17:40:32 +0200
committerGitHub2018-06-14 17:40:32 +0200
commit6383829aa3b6b25975da1fe7c618e3f611d8c6e1 (patch)
tree25752e58f8ef71a3a3db849a987dc24a1f54e0f1 /sonar-css-plugin/src/main/resources
parentb3887099d35a9d8909c00f43ca194cc02ba0b16a (diff)
downloadsonar-css-6383829aa3b6b25975da1fe7c618e3f611d8c6e1.tar.bz2
Integrate stylelint inside plugin (#42)
Diffstat (limited to 'sonar-css-plugin/src/main/resources')
-rw-r--r--sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4647.html29
-rw-r--r--sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4647.json16
-rw-r--r--sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/Sonar_way_profile.json6
3 files changed, 51 insertions, 0 deletions
diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4647.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4647.html
new file mode 100644
index 0000000..10aa560
--- /dev/null
+++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4647.html
@@ -0,0 +1,29 @@
+<p>An invalid color definition will by default be interpreted as black, which is likely to have unintended impacts on the expected look and feel of
+the website.</p>
+<p>This rule raises an issue when a color definition <code>color</code>, <code>background-color</code> is not valid. The color definition is
+considered valid when it is made of hexadecimal characters:</p>
+<p>- longhand: 6 or 8 characters (when alpha is defined)</p>
+<p>- shorthand variant: 3 or 4 characters (when alpha is defined)</p>
+<h2>Noncompliant Code Example</h2>
+<pre>
+a {
+ color: #3c; // Noncompliant: shorthand should be made of 3 characters
+}
+div {
+ background-color: #3cb371a; // Noncompliant: alpha should have 2 characters
+}
+</pre>
+<h2>Compliant Solution</h2>
+<pre>
+a {
+ color: #3cc;
+}
+div {
+ background-color: #3cb371ac;
+}
+</pre>
+<h2>See</h2>
+<ul>
+ <li> <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/color_value">Mozilla Web Technology for Developers</a> - CSS Color </li>
+</ul>
+
diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4647.json b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4647.json
new file mode 100644
index 0000000..afb0676
--- /dev/null
+++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S4647.json
@@ -0,0 +1,16 @@
+{
+ "title": "Color definitions should be valid",
+ "type": "BUG",
+ "status": "ready",
+ "remediation": {
+ "func": "Constant\/Issue",
+ "constantCost": "1min"
+ },
+ "tags": [
+
+ ],
+ "defaultSeverity": "Blocker",
+ "ruleSpecification": "RSPEC-4647",
+ "sqKey": "S4647",
+ "scope": "All"
+}
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
new file mode 100644
index 0000000..ba5ce46
--- /dev/null
+++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/Sonar_way_profile.json
@@ -0,0 +1,6 @@
+{
+ "name": "Sonar way",
+ "ruleKeys": [
+ "S4647"
+ ]
+}