@@ -62,6 +62,11 @@ public class ICodeSensor implements Sensor {
62
62
*/
63
63
private static final Logger LOGGER = Loggers .get (ICodeSensor .class );
64
64
65
+ /**
66
+ * Languages used by I-Code
67
+ */
68
+ private final String [] LANGUAGES = {Fortran77Language .KEY , Fortran90Language .KEY };
69
+
65
70
/**
66
71
* Give information about this sensor.
67
72
*
@@ -70,7 +75,7 @@ public class ICodeSensor implements Sensor {
70
75
@ Override
71
76
public void describe (final SensorDescriptor sensorDescriptor ) {
72
77
// Prevents sensor to be run during all analysis.
73
- sensorDescriptor .onlyOnLanguages (Fortran77Language . KEY , Fortran90Language . KEY );
78
+ sensorDescriptor .onlyOnLanguages (LANGUAGES );
74
79
75
80
// Defines sensor name
76
81
sensorDescriptor .name ("Sonar i-Code" );
@@ -79,9 +84,11 @@ public void describe(final SensorDescriptor sensorDescriptor) {
79
84
sensorDescriptor .onlyOnFileType (InputFile .Type .MAIN );
80
85
81
86
// This sensor is activated only if a rule from the following repo is activated.
82
- sensorDescriptor .createIssuesForRuleRepositories (
83
- ICodeRulesDefinition .getRepositoryKeyForLanguage (Fortran77Language .KEY ),
84
- ICodeRulesDefinition .getRepositoryKeyForLanguage (Fortran90Language .KEY ));
87
+ for (String Lang : LANGUAGES ) {
88
+ sensorDescriptor .createIssuesForRuleRepositories (
89
+ ICodeRulesDefinition .getRepositoryKeyForLanguage (Lang ));
90
+ }
91
+
85
92
}
86
93
87
94
/**
@@ -380,9 +387,12 @@ protected List<File> getReportFiles(final Configuration config, final FileSystem
380
387
* @return True if the rule is active and false if not or not exists.
381
388
*/
382
389
protected boolean isRuleActive (final ActiveRules activeRules , final String rule ) {
383
- final RuleKey ruleKeyF77 = RuleKey .of (ICodeRulesDefinition .getRepositoryKeyForLanguage (Fortran77Language .KEY ), rule );
384
- final RuleKey ruleKeyF90 = RuleKey .of (ICodeRulesDefinition .getRepositoryKeyForLanguage (Fortran90Language .KEY ), rule );
385
- return activeRules .find (ruleKeyF77 )!=null || activeRules .find (ruleKeyF90 )!=null ;
390
+ boolean isActive = false ;
391
+ for (String Lang : LANGUAGES ) {
392
+ RuleKey ruleKey = RuleKey .of (ICodeRulesDefinition .getRepositoryKeyForLanguage (Lang ), rule );
393
+ isActive = activeRules .find (ruleKey )!=null || isActive ;
394
+ }
395
+ return isActive ;
386
396
}
387
397
388
398
}
0 commit comments