From b401bc78e686ba19219b3192280de2feee5b3845 Mon Sep 17 00:00:00 2001 From: Amaury Levé Date: Mon, 25 Jun 2018 11:05:10 +0200 Subject: Rule S1128: Useless imports should be removed (#64) --- .../resources/org/sonar/l10n/css/rules/css/S1128.html | 12 ++++++++++++ .../resources/org/sonar/l10n/css/rules/css/S1128.json | 16 ++++++++++++++++ .../org/sonar/l10n/css/rules/css/Sonar_way_profile.json | 1 + 3 files changed, 29 insertions(+) create mode 100644 sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.html create mode 100644 sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.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/S1128.html b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.html new file mode 100644 index 0000000..8dde5aa --- /dev/null +++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.html @@ -0,0 +1,12 @@ +
The imports part of a file should be handled by the Integrated Development Environment (IDE), not manually by the developer.
+Unused and useless imports should not occur if that is the case.
+Leaving them in reduces the code's readability, since their presence can be confusing.
+
+@import 'a.css';
+@import 'a.css'; // Noncompliant
+
+@import url("a.css");
+@import url("a.css"); // Noncompliant
+
+
diff --git a/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.json b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.json
new file mode 100644
index 0000000..1f7d8bc
--- /dev/null
+++ b/sonar-css-plugin/src/main/resources/org/sonar/l10n/css/rules/css/S1128.json
@@ -0,0 +1,16 @@
+{
+ "title": "Useless imports should be removed",
+ "type": "CODE_SMELL",
+ "status": "ready",
+ "remediation": {
+ "func": "Constant\/Issue",
+ "constantCost": "2min"
+ },
+ "tags": [
+ "unused"
+ ],
+ "defaultSeverity": "Minor",
+ "ruleSpecification": "RSPEC-1128",
+ "sqKey": "S1128",
+ "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
index 14b9668..4455af6 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
@@ -1,6 +1,7 @@
{
"name": "Sonar way",
"ruleKeys": [
+ "S1128",
"S4647",
"S4652",
"S4653",
--
cgit v1.2.3