24
24
import java .util .ArrayList ;
25
25
import java .util .Collection ;
26
26
import java .util .List ;
27
+ import java .util .Map ;
27
28
29
+ import org .sonar .api .internal .apachecommons .lang .StringUtils ;
30
+ import org .sonar .api .internal .google .common .base .Objects ;
31
+ import org .sonar .api .internal .google .common .collect .Maps ;
28
32
import org .sonar .api .server .rule .RulesDefinition ;
29
33
import org .sonar .api .server .rule .RulesDefinitionXmlLoader ;
34
+ import org .sonar .api .server .rule .RulesDefinition .NewRepository ;
35
+ import org .sonar .api .server .rule .RulesDefinition .NewRepositoryImpl ;
30
36
import org .sonar .api .server .rule .RulesDefinition .NewRule ;
31
37
32
38
import fr .cnes .sonarqube .plugins .icode .languages .ICodeLanguage ;
@@ -47,7 +53,6 @@ public final class ICodeRulesDefinition implements RulesDefinition {
47
53
protected static final String REPO_NAME = ICodeLanguage .NAME ;
48
54
49
55
private static NewRepository repository ;
50
- private static List <String > allRuleIds = new ArrayList <String >();
51
56
52
57
protected String rulesDefinitionFilePath () {
53
58
return PATH_TO_RULES_XML ;
@@ -63,11 +68,6 @@ private void defineRulesForLanguage(Context context, String repositoryKey, Strin
63
68
rulesLoader .load (repository , rulesXml , StandardCharsets .UTF_8 .name ());
64
69
}
65
70
repository .done ();
66
- Collection <NewRule > col = repository .rules ();
67
- allRuleIds = new ArrayList <String >();
68
- for (NewRule newRule : col ) {
69
- allRuleIds .add (newRule .key ());
70
- }
71
71
}
72
72
73
73
@ Override
@@ -79,7 +79,13 @@ public static String getRepositoryKeyForLanguage() {
79
79
return ICodeLanguage .KEY + "-" + KEY ;
80
80
}
81
81
82
+ /** Check if the ruleKey exist.
83
+ *
84
+ * @param analysisRuleId
85
+ * @return Always true with ICode
86
+ */
82
87
public static boolean existRule (String analysisRuleId ){
83
- return allRuleIds . contains ( analysisRuleId ) ;
88
+ return true ;
84
89
}
85
90
}
91
+
0 commit comments