diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
index 7d537b1..7e77a3a 100644
--- a/CODE_OF_CONDUCT.md
+++ b/CODE_OF_CONDUCT.md
@@ -34,7 +34,7 @@ This Code of Conduct applies both within project spaces and in public spaces whe
## Enforcement
-Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at L-lequal@cnes.fr. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
+Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 643c5ae..33ec036 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -11,7 +11,7 @@ The following is a set of guidelines for contributing to i-Code CNES plugin for
* [Git Commit Messages](#git-commit-messages)
## Code of Conduct
-This project and everyone participating in it is governed by the [Lequal Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to [L-lequal@cnes.fr](mailto:L-lequal@cnes.fr).
+This project and everyone participating in it is governed by the [Lequal Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code.
## How Can I Contribute?
diff --git a/README.md b/README.md
index 43438d2..f0c4ddc 100644
--- a/README.md
+++ b/README.md
@@ -34,6 +34,7 @@ Here is the compatibility matrix of the plugin:
| 2.0.3 | 4.1.2 | 7.9 -> 8.2 | Fortran / Shell |
| 3.0.0 | 4.1.0 | 7.9 -> 8.2 | Fortran |
| 3.0.1 | 4.1.2 | 7.9 -> 8.2 | Fortran |
+| 3.1.0 | 4.1.2 | 7.9 -> 9.9 | Fortran |
#### Run i-Code manually
If you need help to run i-Code please refer to the [official user manual](https://github.com/cnescatlab/i-CodeCNES/wiki/User-Manual) or [i-Code issue tracker](https://github.com/cnescatlab/i-CodeCNES/issues).
@@ -82,8 +83,6 @@ If you want to do a PR, please put inside of it the reason of this pull request.
All details are available in [CONTRIBUTING](https://github.com/cnescatlab/sonar-icode-cnes-plugin/blob/master/CONTRIBUTING.md).
### Feedback and Support
-Contact : L-lequal@cnes.fr
-
Bugs and Feature requests: https://github.com/cnescatlab/sonar-icode-cnes-plugin/issues
### License
diff --git a/pom.xml b/pom.xml
index 0c86a25..c885d2e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
fr.cnes.sonar.plugins
sonar-icode-cnes-plugin
sonar-plugin
- 3.0.1
+ 3.1.0
Sonar i-Code CNES plugin
@@ -46,6 +46,12 @@
https://github.com/WaldoFR
WaldoFR
+
+ Diego Rodriguez
+ CNES
+ https://github.com/diegorodriguez31
+ diegorodriguez31
+
@@ -55,14 +61,16 @@
11
1.8
1.8
- 6.7.7
+ 9.8.0.203
+ 9.5.0.56709
+ 9.9.1.69595
2.6.1
- 1.17
+ 1.21.0.505
3.7
2.8.2
1.7.25
4.13.2
- 0.8.4
+ 0.8.10
icode
fr.cnes.sonar.plugins.icode.ICodePlugin
https://github.com/cnescatlab/sonar-icode-cnes-plugin
@@ -81,7 +89,7 @@
- org.sonarsource.sonarqube
+ org.sonarsource.api.plugin
sonar-plugin-api
${sonar.apiVersion}
provided
@@ -100,12 +108,18 @@
org.sonarsource.sonarqube
sonar-testing-harness
- ${sonar.apiVersion}
+ ${sonar.testingHarnessVersion}
test
+
+ org.sonarsource.sonarqube
+ sonar-plugin-api-impl
+ ${sonar.apiImplVersion}
+
junit
junit
+ 4.11
test
@@ -134,7 +148,7 @@
org.apache.maven.plugins
maven-compiler-plugin
- 3.5.1
+ 3.10.1
${jdk.min.version}
@@ -145,13 +159,13 @@
org.codehaus.mojo
native2ascii-maven-plugin
- 1.0-beta-1
+ 2.0.1
-
-
- native2ascii
-
-
+
+
+ resources
+
+
diff --git a/src/main/java/fr/cnes/sonar/plugins/icode/check/ICodeSensor.java b/src/main/java/fr/cnes/sonar/plugins/icode/check/ICodeSensor.java
index d414e04..42fb7a1 100644
--- a/src/main/java/fr/cnes/sonar/plugins/icode/check/ICodeSensor.java
+++ b/src/main/java/fr/cnes/sonar/plugins/icode/check/ICodeSensor.java
@@ -338,7 +338,7 @@ protected Map getScannedFiles(final FileSystem fileSystem, fi
for(final AnalysisFile file : files) {
// Checks if the file system contains a file with corresponding path (relative or absolute).
final String fileToFind = new File(fileSystem.baseDir(), file.getFileName()).getPath();
- final FilePredicate predicate = fileSystem.predicates().hasRelativePath(fileToFind);
+ final FilePredicate predicate = fileSystem.predicates().hasPath(fileToFind);
final InputFile inputFile = fileSystem.inputFile(predicate);
if(inputFile!=null) {
result.put(file.getFileName(), inputFile);
diff --git a/src/main/java/fr/cnes/sonar/plugins/icode/languages/ICodeQualityProfiles.java b/src/main/java/fr/cnes/sonar/plugins/icode/languages/ICodeQualityProfiles.java
index dc70e70..bb68283 100644
--- a/src/main/java/fr/cnes/sonar/plugins/icode/languages/ICodeQualityProfiles.java
+++ b/src/main/java/fr/cnes/sonar/plugins/icode/languages/ICodeQualityProfiles.java
@@ -16,18 +16,18 @@
*/
package fr.cnes.sonar.plugins.icode.languages;
-import fr.cnes.sonar.plugins.icode.model.Rule;
-import fr.cnes.sonar.plugins.icode.model.RulesDefinition;
-import fr.cnes.sonar.plugins.icode.model.XmlHandler;
import fr.cnes.sonar.plugins.icode.rules.ICodeRulesDefinition;
+import fr.cnes.sonar.plugins.icode.rules.RulesRepository;
+
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition;
import org.sonar.api.utils.log.Logger;
import org.sonar.api.utils.log.Loggers;
+import org.sonar.api.server.rule.RulesDefinition.NewRule;
-import java.io.InputStream;
+import java.util.List;
/**
- * Built-in quality profile format since SonarQube 6.6.
+ * Built-in quality profile format since SonarQube 9.9
*/
public final class ICodeQualityProfiles implements BuiltInQualityProfilesDefinition {
@@ -37,6 +37,9 @@ public final class ICodeQualityProfiles implements BuiltInQualityProfilesDefinit
/** Display name for the built-in quality profile. **/
private static final String I_CODE_RULES_PROFILE_NAME = "Sonar way";
+ private List f77Rules = RulesRepository.getInstance().getF77Rules();
+ private List f90Rules = RulesRepository.getInstance().getF90Rules();
+
/**
* Allow to create a plugin.
*
@@ -44,36 +47,29 @@ public final class ICodeQualityProfiles implements BuiltInQualityProfilesDefinit
*/
@Override
public void define(final Context context) {
- createBuiltInProfile(context, Fortran77Language.KEY, ICodeRulesDefinition.PATH_TO_F77_RULES_XML);
- createBuiltInProfile(context, Fortran90Language.KEY, ICodeRulesDefinition.PATH_TO_F90_RULES_XML);
+ createBuiltInProfile(context, ICodeRulesDefinition.FORTRAN77_REPOSITORY, Fortran77Language.KEY, f77Rules);
+ createBuiltInProfile(context, ICodeRulesDefinition.FORTRAN90_REPOSITORY, Fortran90Language.KEY, f90Rules);
}
/**
* Create a built in quality profile for a specific language.
*
* @param context SonarQube context in which create the profile.
+ * @param repository Rules' repository.
* @param language Language key of the associated profile.
- * @param path Path to the xml definition of all rules.
+ * @param rules Rules to activate.
*/
- private void createBuiltInProfile(final Context context, final String language, final String path) {
+ private void createBuiltInProfile(final Context context, final String repository, final String languageKey, final List rules) {
// Create a builder for the rules' repository.
- final NewBuiltInQualityProfile defaultProfile =
- context.createBuiltInQualityProfile(I_CODE_RULES_PROFILE_NAME, language);
-
- // Retrieve all defined rules.
- final InputStream stream = getClass().getResourceAsStream(path);
- final RulesDefinition rules = (RulesDefinition) XmlHandler.unmarshal(stream, RulesDefinition.class);
- final String repositoryKey = ICodeRulesDefinition.getRepositoryKeyForLanguage(language);
+ NewBuiltInQualityProfile profile = context.createBuiltInQualityProfile(I_CODE_RULES_PROFILE_NAME, languageKey);
// Activate all i-Code CNES rules.
- for(final Rule rule : rules.getRules()) {
- defaultProfile.activateRule(repositoryKey, rule.getKey());
- LOGGER.debug(String.format("Rule %s added to repository %s.", rule.getKey(), repositoryKey));
+ for (NewRule rule : rules) {
+ profile.activateRule(repository, rule.key());
+ LOGGER.info(String.format("Rule %s added to repository %s.", rule.key(), repository));
}
- LOGGER.debug(String.format("%s rules are activated.", defaultProfile.activeRules().size()));
-
- // Save the default profile.
- defaultProfile.setDefault(true);
- defaultProfile.done();
+ profile.setDefault(true);
+ profile.done();
+ LOGGER.info(String.format("%s rules are activated for the repository %s.", profile.activeRules().size(), repository));
}
}
\ No newline at end of file
diff --git a/src/main/java/fr/cnes/sonar/plugins/icode/measures/ICodeMetricsProcessor.java b/src/main/java/fr/cnes/sonar/plugins/icode/measures/ICodeMetricsProcessor.java
index 6851bfe..23383d5 100644
--- a/src/main/java/fr/cnes/sonar/plugins/icode/measures/ICodeMetricsProcessor.java
+++ b/src/main/java/fr/cnes/sonar/plugins/icode/measures/ICodeMetricsProcessor.java
@@ -78,12 +78,9 @@ public static void saveMeasure(final SensorContext context, final Map {
- if(x.contains(".MET.LineOfCode")) {
+ if(x.contains(".MET.Line")) {
rawMeasures.addAll(y);
}
});
diff --git a/src/main/java/fr/cnes/sonar/plugins/icode/rules/ICodeRulesDefinition.java b/src/main/java/fr/cnes/sonar/plugins/icode/rules/ICodeRulesDefinition.java
index 528dd17..217ab7c 100644
--- a/src/main/java/fr/cnes/sonar/plugins/icode/rules/ICodeRulesDefinition.java
+++ b/src/main/java/fr/cnes/sonar/plugins/icode/rules/ICodeRulesDefinition.java
@@ -16,23 +16,44 @@
*/
package fr.cnes.sonar.plugins.icode.rules;
+import org.sonar.api.rule.RuleKey;
+import org.sonar.api.rule.RuleStatus;
+import org.sonar.api.rules.RuleType;
+import org.sonar.api.server.rule.RulesDefinition;
+
+import org.sonar.api.utils.log.Logger;
+import org.sonar.api.utils.log.Loggers;
+
import fr.cnes.sonar.plugins.icode.languages.Fortran77Language;
import fr.cnes.sonar.plugins.icode.languages.Fortran90Language;
import fr.cnes.sonar.plugins.icode.settings.ICodePluginProperties;
-import org.sonar.api.server.rule.RulesDefinition;
-import org.sonar.api.server.rule.RulesDefinitionXmlLoader;
import java.io.InputStream;
-import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.Node;
+import org.w3c.dom.Element;
/**
* Specific i-Code rules definition provided by resource file.
*/
public class ICodeRulesDefinition implements RulesDefinition {
+ /** Logger for this class. **/
+ private static final Logger LOGGER = Loggers.get(ICodeRulesDefinition.class);
+
/** Partial key for repository. **/
private static final String REPO_KEY_SUFFIX = "-rules";
+ public static final String FORTRAN77_LANGUAGE = Fortran77Language.KEY;
+ public static final String FORTRAN90_LANGUAGE = Fortran90Language.KEY;
+
+ public static final String FORTRAN77_REPOSITORY = FORTRAN77_LANGUAGE + REPO_KEY_SUFFIX;
+ public static final String FORTRAN90_REPOSITORY = FORTRAN90_LANGUAGE + REPO_KEY_SUFFIX;
/** Path to xml file in resources tree (fortran 77 rules). **/
public static final String PATH_TO_F77_RULES_XML = "/rules/icode-f77-rules.xml";
@@ -47,30 +68,84 @@ public class ICodeRulesDefinition implements RulesDefinition {
*/
@Override
public void define(final Context context) {
- createRepository(context, Fortran77Language.KEY);
- createRepository(context, Fortran90Language.KEY);
+ createFortranRepository(context, FORTRAN77_LANGUAGE, FORTRAN77_REPOSITORY, PATH_TO_F77_RULES_XML);
+ createFortranRepository(context, FORTRAN90_LANGUAGE, FORTRAN90_REPOSITORY, PATH_TO_F90_RULES_XML);
}
/**
- * Create repositories for each language.
- *
+ * Create repositories for each language f77 and f90
+ *
* @param context SonarQube context.
* @param language Key of the language.
+ * @param repositoryName Key of the repository.
+ * @param pathToRulesXml Path to the xml file containing the rules.
*/
- protected void createRepository(final Context context, final String language) {
- // Create a repository to put rules inside.
- final NewRepository repository = context
- .createRepository(getRepositoryKeyForLanguage(language), language)
- .setName(getRepositoryName());
-
- // Get XML file describing rules for language.
- final InputStream rulesXml = this.getClass().getResourceAsStream(rulesDefinitionFilePath(language));
- // Add rules in repository.
- if (rulesXml != null) {
- final RulesDefinitionXmlLoader rulesLoader = new RulesDefinitionXmlLoader();
- rulesLoader.load(repository, rulesXml, StandardCharsets.UTF_8.name());
+ protected void createFortranRepository(final Context context, final String language, final String repositoryName, final String pathToRulesXml) {
+ // Create the repository
+ NewRepository repository = context.createRepository(repositoryName, language)
+ .setName(ICodePluginProperties.ICODE_NAME);
+
+ List rules = new ArrayList<>();
+
+ try {
+ InputStream inputFile = this.getClass().getResourceAsStream(pathToRulesXml);
+
+ if (inputFile == null) {
+ repository.done();
+ if (language.equals(FORTRAN77_LANGUAGE)) {
+ RulesRepository.getInstance().setF77Rules(rules);
+ } else {
+ RulesRepository.getInstance().setF90Rules(rules);
+ }
+
+ }
+
+ DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
+ dbFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
+ Document doc = dbFactory.newDocumentBuilder().parse(inputFile);
+ doc.getDocumentElement().normalize();
+
+ NodeList nodeList = doc.getElementsByTagName("rule");
+
+ for (int i = 0; i < nodeList.getLength(); i++) {
+ Node node = nodeList.item(i);
+
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element element = (Element) node;
+
+ String key = element.getElementsByTagName("key").item(0).getTextContent();
+ String name = element.getElementsByTagName("name").item(0).getTextContent();
+ String internalKey = element.getElementsByTagName("internalKey").item(0).getTextContent();
+ String description = element.getElementsByTagName("description").item(0).getTextContent();
+ String severity = element.getElementsByTagName("severity").item(0).getTextContent();
+ RuleStatus status = RuleStatus.valueOf(element.getElementsByTagName("status").item(0).getTextContent());
+ RuleType type = RuleType.valueOf(element.getElementsByTagName("type").item(0).getTextContent());
+ String remediationFunctionBaseEffort = element.getElementsByTagName("remediationFunctionBaseEffort").item(0).getTextContent();
+
+ RuleKey ruleKey = RuleKey.of(repositoryName, key);
+
+ NewRule rule = repository.createRule(ruleKey.rule())
+ .setName(name)
+ .setInternalKey(internalKey)
+ .setHtmlDescription(description)
+ .setSeverity(severity)
+ .setStatus(status)
+ .setType(type);
+
+ rule.setDebtRemediationFunction(rule.debtRemediationFunctions().constantPerIssue(remediationFunctionBaseEffort));
+ rules.add(rule);
+ LOGGER.info(String.format("Rule %s created.", rule.toString()));
+ }
+ }
+ repository.done();
+ } catch (Exception e) {
+ LOGGER.error("Error while creating rules.", e);
}
- repository.done();
+ if (language.equals(FORTRAN77_LANGUAGE)) {
+ RulesRepository.getInstance().setF77Rules(rules);
+ } else {
+ RulesRepository.getInstance().setF90Rules(rules);
+ }
}
/**
@@ -82,35 +157,4 @@ protected void createRepository(final Context context, final String language) {
public static String getRepositoryKeyForLanguage(final String language) {
return language + REPO_KEY_SUFFIX;
}
-
- /**
- * Getter for repository name.
- *
- * @return A string.
- */
- public static String getRepositoryName() {
- return ICodePluginProperties.ICODE_NAME;
- }
-
- /**
- * Getter for the path to rules file.
- *
- * @param language Key of the language.
- * @return A path in String format.
- */
- public String rulesDefinitionFilePath(final String language) {
- String path = "bad_file";
- switch (language) {
- case Fortran77Language.KEY:
- path = PATH_TO_F77_RULES_XML;
- break;
- case Fortran90Language.KEY:
- path = PATH_TO_F90_RULES_XML;
- break;
- default:
- break;
- }
- return path;
- }
-}
-
+}
\ No newline at end of file
diff --git a/src/main/java/fr/cnes/sonar/plugins/icode/rules/RulesRepository.java b/src/main/java/fr/cnes/sonar/plugins/icode/rules/RulesRepository.java
new file mode 100644
index 0000000..fef38f0
--- /dev/null
+++ b/src/main/java/fr/cnes/sonar/plugins/icode/rules/RulesRepository.java
@@ -0,0 +1,40 @@
+package fr.cnes.sonar.plugins.icode.rules;
+
+import java.util.List;
+import java.util.ArrayList;
+import org.sonar.api.server.rule.RulesDefinition.NewRule;
+
+public class RulesRepository {
+ private static RulesRepository instance = null;
+
+ private List f77Rules;
+ private List f90Rules;
+
+ private RulesRepository() {
+ this.f77Rules = new ArrayList<>();
+ this.f90Rules = new ArrayList<>();
+ }
+
+ public static RulesRepository getInstance() {
+ if (instance == null) {
+ instance = new RulesRepository();
+ }
+ return instance;
+ }
+
+ public List getF77Rules() {
+ return f77Rules;
+ }
+
+ public List getF90Rules() {
+ return f90Rules;
+ }
+
+ public void setF77Rules(List f77Rules) {
+ this.f77Rules = f77Rules;
+ }
+
+ public void setF90Rules(List f90Rules) {
+ this.f90Rules = f90Rules;
+ }
+}
diff --git a/src/main/resources/rules/icode-f77-rules.xml b/src/main/resources/rules/icode-f77-rules.xml
index 321d6b8..f969fe4 100644
--- a/src/main/resources/rules/icode-f77-rules.xml
+++ b/src/main/resources/rules/icode-f77-rules.xml
@@ -14,10 +14,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool:
BLOCKER
- SINGLE
READY
BUG
- CONSTANT_ISSUE
30min
@@ -26,10 +24,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Equality and non equality (.EQ., ==, .NE., /=) are forbidden on reals (REAL, DOUBLE PRECISION, COMPLEX).
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -38,10 +34,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Variables have to be initialized before being used. When a variable is used, the algorithm should checked if it is initialized and if not throw an error.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -50,10 +44,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Data declared into subroutine, function, ... and which are never modified then should be declared as constant.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -62,10 +54,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
It is forbidden to modify loop condition inside the loop.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -74,10 +64,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Every declared variable should be used.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -86,10 +74,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Allocation and desallocation of ressources should be in the same level. For each “DEALLOCATE” keyword found, i-Code CNES checks that the keyword “ALLOCATE” is also found and checks that they are relative to the same resource.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -98,10 +84,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In a loop, SLEEP, WAIT and PAUSE instructions are forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -110,10 +94,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Keyword STOP is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -122,10 +104,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In a condition (IF,DO), maximum number of operands is 5 (AND, OR, NEQV, XOR, EQV, NOT, LT, <, LE, <=, GT, >, GE, >=, EQ, ==, NE, /=).
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -134,10 +114,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Function return values should be checked.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -146,10 +124,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
The identity of the user running the program should be checked.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -158,10 +134,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Function, procedure and method should have a unique exit point.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -170,10 +144,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Function, procedure and method should have a unique exit point.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -182,10 +154,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
File opening (OPEN, READ, WRITE) should be done after using INQUIRE and EXIST instruction of this file.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -194,10 +164,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In the OPEN instruction, it is forbidden to use directly the file name (file.txt). Path should be defined through a variable.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -208,10 +176,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: ( a )
.NOT. ( a .AND. .NOT. b) -> .NOT. a .OR. b
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -220,10 +186,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Every expression should be braced.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -232,10 +196,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Commented code is forbidden. i-Code CNES checks all keywords in comments, except in the header.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -244,10 +206,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
"GO TO" is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -256,10 +216,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In a loop instruction, comparison using (.EQ., ==, .NE., \=) are forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -268,10 +226,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Variable name should be unique.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -280,10 +236,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Headers are mandatory for each module and function.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -300,10 +254,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool:
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -312,10 +264,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
A line of source code should contain 100 characters maximum.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -324,10 +274,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In a expression (defined by operator like +, -, /, *, **) all variables should have the same type : REAL, INTEGER, …
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -336,10 +284,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
White COMMON are forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -348,10 +294,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In an instruction IF, the last ELSE IF should be follow by ELSE.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -360,10 +304,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Parameter’s braces should be used when defining a FUNCTION whenever there is no parameter.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -372,10 +314,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Nested DO loop should have different end instructions (one for each).
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -384,10 +324,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Arrays dimension should be declared explicitly. The use of * is tolerated for the last one if justified with a comment.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -396,10 +334,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
INCLUDE must be used to declare COMMON in program units referencing it.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -408,10 +344,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In a constant initialisation or in an expression evaluation, the use of (D) (as double precision is mandatory.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -420,10 +354,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Variable initialisation should be done using DATA or BLOCKDATA.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -432,10 +364,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Implicit logical units defined by * are forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -444,10 +374,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
DO loop condition parameter should use INTEGER.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -456,10 +384,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
The use of constants, computed values or function calls as function parameters is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -468,10 +394,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
The check of return status for instructions OPEN and READ is mandatory. It is recommended to use “IOSTAT = “ to do it.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -480,10 +404,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
ASSIGN instruction is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -492,10 +414,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
DIMENSION instruction is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -504,10 +424,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
EQUIVALENCE instruction is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -516,10 +434,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
FUNCTION instruction should be used with an explicite type declaration, at function definition.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -528,10 +444,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Arithmetic IF is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -540,10 +454,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
If instruction INCLUDE is used, the included file should not contain executable instructions. (ASSIGN, GOTO, IF, ELSE, CONTINUE, STOP, PAUSE ; DO, READ, WRITE, PRINT, REWIND ; BACKSPACE, ENDFILE, OPEN, CLOSE, INQUIER, CALL, RETURN, END).
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -552,10 +464,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
PAUSE instruction is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -564,10 +474,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
RETURN(i) instruction is forbidden in subprogram.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -576,10 +484,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
SAVE instruction is forbidden except for local variables with justification in a comment.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -588,10 +494,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Each line should contain less than 72 characters.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -600,10 +504,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
The use of generic names for intrinseque functions is mandatory.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -612,10 +514,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Intrinsic function names reuse is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -624,10 +524,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Fortran 77 keywords should not be reused for variable names.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -636,10 +534,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Label usage is restricted to instruction FORMAT and CONTINUE.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -648,10 +544,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
External functions should be declared with EXTERNAL keyword.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -660,10 +554,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Logical unit should be identified with symbolic name.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -672,10 +564,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
OPEN parameters FILE, STATUS and POSITION should be defined.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -684,10 +574,9 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
It is forbidden to set as subroutine parameter variables which are already in a COMMON bloc accessible from the subroutine and the program which calls it.
MAJOR
- SINGLE
+
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -696,10 +585,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Only standard types (INTEGER, REAL, DOUBLE PRECISION, COMPLEX, LOGICAL, CHARACTER) are allowed.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -708,10 +595,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Data and constant of type Hollerith are forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
\ No newline at end of file
diff --git a/src/main/resources/rules/icode-f90-rules.xml b/src/main/resources/rules/icode-f90-rules.xml
index 47da947..d7fee78 100644
--- a/src/main/resources/rules/icode-f90-rules.xml
+++ b/src/main/resources/rules/icode-f90-rules.xml
@@ -14,10 +14,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool:
BLOCKER
- SINGLE
READY
BUG
- CONSTANT_ISSUE
30min
@@ -26,10 +24,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Equality and non equality (.EQ., ==, .NE., /=) are forbidden on reals (REAL, DOUBLE PRECISION, COMPLEX).
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -38,10 +34,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Variables have to be initialized before being used. When a variable is used, the algorithm should checked if it is initialized and if not throw an error.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -50,10 +44,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Data declared into subroutine, function, ... and which are never modified then should be declared as constant.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -62,10 +54,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
It is forbidden to modify loop condition inside the loop.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -74,10 +64,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Every declared variable should be used.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -86,10 +74,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Allocation and deallocation of ressources should be in the same level. For each “DEALLOCATE” keyword found, i-Code CNES checks that the keyword “ALLOCATE” is also found and checks that they are relative to the same resource.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -98,10 +84,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In a loop, SLEEP, WAIT and PAUSE instructions are forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -110,10 +94,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Keyword STOP is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -122,10 +104,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In a condition (IF,DO), maximum number of operands is 5 (AND, OR, NEQV, XOR, EQV, NOT, LT, <, LE, <=, GT, >, GE, >=, EQ, ==, NE, /=).
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -134,10 +114,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Function return values should be checked.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -146,10 +124,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
The identity of the user running the program should be checked.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -158,10 +134,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Function, procedure and method should have a unique exit point.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -170,10 +144,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Function, procedure and method should have a unique exit point.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -182,10 +154,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
File opening (OPEN, READ, WRITE) should be done after using INQUIRE and EXIST instruction of this file.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -194,10 +164,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In the OPEN instruction, it is forbidden to use directly the file name (file.txt). Path should be defined through a variable.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -208,10 +176,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: ( a )
.NOT. ( a .AND. .NOT. b) -> .NOT. a .OR. b
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -220,10 +186,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Every expression should be braced.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -232,10 +196,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Commented code is forbidden. i-Code CNES checks all keywords in comments, except in the header.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -244,10 +206,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
"GO TO" is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -256,10 +216,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In a loop instruction, comparison using (.EQ., ==, .NE., \=) are forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -268,10 +226,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Variable name should be unique.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -280,10 +236,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Headers are mandatory for each module and function.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -300,10 +254,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool:
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -312,10 +264,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
A line of source code should contain 100 characters maximum.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -324,10 +274,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In a expression (defined by operator like +, -, /, *, **) all variables should have the same type : REAL, INTEGER, …
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -336,10 +284,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
SWITCH instruction should define the DEFAULT case as last one.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -348,10 +294,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Each line should be limited to only one expression.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -360,10 +304,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Recursion is forbidden. In Fortran, i-Code CNES checks that "RECURSIVE FUNCTION(params)" is not found.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -372,10 +314,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Every open file should be closed.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -384,10 +324,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Array dimensions should be respected.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -396,10 +334,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In an array of indirections, it is not possible to define the same item several times.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -408,10 +344,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Constants which appear in several subprograms should be defined into a module.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -420,10 +354,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Numerical constants (see above) should be followed by subtype parameter.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -433,10 +365,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: The use of IMPLICIT NONE instruction is mandatory for each method header.
Limitations : this rule is not checked for function and array.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -445,10 +375,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
It is forbidden to use * output format (WRITE instruction) for REAL.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -457,10 +385,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Functions SELECTED_REAL_KIND and SELECTED_INT_KIND should be grouped in the same module.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -469,10 +395,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Allocated memory should be free in the same conceptual level.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -481,10 +405,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
File inclusion is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -493,10 +415,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Modules should only contains USE, PRIVATE and PUBLIC clauses.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -505,10 +425,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
In an OPEN function, units number should depend on another function or array.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -527,10 +445,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool:
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -539,10 +455,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Allocation and deallocation should contain “STAT” parameter. Then, « STAT » value should be tested.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -551,10 +465,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
OPEN and READ instructions, which work on files, should contain IOSTAT parameter and check this variable value. To check this, OPEN instruction should contain FILE attribute.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -563,10 +475,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Between declaration and ASSOCIATED instruction, it is mandatory to call NULLIFY.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -575,10 +485,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
ENTRY instruction is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -587,10 +495,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
EQUIVALENCE instruction is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -599,10 +505,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
IF followed by one of these instructions : EXIT, GOTO, CYCLE, RETURN is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -611,10 +515,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Each subprogram parameter should be declared with INTENT keyword.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -623,10 +525,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
After deallocate, the use of NULLIFY into the same logical unit is mandatory.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -635,10 +535,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
The use of keyword ONLY without comment is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -647,10 +545,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Do not use old notation. Replace .EQ., .NE., .LT., .LE., .GT., .GE. by ==, /=, <, <=, >, >=.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -662,10 +558,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool:
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -676,10 +570,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool:
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -688,10 +580,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Fortran keywords should not be used as variable names.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -700,10 +590,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Overriding operators is forbidden.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -712,10 +600,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
The use of a whole array should be represented using the notation (:).
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -724,10 +610,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Called subprogram should be visible.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -736,10 +620,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
END keyword should be followed by the type (function, subroutine…) and the name.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -748,10 +630,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Every OPEN instruction should have parameters FILE, STATUS, IOSTAT and POSITION.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -760,10 +640,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
A variable should be referenced with the same name in subprogram.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -772,10 +650,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
Every type declaration should be placed into a module.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -784,10 +660,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
INTEGER parameters should be followed by SELECTED_INT_KIND expression.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
@@ -796,10 +670,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: *
REAL parameters should be followed by SELECTED_REAL_KIND.
MAJOR
- SINGLE
READY
CODE_SMELL
- CONSTANT_ISSUE
30min
\ No newline at end of file
diff --git a/src/test/java/fr/cnes/sonar/plugins/icode/ICodePluginTest.java b/src/test/java/fr/cnes/sonar/plugins/icode/ICodePluginTest.java
index f019c83..d26afce 100644
--- a/src/test/java/fr/cnes/sonar/plugins/icode/ICodePluginTest.java
+++ b/src/test/java/fr/cnes/sonar/plugins/icode/ICodePluginTest.java
@@ -23,16 +23,17 @@
import org.sonar.api.SonarRuntime;
import org.sonar.api.internal.SonarRuntimeImpl;
import org.sonar.api.utils.Version;
+import org.sonar.api.SonarEdition;
public class ICodePluginTest {
- private static final Version VERSION_6_7 = Version.create(6, 7);
+ private static final Version VERSION_8_9 = Version.create(8, 9);
@Test
public void test_extensions_are_all_set() {
ICodePlugin iCodePlugin = new ICodePlugin();
- SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(VERSION_6_7, SonarQubeSide.SERVER);
+ SonarRuntime runtime = SonarRuntimeImpl.forSonarQube(VERSION_8_9, SonarQubeSide.SERVER, SonarEdition.COMMUNITY);
Plugin.Context context = new Plugin.Context(runtime);
iCodePlugin.define(context);
Assert.assertEquals(12, context.getExtensions().size());
diff --git a/src/test/java/fr/cnes/sonar/plugins/icode/check/ICodeSensorTest.java b/src/test/java/fr/cnes/sonar/plugins/icode/check/ICodeSensorTest.java
index d83e958..8bb0357 100644
--- a/src/test/java/fr/cnes/sonar/plugins/icode/check/ICodeSensorTest.java
+++ b/src/test/java/fr/cnes/sonar/plugins/icode/check/ICodeSensorTest.java
@@ -29,6 +29,7 @@
import org.mockito.Mockito;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultFileSystem;
+import org.sonar.api.batch.fs.FileSystem;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
import org.sonar.api.batch.fs.internal.TestInputFileBuilder;
import org.sonar.api.batch.sensor.SensorDescriptor;
@@ -58,25 +59,21 @@ public class ICodeSensorTest {
public void prepare() throws URISyntaxException {
fs = new DefaultFileSystem(new File(getClass().getResource("/project").toURI()));
fs.setEncoding(StandardCharsets.UTF_8);
-
- clanhb_f = TestInputFileBuilder.create(
- "ProjectKey",
- fs.resolvePath("clanhb.f").getPath())
+
+ clanhb_f = TestInputFileBuilder.create("ProjectKey", fs.baseDir(), new File(getClass().getResource("/project/clanhb.f").toURI()))
.setLanguage("icode")
.setType(InputFile.Type.MAIN)
.setLines(10)
- .setOriginalLineOffsets(new int[]{0,0,0,0,0,0,0,0,0,0})
+ .setOriginalLineStartOffsets(new int[]{0,0,0,0,0,0,0,0,0,0})
.setLastValidOffset(100)
.build();
fs.add(clanhb_f);
- clanhb_f90 = TestInputFileBuilder.create(
- "ProjectKey",
- fs.resolvePath("clanhb.f90").getPath())
+ clanhb_f90 = TestInputFileBuilder.create("ProjectKey", fs.baseDir(), new File(getClass().getResource("/project/clanhb.f90").toURI()))
.setLanguage("icode")
.setType(InputFile.Type.MAIN)
.setLines(10)
- .setOriginalLineOffsets(new int[]{0,0,0,0,0,0,0,0,0,0})
+ .setOriginalLineStartOffsets(new int[]{0,0,0,0,0,0,0,0,0,0})
.setLastValidOffset(100)
.build();
fs.add(clanhb_f90);
diff --git a/src/test/java/fr/cnes/sonar/plugins/icode/languages/ICodeQualityProfilesTest.java b/src/test/java/fr/cnes/sonar/plugins/icode/languages/ICodeQualityProfilesTest.java
index a1464fa..c7e9bab 100644
--- a/src/test/java/fr/cnes/sonar/plugins/icode/languages/ICodeQualityProfilesTest.java
+++ b/src/test/java/fr/cnes/sonar/plugins/icode/languages/ICodeQualityProfilesTest.java
@@ -19,16 +19,21 @@
import org.junit.Assert;
import org.junit.Test;
import org.sonar.api.server.profile.BuiltInQualityProfilesDefinition;
+import org.sonar.api.server.rule.RulesDefinition;
+import fr.cnes.sonar.plugins.icode.rules.ICodeRulesDefinition;
public class ICodeQualityProfilesTest {
@Test
public void test_should_create_sonar_way_profile() {
ICodeQualityProfiles profileDef = new ICodeQualityProfiles();
+
+ RulesDefinition.Context contextRules = new RulesDefinition.Context();
+ new ICodeRulesDefinition().define(contextRules);
+
BuiltInQualityProfilesDefinition.Context context = new BuiltInQualityProfilesDefinition.Context();
profileDef.define(context);
Assert.assertNotNull(profileDef);
Assert.assertEquals(2, context.profilesByLanguageAndName().keySet().size());
}
-
}
diff --git a/src/test/java/fr/cnes/sonar/plugins/icode/measures/ICodeMetricsProcessorTest.java b/src/test/java/fr/cnes/sonar/plugins/icode/measures/ICodeMetricsProcessorTest.java
index 128af63..91aef77 100644
--- a/src/test/java/fr/cnes/sonar/plugins/icode/measures/ICodeMetricsProcessorTest.java
+++ b/src/test/java/fr/cnes/sonar/plugins/icode/measures/ICodeMetricsProcessorTest.java
@@ -21,8 +21,13 @@
import fr.cnes.sonar.plugins.icode.model.AnalysisRule;
import fr.cnes.sonar.plugins.icode.model.Result;
import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+import org.junit.jupiter.params.provider.Arguments;
+
+import java.util.stream.Stream;
import org.sonar.api.batch.fs.InputFile;
import org.sonar.api.batch.fs.internal.DefaultFileSystem;
import org.sonar.api.batch.fs.internal.DefaultInputFile;
@@ -38,98 +43,86 @@
import java.util.List;
import java.util.Map;
-public class ICodeMetricsProcessorTest {
+class ICodeMetricsProcessorTest {
private DefaultFileSystem fs;
private SensorContextTester context;
private Map files;
private AnalysisRule rule;
- private DefaultInputFile bash_sh;
private DefaultInputFile clanhb_f;
+ private DefaultInputFile clanhb_f90;
- @Before
+ @BeforeEach
public void prepare() throws URISyntaxException {
- final URI projectPath = ICodeMetricsProcessor.class.getResource("/project/").toURI();
+ final URI projectPath = ICodeMetricsProcessor.class.getResource("/project").toURI();
fs = new DefaultFileSystem(new File(projectPath));
fs.setEncoding(Charset.forName("UTF-8"));
- bash_sh = TestInputFileBuilder.create(
+ clanhb_f = TestInputFileBuilder.create(
"ProjectKey",
- fs.resolvePath(projectPath.getRawPath()+"bash.sh").getPath())
+ fs.baseDir(), new File(getClass().getResource("/project/clanhb.f").toURI()))
.setLanguage("icode")
.setType(InputFile.Type.MAIN)
.build();
- fs.add(bash_sh);
- clanhb_f = TestInputFileBuilder.create(
- "ProjectKey",
- fs.resolvePath(projectPath.getRawPath()+"clanhb.f").getPath())
+ fs.add(clanhb_f);
+
+ clanhb_f90 = TestInputFileBuilder.create("ProjectKey", fs.baseDir(), new File(getClass().getResource("/project/clanhb.f90").toURI()))
.setLanguage("icode")
.setType(InputFile.Type.MAIN)
.build();
- fs.add(clanhb_f);
+ fs.add(clanhb_f90);
+
context = SensorContextTester.create(fs.baseDir());
files = new HashMap<>();
rule = new AnalysisRule();
- files.put("bash.sh", bash_sh);
files.put("clanhb.f", clanhb_f);
+ files.put("clanhb.f90", clanhb_f90);
}
- @Test
- public void test_is_metric_true() {
- Assert.assertTrue(ICodeMetricsProcessor.isMetric("SH.MET.COCO"));
- }
-
- @Test
- public void test_is_metric_false() {
- Assert.assertFalse(ICodeMetricsProcessor.isMetric("COCO"));
- }
-
- @Test
- public void test_save_nominal_measures() {
- String[] analysisRulesIds = {"SH.MET.LineOfCode","SH.MET.LineOfComment","F90.MET.Nesting","F90.MET.LineOfCode"};
- String[] fileNames = {"bash.sh", "bash.sh", "bash.sh", "zoulou.sh"};
- int[] expectedResults = {1,2,2,2}; // Size is incremented as context.measure(key) is not resetted after each iteration
-
- for(int i=0;i testData() {
+ return Stream.of(
+ Arguments.of(new AnalysisRuleTestData("F77.MET.ComplexitySimplified", "clanhb.f", "3")),
+ Arguments.of(new AnalysisRuleTestData("F77.MET.Nesting", "clanhb.f", "3")),
+ Arguments.of(new AnalysisRuleTestData("F77.MET.Line", "clanhb.f", "3"))
+ );
}
- @Test
- public void test_compute_complexity() {
-
+ @ParameterizedTest
+ @MethodSource("testData")
+ void test_compute_metrics(AnalysisRuleTestData testData) {
final AnalysisProject project = new AnalysisProject();
final String key = clanhb_f.key();
rule.setResult(new Result());
- rule.setAnalysisRuleId("F77.MET.ComplexitySimplified");
- rule.getResult().setFileName("clanhb.f");
- rule.getResult().setResultValue("3");
- rule.getResult().setResultLine("3");
+ rule.setAnalysisRuleId(testData.getAnalysisRuleId());
+ rule.getResult().setFileName(testData.getFileName());
+ rule.getResult().setResultValue(testData.getResultValue());
+ rule.getResult().setResultLine("3"); // Assuming the result line is always "3"
rule.getResult().setResultTypePlace("method");
rule.getResult().setResultMessage("Small file");
project.setAnalysisRule(new AnalysisRule[]{rule});
ICodeMetricsProcessor.saveExtraMeasures(context, files, project);
+
Assert.assertEquals(1, context.measures(key).size());
}
@Test
- public void test_save_extra_measure_with_null_location() {
+ void test_is_metric_true() {
+ Assert.assertTrue(ICodeMetricsProcessor.isMetric("SH.MET.COCO"));
+ }
+
+ @Test
+ void test_is_metric_false() {
+ Assert.assertFalse(ICodeMetricsProcessor.isMetric("COCO"));
+ }
+
+ @Test
+ void test_save_extra_measure_with_null_location() {
// If we upgrade to Junit5, we may check @ParametrizedTest annotation
String[] locations = {null, "", "method"};
int[] expectedResults = {0, 0, 1};
@@ -150,75 +143,44 @@ public void test_save_extra_measure_with_null_location() {
}
@Test
- public void test_compute_nesting() {
+ void test_save_nominal_measures() {
- final AnalysisProject project = new AnalysisProject();
final String key = clanhb_f.key();
-
rule.setResult(new Result());
- rule.setAnalysisRuleId("F77.MET.Nesting");
+ rule.setAnalysisRuleId("F77.MET.Line");
rule.getResult().setFileName("clanhb.f");
rule.getResult().setResultValue("3");
rule.getResult().setResultLine("3");
- rule.getResult().setResultTypePlace("method");
+ rule.getResult().setResultTypePlace("class");
rule.getResult().setResultMessage("Small file");
- project.setAnalysisRule(new AnalysisRule[]{rule});
-
- ICodeMetricsProcessor.saveExtraMeasures(context, files, project);
+ ICodeMetricsProcessor.saveMeasure(context, files, rule);
Assert.assertEquals(1, context.measures(key).size());
}
+
+}
- @Test
- public void test_compute_functions() {
-
- final AnalysisProject project = new AnalysisProject();
- final String key = bash_sh.key();
-
- rule.setResult(new Result());
- rule.setAnalysisRuleId("SH.MET.LineOfCode");
- rule.getResult().setFileName("bash.sh");
- rule.getResult().setResultValue("3");
- rule.getResult().setResultLine("3");
- rule.getResult().setResultTypePlace("method");
- rule.getResult().setResultMessage("Small file");
+class AnalysisRuleTestData {
+ private String analysisRuleId;
+ private String fileName;
+ private String resultValue;
- project.setAnalysisRule(new AnalysisRule[]{rule});
-
- ICodeMetricsProcessor.saveExtraMeasures(context, files, project);
- Assert.assertEquals(1, context.measures(key).size());
+ public AnalysisRuleTestData(String analysisRuleId, String fileName, String resultValue) {
+ this.analysisRuleId = analysisRuleId;
+ this.fileName = fileName;
+ this.resultValue = resultValue;
}
- @Test
- public void test_compute_comment() {
-
- final AnalysisProject project = new AnalysisProject();
- final AnalysisRule rule2 = new AnalysisRule();
- final String key = bash_sh.key();
-
- rule.setResult(new Result());
- rule.setAnalysisRuleId("SH.MET.LineOfCode");
- rule.getResult().setFileName("bash.sh");
- rule.getResult().setResultValue("20");
- rule.getResult().setResultLine("3");
- rule.getResult().setResultTypePlace("method");
- rule.getResult().setResultMessage("Small file");
-
- rule2.setResult(new Result());
- rule2.setAnalysisRuleId("SH.MET.Nesting");
- rule2.getResult().setFileName("bash.sh");
- rule2.getResult().setResultValue("50");
- rule2.getResult().setResultLine("3");
- rule2.getResult().setResultTypePlace("method");
- rule2.getResult().setResultMessage("Small file");
+ public String getAnalysisRuleId() {
+ return analysisRuleId;
+ }
- project.setAnalysisRule(new AnalysisRule[]{rule, rule2});
+ public String getFileName() {
+ return fileName;
+ }
- ICodeMetricsProcessor.saveExtraMeasures(context, files, project);
- Assert.assertEquals(2, context.measures(key).size());
- Assert.assertEquals("functions", ((DefaultMeasure)context.measures(key).toArray()[0]).metric().key());
- Assert.assertEquals("icode-nesting-max", ((DefaultMeasure)context.measures(key).toArray()[1]).metric().key());
- Assert.assertEquals(50, ((DefaultMeasure)context.measures(key).toArray()[1]).value());
+ public String getResultValue() {
+ return resultValue;
}
}
diff --git a/src/test/java/fr/cnes/sonar/plugins/icode/rules/ICodeRulesDefinitionTest.java b/src/test/java/fr/cnes/sonar/plugins/icode/rules/ICodeRulesDefinitionTest.java
index 0720151..8028cbf 100644
--- a/src/test/java/fr/cnes/sonar/plugins/icode/rules/ICodeRulesDefinitionTest.java
+++ b/src/test/java/fr/cnes/sonar/plugins/icode/rules/ICodeRulesDefinitionTest.java
@@ -39,7 +39,7 @@ public void test_creation_of_repositories_and_rules_for_bad_language() {
new ICodeRulesDefinition(){
@Override
public void define(Context context) {
- createRepository(context, "bad");
+ createFortranRepository(context, "bad", "bad-rules", "bad_file");
}
}.define(context);
Assert.assertEquals(1, context.repositories().size());