From 06960c00e57736f6549df368baae0cbca8b0326b Mon Sep 17 00:00:00 2001 From: Oussama Date: Wed, 14 Dec 2022 14:39:51 +0100 Subject: [PATCH 01/11] Upgrade some versions and sonar from 9.4 to 9.7 --- docker-compose.yml | 14 ++--- .../fr/cnumr/java/MyJavaRulesDefinition.java | 16 ++++-- .../AvoidConcatenateStringsInLoopTest.java | 6 +- .../checks/AvoidFullSQLRequestCheckTest.java | 4 +- .../AvoidGettingSizeCollectionInLoopTest.java | 6 +- .../AvoidRegexPatternNotStaticTest.java | 6 +- .../AvoidSQLRequestInLoopCheckTest.java | 4 +- .../AvoidSetConstantInBatchInsertTest.java | 4 +- .../AvoidUsageOfStaticCollectionsTests.java | 6 +- ...oidUsingGlobalVariablesCheckCheckTest.java | 4 +- ...ResourcesOfAutoCloseableInterfaceTest.java | 6 +- .../cnumr/java/checks/IncrementCheckTest.java | 4 +- ...itializeBufferWithAppropriateSizeTest.java | 4 +- ...oFunctionCallWhenDeclaringForLoopTest.java | 4 +- .../OptimizeReadFileExceptionCheckTest.java | 4 +- ...ecessarilyAssignValuesToVariablesTest.java | 4 +- .../java/checks/UseCorrectLoopCheckTest.java | 4 +- .../main/java/fr/cnumr/php/MyPhpRules.java | 20 ++++--- .../php/rules/custom/DefaultProfilePath.json | 3 + pom.xml | 29 ++++++---- python-plugin/pom.xml | 25 +++++---- .../python/CustomPythonRuleRepository.java | 37 +++++------- .../main/java/fr/cnumr/python/RulesList.java | 56 +++++++++++++++++++ .../CustomPythonRuleRepositoryTest.java | 6 +- 24 files changed, 172 insertions(+), 104 deletions(-) create mode 100644 php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/DefaultProfilePath.json create mode 100644 python-plugin/src/main/java/fr/cnumr/python/RulesList.java diff --git a/docker-compose.yml b/docker-compose.yml index 8f1641440..17e5b12e7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,7 @@ version: "3.3" services: sonar: - image: sonarqube:9.3-community + image: sonarqube:9.7-community container_name: sonar_standard ports: - "9000:9000" @@ -24,12 +24,12 @@ services: - type: bind source: ./python-plugin/target/ecocode-python-plugin-0.1.0-SNAPSHOT.jar target: /opt/sonarqube/extensions/plugins/ecocode-python-plugin-0.1.0-SNAPSHOT.jar -# - type: bind -# source: ./ecolinter-plugin/target/ecocode-ecolinter-plugin-0.1.0-SNAPSHOT.jar -# target: /opt/sonarqube/extensions/plugins/ecocode-ecolinter-plugin-0.1.0-SNAPSHOT.jar -# - type: bind -# source: ./xml-plugin/target/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar -# target: /opt/sonarqube/extensions/plugins/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar + # - type: bind + # source: ./ecolinter-plugin/target/ecocode-ecolinter-plugin-0.1.0-SNAPSHOT.jar + # target: /opt/sonarqube/extensions/plugins/ecocode-ecolinter-plugin-0.1.0-SNAPSHOT.jar + # - type: bind + # source: ./xml-plugin/target/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar + # target: /opt/sonarqube/extensions/plugins/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar - "extensions:/opt/sonarqube/extensions" - "logs:/opt/sonarqube/logs" - "data:/opt/sonarqube/data" diff --git a/java-plugin/src/main/java/fr/cnumr/java/MyJavaRulesDefinition.java b/java-plugin/src/main/java/fr/cnumr/java/MyJavaRulesDefinition.java index 00b80634a..34603e01d 100644 --- a/java-plugin/src/main/java/fr/cnumr/java/MyJavaRulesDefinition.java +++ b/java-plugin/src/main/java/fr/cnumr/java/MyJavaRulesDefinition.java @@ -23,7 +23,13 @@ import java.util.Collections; import java.util.Objects; import java.util.Set; + +import org.sonar.api.SonarEdition; +import org.sonar.api.SonarQubeSide; +import org.sonar.api.SonarRuntime; +import org.sonar.api.internal.SonarRuntimeImpl; import org.sonar.api.server.rule.RulesDefinition; +import org.sonar.api.utils.Version; import org.sonarsource.analyzer.commons.RuleMetadataLoader; /** @@ -46,7 +52,9 @@ public class MyJavaRulesDefinition implements RulesDefinition { public void define(Context context) { NewRepository repository = context.createRepository(REPOSITORY_KEY, LANGUAGE).setName(NAME); - RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader(RESOURCE_BASE_PATH); + SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(9, 7), SonarQubeSide.SCANNER, SonarEdition.DEVELOPER); + + RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader(RESOURCE_BASE_PATH,sonarRuntime); ruleMetadataLoader.addRulesByAnnotatedClass(repository, new ArrayList<>(RulesList.getChecks())); @@ -57,8 +65,8 @@ public void define(Context context) { private static void setTemplates(NewRepository repository) { RULE_TEMPLATES_KEY.stream() - .map(repository::rule) - .filter(Objects::nonNull) - .forEach(rule -> rule.setTemplate(true)); + .map(repository::rule) + .filter(Objects::nonNull) + .forEach(rule -> rule.setTemplate(true)); } } diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidConcatenateStringsInLoopTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidConcatenateStringsInLoopTest.java index d21c1d09f..fff7aed67 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidConcatenateStringsInLoopTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidConcatenateStringsInLoopTest.java @@ -1,13 +1,13 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; public class AvoidConcatenateStringsInLoopTest { @Test public void checkNonCompliantTests() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/AvoidConcatenateStringsInLoop.java") .withCheck(new AvoidConcatenateStringsInLoop()) .verifyIssues(); @@ -15,7 +15,7 @@ public void checkNonCompliantTests() { @Test public void checkCompliantTests() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/GoodWayConcatenateStringsLoop.java") .withCheck(new AvoidConcatenateStringsInLoop()) .verifyNoIssues(); diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidFullSQLRequestCheckTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidFullSQLRequestCheckTest.java index e809db096..950b827c7 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidFullSQLRequestCheckTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidFullSQLRequestCheckTest.java @@ -1,13 +1,13 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; class AvoidFullSQLRequestCheckTest { @Test void test() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/AvoidFullSQLRequestCheck.java") .withCheck(new AvoidFullSQLRequest()) .verifyIssues(); diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidGettingSizeCollectionInLoopTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidGettingSizeCollectionInLoopTest.java index 07b4c8454..9afbdc499 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidGettingSizeCollectionInLoopTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidGettingSizeCollectionInLoopTest.java @@ -1,16 +1,16 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; class AvoidGettingSizeCollectionInLoopTest { @Test void test() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/AvoidGettingSizeCollectionInLoopBad.java") .withCheck(new AvoidGettingSizeCollectionInLoop()) .verifyIssues(); - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/AvoidGettingSizeCollectionInLoopGood.java") .withCheck(new AvoidGettingSizeCollectionInLoop()) .verifyNoIssues(); diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidRegexPatternNotStaticTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidRegexPatternNotStaticTest.java index 710b3dea9..163ccfe1c 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidRegexPatternNotStaticTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidRegexPatternNotStaticTest.java @@ -1,13 +1,13 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; public class AvoidRegexPatternNotStaticTest { @Test public void testHasIssues() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/AvoidRegexPatternNotStatic.java") .withCheck(new AvoidRegexPatternNotStatic()) .verifyIssues(); @@ -15,7 +15,7 @@ public void testHasIssues() { @Test public void testHasNoIssues() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFiles( "src/test/files/ValidRegexPattern.java", "src/test/files/ValidRegexPattern2.java", diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidSQLRequestInLoopCheckTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidSQLRequestInLoopCheckTest.java index 0e61bd981..89538c934 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidSQLRequestInLoopCheckTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidSQLRequestInLoopCheckTest.java @@ -1,13 +1,13 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; class AvoidSQLRequestInLoopCheckTest { @Test void test() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/AvoidSQLRequestInLoopCheck.java") .withCheck(new AvoidSQLRequestInLoop()) .verifyIssues(); diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidSetConstantInBatchInsertTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidSetConstantInBatchInsertTest.java index c568e70df..9644ad136 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidSetConstantInBatchInsertTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidSetConstantInBatchInsertTest.java @@ -1,13 +1,13 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; class AvoidSetConstantInBatchInsertTest { @Test void test() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/AvoidSetConstantInBatchUpdateCheck.java") .withCheck(new AvoidSetConstantInBatchUpdate()) .verifyIssues(); diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidUsageOfStaticCollectionsTests.java b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidUsageOfStaticCollectionsTests.java index 74ddfc6b7..8697b3794 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidUsageOfStaticCollectionsTests.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidUsageOfStaticCollectionsTests.java @@ -1,13 +1,13 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; public class AvoidUsageOfStaticCollectionsTests { @Test public void testHasIssues() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/AvoidUsageOfStaticCollections.java") .withCheck(new AvoidUsageOfStaticCollections()) .verifyIssues(); @@ -15,7 +15,7 @@ public void testHasIssues() { @Test public void testNoIssues() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/GoodUsageOfStaticCollections.java") .withCheck(new AvoidUsageOfStaticCollections()) .verifyNoIssues(); diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidUsingGlobalVariablesCheckCheckTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidUsingGlobalVariablesCheckCheckTest.java index 6447ede61..fa33b2e22 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidUsingGlobalVariablesCheckCheckTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/AvoidUsingGlobalVariablesCheckCheckTest.java @@ -1,13 +1,13 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; class AvoidUsingGlobalVariablesCheckCheckTest { @Test void test() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/AvoidUsingGlobalVariablesCheck.java") .withCheck(new AvoidUsingGlobalVariablesCheck()) .verifyIssues(); diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/FreeResourcesOfAutoCloseableInterfaceTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/FreeResourcesOfAutoCloseableInterfaceTest.java index d7e9691ee..3cc25db25 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/FreeResourcesOfAutoCloseableInterfaceTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/FreeResourcesOfAutoCloseableInterfaceTest.java @@ -1,13 +1,13 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; class FreeResourcesOfAutoCloseableInterfaceTest { @Test void test() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/FreeResourcesOfAutoCloseableInterface.java") .withCheck(new FreeResourcesOfAutoCloseableInterface()) .withJavaVersion(7) @@ -16,7 +16,7 @@ void test() { @Test void test_no_java_version() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/FreeResourcesOfAutoCloseableInterface.java") .withCheck(new FreeResourcesOfAutoCloseableInterface()) .verifyIssues(); diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/IncrementCheckTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/IncrementCheckTest.java index c73d2249b..e14538cd9 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/IncrementCheckTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/IncrementCheckTest.java @@ -1,13 +1,13 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; class IncrementCheckTest { @Test void test() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/IncrementCheck.java") .withCheck(new IncrementCheck()) .verifyIssues(); diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/InitializeBufferWithAppropriateSizeTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/InitializeBufferWithAppropriateSizeTest.java index 134b6c5ef..b9f09b68e 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/InitializeBufferWithAppropriateSizeTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/InitializeBufferWithAppropriateSizeTest.java @@ -1,13 +1,13 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; class InitializeBufferWithAppropriateSizeTest { @Test void test() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/InitializeBufferWithAppropriateSize.java") .withCheck(new InitializeBufferWithAppropriateSize()) .verifyIssues(); diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/NoFunctionCallWhenDeclaringForLoopTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/NoFunctionCallWhenDeclaringForLoopTest.java index d0ff2e1a4..62b956e76 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/NoFunctionCallWhenDeclaringForLoopTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/NoFunctionCallWhenDeclaringForLoopTest.java @@ -1,12 +1,12 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; class NoFunctionCallWhenDeclaringForLoopTest { @Test void test() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/NoFunctionCallWhenDeclaringForLoop.java") .withCheck(new NoFunctionCallWhenDeclaringForLoop()) .verifyIssues(); diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/OptimizeReadFileExceptionCheckTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/OptimizeReadFileExceptionCheckTest.java index 998c97035..8b87feb8f 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/OptimizeReadFileExceptionCheckTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/OptimizeReadFileExceptionCheckTest.java @@ -1,13 +1,13 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; class OptimizeReadFileExceptionCheckTest { @Test void test() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/OptimizeReadFileExceptionCheck.java") .withCheck(new OptimizeReadFileExceptions()) .verifyIssues(); diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/UnnecessarilyAssignValuesToVariablesTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/UnnecessarilyAssignValuesToVariablesTest.java index 4fb0422bd..3b643311d 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/UnnecessarilyAssignValuesToVariablesTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/UnnecessarilyAssignValuesToVariablesTest.java @@ -1,13 +1,13 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; class UnnecessarilyAssignValuesToVariablesTest { @Test void test() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/UnnecessarilyAssignValuesToVariablesTestCheck.java") .withCheck(new UnnecessarilyAssignValuesToVariables()) .verifyIssues(); diff --git a/java-plugin/src/test/java/fr/cnumr/java/checks/UseCorrectLoopCheckTest.java b/java-plugin/src/test/java/fr/cnumr/java/checks/UseCorrectLoopCheckTest.java index e19b8db7c..09af6c477 100644 --- a/java-plugin/src/test/java/fr/cnumr/java/checks/UseCorrectLoopCheckTest.java +++ b/java-plugin/src/test/java/fr/cnumr/java/checks/UseCorrectLoopCheckTest.java @@ -1,13 +1,13 @@ package fr.cnumr.java.checks; import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.JavaCheckVerifier; +import org.sonar.java.checks.verifier.CheckVerifier; class UseCorrectLoopCheckTest { @Test void test() { - JavaCheckVerifier.newVerifier() + CheckVerifier.newVerifier() .onFile("src/test/files/UseCorrectForLoopCheck.java") .withCheck(new UseCorrectForLoop()) .verifyIssues(); diff --git a/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java b/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java index 261386ba8..04f56192a 100644 --- a/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java +++ b/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java @@ -22,14 +22,15 @@ import com.google.common.collect.ImmutableList; import fr.cnumr.php.checks.*; +import org.sonar.api.SonarEdition; +import org.sonar.api.SonarQubeSide; +import org.sonar.api.SonarRuntime; +import org.sonar.api.internal.SonarRuntimeImpl; import org.sonar.api.server.rule.RulesDefinition; +import org.sonar.api.utils.Version; import org.sonar.plugins.php.api.visitors.PHPCustomRuleRepository; import org.sonarsource.analyzer.commons.RuleMetadataLoader; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Objects; -import java.util.Set; +import java.util.*; /** * Extension point to define a PHP rule repository. @@ -39,6 +40,7 @@ public class MyPhpRules implements RulesDefinition, PHPCustomRuleRepository { public static final String LANGUAGE = "php"; public static final String NAME = "Collectif Conception Numérique Responsable"; public static final String RESOURCE_BASE_PATH = "fr/cnumr/l10n/php/rules/custom"; + public static final String DEFAULT_PROFILE_PATH = "fr/cnumr/l10n/php/rules/custom/DefaultProfilePath.json"; public static final String REPOSITORY_KEY = "cnumr-php"; private static final Set RULE_TEMPLATES_KEY = Collections.emptySet(); @@ -56,7 +58,7 @@ public String repositoryKey() { */ @Override public ImmutableList checkClasses() { - + return ImmutableList.of(IncrementCheck.class, AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements.class, AvoidDoubleQuoteCheck.class, AvoidFullSQLRequestCheck.class, AvoidSQLRequestInLoopCheck.class, NoFunctionCallWhenDeclaringForLoop.class); @@ -64,9 +66,11 @@ public ImmutableList checkClasses() { @Override public void define(Context context) { - NewRepository repository = context.createRepository(REPOSITORY_KEY, LANGUAGE).setName(NAME); + NewRepository repository = context.createRepository(repositoryKey(), LANGUAGE).setName(NAME); + + SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(9, 7), SonarQubeSide.SCANNER, SonarEdition.DEVELOPER); - RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader(RESOURCE_BASE_PATH); + RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader(RESOURCE_BASE_PATH,DEFAULT_PROFILE_PATH,sonarRuntime); ruleMetadataLoader.addRulesByAnnotatedClass(repository, new ArrayList<>(checkClasses())); diff --git a/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/DefaultProfilePath.json b/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/DefaultProfilePath.json new file mode 100644 index 000000000..c00983472 --- /dev/null +++ b/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/DefaultProfilePath.json @@ -0,0 +1,3 @@ +{ +"ruleKeys": ["S69"] +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index a588f28ac..7d58a4efe 100644 --- a/pom.xml +++ b/pom.xml @@ -44,24 +44,24 @@ ${encoding} ${encoding} - 8.7.1.42226 - 6.14.0.25463 + 9.4.0.54424 + 7.15.0.30507 cnumr-1 https://sonarcloud.io - 0.8.6 + 0.8.8 - 1.8.0.295 - 3.4.0.7980 - 2.13.0.3107 + 2.1.0.1111 + 3.9.0.9230 + 3.3.0.5166 1.20.0.405 - 5.7.0 - 3.17.2 - 4.12 - 8.7.0.41497 - + 5.9.1 + 3.23.1 + 4.13.2 + 9.7.1.62043 + @@ -167,6 +167,11 @@ sonar-plugin-api compile + + org.sonarsource.sonarqube + sonar-plugin-api-impl + compile + @@ -193,5 +198,5 @@ python-plugin - + diff --git a/python-plugin/pom.xml b/python-plugin/pom.xml index fb176a104..626b81fd2 100644 --- a/python-plugin/pom.xml +++ b/python-plugin/pom.xml @@ -2,7 +2,7 @@ 4.0.0 - + io.ecocode ecocode-parent @@ -39,6 +39,7 @@ org.sonarsource.sonarqube sonar-plugin-api-impl + compile @@ -64,19 +65,19 @@ copy-bundle package - copy + copy - - - ${project.groupId} - ${project.artifactId} - ${project.version} - jar - true - - - ../lib + + + ${project.groupId} + ${project.artifactId} + ${project.version} + jar + true + + + ../lib diff --git a/python-plugin/src/main/java/fr/cnumr/python/CustomPythonRuleRepository.java b/python-plugin/src/main/java/fr/cnumr/python/CustomPythonRuleRepository.java index 67a35ea14..1d8a77c87 100644 --- a/python-plugin/src/main/java/fr/cnumr/python/CustomPythonRuleRepository.java +++ b/python-plugin/src/main/java/fr/cnumr/python/CustomPythonRuleRepository.java @@ -21,14 +21,20 @@ -import fr.cnumr.python.checks.*; +import org.sonar.api.SonarEdition; +import org.sonar.api.SonarQubeSide; +import org.sonar.api.SonarRuntime; +import org.sonar.api.internal.SonarRuntimeImpl; import org.sonar.api.server.rule.RulesDefinition; -import org.sonar.plugins.python.api.PythonCustomRuleRepository; +import org.sonar.api.utils.Version; import org.sonarsource.analyzer.commons.RuleMetadataLoader; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Objects; +import java.util.Set; -public class CustomPythonRuleRepository implements RulesDefinition, PythonCustomRuleRepository { +public class CustomPythonRuleRepository implements RulesDefinition { public static final String LANGUAGE = "py"; public static final String NAME = "Collectif Conception Numérique Responsable"; public static final String RESOURCE_BASE_PATH = "fr/cnumr/l10n/python/rules/python"; @@ -46,29 +52,14 @@ private static void setTemplates(NewRepository repository) { public void define(Context context) { NewRepository repository = context.createRepository(REPOSITORY_KEY, LANGUAGE).setName(NAME); - RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader(RESOURCE_BASE_PATH); + SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(9, 7), SonarQubeSide.SCANNER, SonarEdition.DEVELOPER); - ruleMetadataLoader.addRulesByAnnotatedClass(repository, new ArrayList<>(checkClasses())); + RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader(RESOURCE_BASE_PATH,sonarRuntime); + + ruleMetadataLoader.addRulesByAnnotatedClass(repository, new ArrayList<>(RulesList.getChecks())); setTemplates(repository); repository.done(); } - - @Override - public String repositoryKey() { - return REPOSITORY_KEY; - } - - @Override - public List checkClasses() { - return Arrays.asList( - AvoidGlobalVariableInFunctionCheck.class, - AvoidFullSQLRequest.class, - AvoidSQLRequestInLoop.class, - AvoidTryCatchFinallyCheck.class, - NoFunctionCallWhenDeclaringForLoop.class, - AvoidGettersAndSetters.class - ); - } } diff --git a/python-plugin/src/main/java/fr/cnumr/python/RulesList.java b/python-plugin/src/main/java/fr/cnumr/python/RulesList.java new file mode 100644 index 000000000..ae30ba853 --- /dev/null +++ b/python-plugin/src/main/java/fr/cnumr/python/RulesList.java @@ -0,0 +1,56 @@ +/* + * SonarQube Java + * Copyright (C) 2012-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package fr.cnumr.python; + +import fr.cnumr.python.checks.*; +import org.sonar.plugins.python.api.PythonCheck; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public final class RulesList { + + private RulesList() { + } + + public static List> getChecks() { + List> checks = new ArrayList<>(); + checks.addAll(getPythonChecks()); + checks.addAll(getPythonTestChecks()); + return Collections.unmodifiableList(checks); + } + + public static List> getPythonChecks() { + return Collections.unmodifiableList(Arrays.asList( + AvoidGlobalVariableInFunctionCheck.class, + AvoidFullSQLRequest.class, + AvoidSQLRequestInLoop.class, + AvoidTryCatchFinallyCheck.class, + NoFunctionCallWhenDeclaringForLoop.class, + AvoidGettersAndSetters.class + )); + } + + public static List> getPythonTestChecks() { + return Collections.emptyList(); + } +} diff --git a/python-plugin/src/test/java/fr/cnumr/python/CustomPythonRuleRepositoryTest.java b/python-plugin/src/test/java/fr/cnumr/python/CustomPythonRuleRepositoryTest.java index 391a2f335..32ca1b9e9 100644 --- a/python-plugin/src/test/java/fr/cnumr/python/CustomPythonRuleRepositoryTest.java +++ b/python-plugin/src/test/java/fr/cnumr/python/CustomPythonRuleRepositoryTest.java @@ -22,6 +22,7 @@ import org.junit.Test; import org.sonar.api.server.rule.RulesDefinition; +import static fr.cnumr.python.CustomPythonRuleRepository.REPOSITORY_KEY; import static org.assertj.core.api.Assertions.assertThat; public class CustomPythonRuleRepositoryTest { @@ -31,9 +32,8 @@ public void test_rule_repository() { CustomPythonRuleRepository customPythonRuleRepository = new CustomPythonRuleRepository(); RulesDefinition.Context context = new RulesDefinition.Context(); customPythonRuleRepository.define(context); - assertThat(customPythonRuleRepository.repositoryKey()).isEqualTo(CustomPythonRuleRepository.REPOSITORY_KEY); - assertThat(context.repositories()).hasSize(1).extracting("key").containsExactly(customPythonRuleRepository.repositoryKey()); + assertThat(context.repositories()).hasSize(1).extracting("key").containsExactly(REPOSITORY_KEY); assertThat(context.repositories().get(0).rules()).hasSize(6); - assertThat(customPythonRuleRepository.checkClasses()).hasSize(6); + assertThat(RulesList.getChecks()).hasSize(6); } } From a50345cb06b5958550699e4c49f5b0533301f38d Mon Sep 17 00:00:00 2001 From: Oussama Date: Wed, 14 Dec 2022 14:50:33 +0100 Subject: [PATCH 02/11] Fix format --- docker-compose.yml | 12 +++++----- .../main/java/fr/cnumr/php/MyPhpRules.java | 6 +++-- python-plugin/pom.xml | 22 +++++++++---------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 17e5b12e7..47ef76f59 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,12 +24,12 @@ services: - type: bind source: ./python-plugin/target/ecocode-python-plugin-0.1.0-SNAPSHOT.jar target: /opt/sonarqube/extensions/plugins/ecocode-python-plugin-0.1.0-SNAPSHOT.jar - # - type: bind - # source: ./ecolinter-plugin/target/ecocode-ecolinter-plugin-0.1.0-SNAPSHOT.jar - # target: /opt/sonarqube/extensions/plugins/ecocode-ecolinter-plugin-0.1.0-SNAPSHOT.jar - # - type: bind - # source: ./xml-plugin/target/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar - # target: /opt/sonarqube/extensions/plugins/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar +# - type: bind +# source: ./ecolinter-plugin/target/ecocode-ecolinter-plugin-0.1.0-SNAPSHOT.jar +# target: /opt/sonarqube/extensions/plugins/ecocode-ecolinter-plugin-0.1.0-SNAPSHOT.jar +# - type: bind +# source: ./xml-plugin/target/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar +# target: /opt/sonarqube/extensions/plugins/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar - "extensions:/opt/sonarqube/extensions" - "logs:/opt/sonarqube/logs" - "data:/opt/sonarqube/data" diff --git a/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java b/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java index 04f56192a..01d917c2f 100644 --- a/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java +++ b/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java @@ -30,8 +30,10 @@ import org.sonar.api.utils.Version; import org.sonar.plugins.php.api.visitors.PHPCustomRuleRepository; import org.sonarsource.analyzer.commons.RuleMetadataLoader; -import java.util.*; - +import java.util.ArrayList; +import java.util.Collections; +import java.util.Objects; +import java.util.Set; /** * Extension point to define a PHP rule repository. */ diff --git a/python-plugin/pom.xml b/python-plugin/pom.xml index 626b81fd2..416fefc20 100644 --- a/python-plugin/pom.xml +++ b/python-plugin/pom.xml @@ -65,19 +65,19 @@ copy-bundle package - copy + copy - - - ${project.groupId} - ${project.artifactId} - ${project.version} - jar - true - - - ../lib + + + ${project.groupId} + ${project.artifactId} + ${project.version} + jar + true + + + ../lib From e632eec54d38461e47cdd7832b74c320db0d00c3 Mon Sep 17 00:00:00 2001 From: Oussama Date: Wed, 14 Dec 2022 14:54:15 +0100 Subject: [PATCH 03/11] Fix format --- .../src/main/java/fr/cnumr/java/MyJavaRulesDefinition.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/java-plugin/src/main/java/fr/cnumr/java/MyJavaRulesDefinition.java b/java-plugin/src/main/java/fr/cnumr/java/MyJavaRulesDefinition.java index 34603e01d..c3d9a5878 100644 --- a/java-plugin/src/main/java/fr/cnumr/java/MyJavaRulesDefinition.java +++ b/java-plugin/src/main/java/fr/cnumr/java/MyJavaRulesDefinition.java @@ -65,8 +65,8 @@ public void define(Context context) { private static void setTemplates(NewRepository repository) { RULE_TEMPLATES_KEY.stream() - .map(repository::rule) - .filter(Objects::nonNull) - .forEach(rule -> rule.setTemplate(true)); + .map(repository::rule) + .filter(Objects::nonNull) + .forEach(rule -> rule.setTemplate(true)); } } From 1b9cd4b9bb9588d23a44fa7a08d2d03780679b0d Mon Sep 17 00:00:00 2001 From: Oussama Date: Wed, 14 Dec 2022 17:45:55 +0100 Subject: [PATCH 04/11] Add review changes --- INSTALL.md | 1 + .../main/java/fr/cnumr/php/MyPhpRules.java | 26 +-------- .../src/main/java/fr/cnumr/php/RulesList.java | 55 +++++++++++++++++++ 3 files changed, 59 insertions(+), 23 deletions(-) create mode 100644 php-plugin/src/main/java/fr/cnumr/php/RulesList.java diff --git a/INSTALL.md b/INSTALL.md index 5c1a034fa..f24ef6b95 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -33,6 +33,7 @@ Howto build the SonarQube ecoCode plugins - Java >= 11 - Mvn 3 +- SonarQube 9.4 or higher ### Build the code diff --git a/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java b/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java index 01d917c2f..62e42376e 100644 --- a/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java +++ b/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java @@ -37,7 +37,7 @@ /** * Extension point to define a PHP rule repository. */ -public class MyPhpRules implements RulesDefinition, PHPCustomRuleRepository { +public class MyPhpRules implements RulesDefinition { public static final String LANGUAGE = "php"; public static final String NAME = "Collectif Conception Numérique Responsable"; @@ -46,35 +46,15 @@ public class MyPhpRules implements RulesDefinition, PHPCustomRuleRepository { public static final String REPOSITORY_KEY = "cnumr-php"; private static final Set RULE_TEMPLATES_KEY = Collections.emptySet(); - /** - * Provide the repository key - */ - @Override - public String repositoryKey() { - return REPOSITORY_KEY; - } - - /** - * Provide the list of checks class that implements rules - * to be part of the rule repository - */ - @Override - public ImmutableList checkClasses() { - - return ImmutableList.of(IncrementCheck.class, AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements.class, AvoidDoubleQuoteCheck.class, - AvoidFullSQLRequestCheck.class, AvoidSQLRequestInLoopCheck.class, NoFunctionCallWhenDeclaringForLoop.class); - - } - @Override public void define(Context context) { - NewRepository repository = context.createRepository(repositoryKey(), LANGUAGE).setName(NAME); + NewRepository repository = context.createRepository(REPOSITORY_KEY, LANGUAGE).setName(NAME); SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(9, 7), SonarQubeSide.SCANNER, SonarEdition.DEVELOPER); RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader(RESOURCE_BASE_PATH,DEFAULT_PROFILE_PATH,sonarRuntime); - ruleMetadataLoader.addRulesByAnnotatedClass(repository, new ArrayList<>(checkClasses())); + ruleMetadataLoader.addRulesByAnnotatedClass(repository, new ArrayList<>(RulesList.getChecks())); setTemplates(repository); diff --git a/php-plugin/src/main/java/fr/cnumr/php/RulesList.java b/php-plugin/src/main/java/fr/cnumr/php/RulesList.java new file mode 100644 index 000000000..5c79480c8 --- /dev/null +++ b/php-plugin/src/main/java/fr/cnumr/php/RulesList.java @@ -0,0 +1,55 @@ +/* + * SonarQube Java + * Copyright (C) 2012-2021 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package fr.cnumr.php; + +import fr.cnumr.php.checks.*; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public final class RulesList { + + private RulesList() { + } + + public static List> getChecks() { + List> checks = new ArrayList<>(); + checks.addAll(getPythonChecks()); + checks.addAll(getPythonTestChecks()); + return Collections.unmodifiableList(checks); + } + + public static List> getPythonChecks() { + return Collections.unmodifiableList(Arrays.asList( + IncrementCheck.class, + AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements.class, + AvoidDoubleQuoteCheck.class, + AvoidFullSQLRequestCheck.class, + AvoidSQLRequestInLoopCheck.class, + NoFunctionCallWhenDeclaringForLoop.class + )); + } + + public static List> getPythonTestChecks() { + return Collections.emptyList(); + } +} From 0b8051a6fdf45daf8ff817a08ee1df4497d7a078 Mon Sep 17 00:00:00 2001 From: Oussama Date: Wed, 14 Dec 2022 17:47:53 +0100 Subject: [PATCH 05/11] Fix names --- php-plugin/src/main/java/fr/cnumr/php/RulesList.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/php-plugin/src/main/java/fr/cnumr/php/RulesList.java b/php-plugin/src/main/java/fr/cnumr/php/RulesList.java index 5c79480c8..dee7ecc40 100644 --- a/php-plugin/src/main/java/fr/cnumr/php/RulesList.java +++ b/php-plugin/src/main/java/fr/cnumr/php/RulesList.java @@ -33,12 +33,12 @@ private RulesList() { public static List> getChecks() { List> checks = new ArrayList<>(); - checks.addAll(getPythonChecks()); - checks.addAll(getPythonTestChecks()); + checks.addAll(getPhpChecks()); + checks.addAll(getPhpTestChecks()); return Collections.unmodifiableList(checks); } - public static List> getPythonChecks() { + public static List> getPhpChecks() { return Collections.unmodifiableList(Arrays.asList( IncrementCheck.class, AvoidTryCatchFinallyCheck_NOK_failsAllTryStatements.class, @@ -49,7 +49,7 @@ public static List> getPythonChecks() { )); } - public static List> getPythonTestChecks() { + public static List> getPhpTestChecks() { return Collections.emptyList(); } } From 1d008fdd1b4c9f77df9de24d1991ecee54aed7a1 Mon Sep 17 00:00:00 2001 From: Oussama Date: Fri, 16 Dec 2022 21:19:04 +0100 Subject: [PATCH 06/11] Fix dependency --- java-plugin/pom.xml | 7 ++++++- php-plugin/pom.xml | 10 ++++++++++ php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java | 3 --- pom.xml | 8 +++++--- python-plugin/pom.xml | 3 --- .../l10n/python/rules/python/DefaultProfilePath.json | 3 +++ 6 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 python-plugin/src/main/resources/fr/cnumr/l10n/python/rules/python/DefaultProfilePath.json diff --git a/java-plugin/pom.xml b/java-plugin/pom.xml index 48c0fa7fb..e9eb695b6 100644 --- a/java-plugin/pom.xml +++ b/java-plugin/pom.xml @@ -27,6 +27,11 @@ sonar-plugin-api + + org.sonarsource.sonarqube + sonar-plugin-api-impl + + org.sonarsource.analyzer-commons sonar-analyzer-commons @@ -68,7 +73,7 @@ assertj-core test - + diff --git a/php-plugin/pom.xml b/php-plugin/pom.xml index fd2e31d33..6a96fee9b 100644 --- a/php-plugin/pom.xml +++ b/php-plugin/pom.xml @@ -26,6 +26,16 @@ sonar-plugin-api + + org.sonarsource.sonarqube + sonar-plugin-api-impl + + + + org.sonarsource.analyzer-commons + sonar-analyzer-commons + + junit junit diff --git a/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java b/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java index 62e42376e..3cc9785c2 100644 --- a/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java +++ b/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java @@ -20,15 +20,12 @@ package fr.cnumr.php; -import com.google.common.collect.ImmutableList; -import fr.cnumr.php.checks.*; import org.sonar.api.SonarEdition; import org.sonar.api.SonarQubeSide; import org.sonar.api.SonarRuntime; import org.sonar.api.internal.SonarRuntimeImpl; import org.sonar.api.server.rule.RulesDefinition; import org.sonar.api.utils.Version; -import org.sonar.plugins.php.api.visitors.PHPCustomRuleRepository; import org.sonarsource.analyzer.commons.RuleMetadataLoader; import java.util.ArrayList; import java.util.Collections; diff --git a/pom.xml b/pom.xml index 1b27df628..f27f99481 100644 --- a/pom.xml +++ b/pom.xml @@ -58,8 +58,8 @@ 3.9.0.9230 3.3.0.5166 1.20.0.405 - - 4.13.2 + + 4.13.2 5.9.1 3.23.1 @@ -80,12 +80,14 @@ org.sonarsource.analyzer-commons sonar-analyzer-commons ${sonar-analyzer-commons.version} + compile org.sonarsource.sonarqube sonar-plugin-api-impl ${sonar-plugin-api-impl.version} + compile @@ -190,9 +192,9 @@ + python-plugin java-plugin php-plugin - python-plugin diff --git a/python-plugin/pom.xml b/python-plugin/pom.xml index 7bf34f6f7..e3b9aa96b 100644 --- a/python-plugin/pom.xml +++ b/python-plugin/pom.xml @@ -26,13 +26,10 @@ org.sonarsource.sonarqube sonar-plugin-api - org.sonarsource.sonarqube sonar-plugin-api-impl - compile - org.sonarsource.analyzer-commons sonar-analyzer-commons diff --git a/python-plugin/src/main/resources/fr/cnumr/l10n/python/rules/python/DefaultProfilePath.json b/python-plugin/src/main/resources/fr/cnumr/l10n/python/rules/python/DefaultProfilePath.json new file mode 100644 index 000000000..c00983472 --- /dev/null +++ b/python-plugin/src/main/resources/fr/cnumr/l10n/python/rules/python/DefaultProfilePath.json @@ -0,0 +1,3 @@ +{ +"ruleKeys": ["S69"] +} \ No newline at end of file From 5c7aa5073dead168b69d26f60582e9b9c4213144 Mon Sep 17 00:00:00 2001 From: Oussama Date: Mon, 19 Dec 2022 12:03:32 +0100 Subject: [PATCH 07/11] Fix dependency versions + add maven maven-shade-plugin to shade --- java-plugin/pom.xml | 19 +++++++++++++++++-- php-plugin/pom.xml | 13 +++++++++++++ .../main/java/fr/cnumr/php/MyPhpRules.java | 3 +-- .../php/rules/custom/DefaultProfilePath.json | 3 --- pom.xml | 9 +++++---- python-plugin/pom.xml | 18 +++++++++++++++++- .../rules/python/DefaultProfilePath.json | 3 --- 7 files changed, 53 insertions(+), 15 deletions(-) delete mode 100644 php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/DefaultProfilePath.json delete mode 100644 python-plugin/src/main/resources/fr/cnumr/l10n/python/rules/python/DefaultProfilePath.json diff --git a/java-plugin/pom.xml b/java-plugin/pom.xml index e9eb695b6..5790b5223 100644 --- a/java-plugin/pom.xml +++ b/java-plugin/pom.xml @@ -88,8 +88,23 @@ fr.cnumr.java.MyJavaRulesPlugin true ${sonarqube.version} - java:${sonarjava.version} - + + + + java + + + org.apache.maven.plugins + maven-shade-plugin + ${maven-shade-plugin.version} + + + package + + shade + + + org.jacoco diff --git a/php-plugin/pom.xml b/php-plugin/pom.xml index 6a96fee9b..687a8ef63 100644 --- a/php-plugin/pom.xml +++ b/php-plugin/pom.xml @@ -59,6 +59,19 @@ php + + org.apache.maven.plugins + maven-shade-plugin + ${maven-shade-plugin.version} + + + package + + shade + + + + org.apache.maven.plugins maven-dependency-plugin diff --git a/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java b/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java index 3cc9785c2..aa3bf8ba7 100644 --- a/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java +++ b/php-plugin/src/main/java/fr/cnumr/php/MyPhpRules.java @@ -39,7 +39,6 @@ public class MyPhpRules implements RulesDefinition { public static final String LANGUAGE = "php"; public static final String NAME = "Collectif Conception Numérique Responsable"; public static final String RESOURCE_BASE_PATH = "fr/cnumr/l10n/php/rules/custom"; - public static final String DEFAULT_PROFILE_PATH = "fr/cnumr/l10n/php/rules/custom/DefaultProfilePath.json"; public static final String REPOSITORY_KEY = "cnumr-php"; private static final Set RULE_TEMPLATES_KEY = Collections.emptySet(); @@ -49,7 +48,7 @@ public void define(Context context) { SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(9, 7), SonarQubeSide.SCANNER, SonarEdition.DEVELOPER); - RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader(RESOURCE_BASE_PATH,DEFAULT_PROFILE_PATH,sonarRuntime); + RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader(RESOURCE_BASE_PATH,sonarRuntime); ruleMetadataLoader.addRulesByAnnotatedClass(repository, new ArrayList<>(RulesList.getChecks())); diff --git a/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/DefaultProfilePath.json b/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/DefaultProfilePath.json deleted file mode 100644 index c00983472..000000000 --- a/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/DefaultProfilePath.json +++ /dev/null @@ -1,3 +0,0 @@ -{ -"ruleKeys": ["S69"] -} \ No newline at end of file diff --git a/pom.xml b/pom.xml index f27f99481..e894618fd 100644 --- a/pom.xml +++ b/pom.xml @@ -55,10 +55,11 @@ 9.7.1.62043 2.1.0.1111 - 3.9.0.9230 - 3.3.0.5166 - 1.20.0.405 - + 3.19.0.10254 + 3.25.0.9077 + 1.21.0.505 + true + 3.4.1 4.13.2 5.9.1 3.23.1 diff --git a/python-plugin/pom.xml b/python-plugin/pom.xml index e3b9aa96b..a74bc305e 100644 --- a/python-plugin/pom.xml +++ b/python-plugin/pom.xml @@ -61,9 +61,25 @@ fr.cnumr.python.CustomPythonRulesPlugin true ${sonarqube.version} - python:${sonar.python.version} + + + + python + + org.apache.maven.plugins + maven-shade-plugin + ${maven-shade-plugin.version} + + + package + + shade + + + + org.apache.maven.plugins maven-dependency-plugin diff --git a/python-plugin/src/main/resources/fr/cnumr/l10n/python/rules/python/DefaultProfilePath.json b/python-plugin/src/main/resources/fr/cnumr/l10n/python/rules/python/DefaultProfilePath.json deleted file mode 100644 index c00983472..000000000 --- a/python-plugin/src/main/resources/fr/cnumr/l10n/python/rules/python/DefaultProfilePath.json +++ /dev/null @@ -1,3 +0,0 @@ -{ -"ruleKeys": ["S69"] -} \ No newline at end of file From 453f6a883b13371669fd26b313b4819af152f86c Mon Sep 17 00:00:00 2001 From: Oussama Date: Mon, 19 Dec 2022 15:22:11 +0100 Subject: [PATCH 08/11] Format code --- java-plugin/pom.xml | 23 ++++++++++++----------- php-plugin/pom.xml | 20 ++++++++++---------- python-plugin/pom.xml | 22 +++++++++++----------- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/java-plugin/pom.xml b/java-plugin/pom.xml index 5790b5223..526aa4a73 100644 --- a/java-plugin/pom.xml +++ b/java-plugin/pom.xml @@ -91,7 +91,8 @@ - java + java + org.apache.maven.plugins @@ -136,15 +137,15 @@ copy - - - ${project.groupId} - ${project.artifactId} - ${project.version} - jar - true - - + + + ${project.groupId} + ${project.artifactId} + ${project.version} + jar + true + + ../lib @@ -153,7 +154,7 @@ copy test-compile - copy + copy diff --git a/php-plugin/pom.xml b/php-plugin/pom.xml index 687a8ef63..ea9b0b699 100644 --- a/php-plugin/pom.xml +++ b/php-plugin/pom.xml @@ -83,16 +83,16 @@ copy - - - ${project.groupId} - ${project.artifactId} - ${project.version} - jar - true - - - ../lib + + + ${project.groupId} + ${project.artifactId} + ${project.version} + jar + true + + + ../lib diff --git a/python-plugin/pom.xml b/python-plugin/pom.xml index a74bc305e..751fd1348 100644 --- a/python-plugin/pom.xml +++ b/python-plugin/pom.xml @@ -88,19 +88,19 @@ copy-bundle package - copy + copy - - - ${project.groupId} - ${project.artifactId} - ${project.version} - jar - true - - - ../lib + + + ${project.groupId} + ${project.artifactId} + ${project.version} + jar + true + + + ../lib From 3765f2baaad1ae253d4493e313e04258da0832ff Mon Sep 17 00:00:00 2001 From: Oussama Date: Tue, 20 Dec 2022 11:25:59 +0100 Subject: [PATCH 09/11] Add images to the description files. --- common/images/php/s72_percent_comparison.jpg | Bin 0 -> 13269 bytes docker-compose.yml | 3 +++ .../fr/cnumr/l10n/php/rules/custom/S72.html | 3 +++ 3 files changed, 6 insertions(+) create mode 100644 common/images/php/s72_percent_comparison.jpg diff --git a/common/images/php/s72_percent_comparison.jpg b/common/images/php/s72_percent_comparison.jpg new file mode 100644 index 0000000000000000000000000000000000000000..74b339a1b0d89680fc4d708fff37e0e98e5769a6 GIT binary patch literal 13269 zcmb_@2RN7i`|l${$PP(JLWqcr>`}-l2_ai{_THN!B*}=ZkiBK^$d;WQ5wiC@_w)Uq z>wkX#>zs3)-#OR0t|rgt^Ld{4`+nc|YYBOz_~0TQH6DT>7iDFnlo13Y0{-2Giw%Fa zUMio3zXa^1)$N~Hy|8!Evo%5#^z5xItn4jJ_30grZ0$^~Uf$v0<=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h23^@ z?5E(6MaVEd${uWkz|%K6FZP_}{&akM!K`N9XR!n=6Xq29)YbyOACA(%B0nAt*Z~GuN|30wjFEc1eX-6qJ`g0Q%I}*ofMS z1edw71Ox=E?d_ZEeK7Svp@6-?0OQ>U3_B1u3Lz=TO4mG48jSy0 zcI!pwhihrj($FkCjP2~ExWWt)k_Px6q)I^%kwjfo<_et6cNLJDhV{S#3l^+T-Kkm+ zs@uBW1*gFCMj%86N!%U5oEvU&G@_m~POIbMHa1)kY```*U(P6V`ktsjBbG=y@5IAK zjwc_>eICSwAjoMUx?OR+C@hAV&!*MVl&Aw>6-vG?QSTO(q literal 0 HcmV?d00001 diff --git a/docker-compose.yml b/docker-compose.yml index 47ef76f59..88d685d20 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,6 +30,9 @@ services: # - type: bind # source: ./xml-plugin/target/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar # target: /opt/sonarqube/extensions/plugins/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar + - type: bind + source: common + target: /opt/sonarqube/common - "extensions:/opt/sonarqube/extensions" - "logs:/opt/sonarqube/logs" - "data:/opt/sonarqube/data" diff --git a/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/S72.html b/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/S72.html index 3b51bdc50..bb3aa530f 100644 --- a/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/S72.html +++ b/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/S72.html @@ -1,4 +1,7 @@

Executing SQL queries in loop induced unnecessary calculation by the cpu, RAM usage and network transfert.

+ETSdiff percent comparison +

Noncompliant Code Example

     public function foo() {

From b2012a74997b09e670f115932789ba7c0b661372 Mon Sep 17 00:00:00 2001
From: Oussama 
Date: Tue, 20 Dec 2022 11:45:04 +0100
Subject: [PATCH 10/11] Revert "Add images to the description files."

This reverts commit 3765f2baaad1ae253d4493e313e04258da0832ff.
---
 common/images/php/s72_percent_comparison.jpg    | Bin 13269 -> 0 bytes
 docker-compose.yml                              |   3 ---
 .../fr/cnumr/l10n/php/rules/custom/S72.html     |   3 ---
 3 files changed, 6 deletions(-)
 delete mode 100644 common/images/php/s72_percent_comparison.jpg

diff --git a/common/images/php/s72_percent_comparison.jpg b/common/images/php/s72_percent_comparison.jpg
deleted file mode 100644
index 74b339a1b0d89680fc4d708fff37e0e98e5769a6..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001

literal 13269
zcmb_@2RN7i`|l${$PP(JLWqcr>`}-l2_ai{_THN!B*}=ZkiBK^$d;WQ5wiC@_w)Uq
z>wkX#>zs3)-#OR0t|rgt^Ld{4`+nc|YYBOz_~0TQH6DT>7iDFnlo13Y0{-2Giw%Fa
zUMio3zXa^1)$N~Hy|8!Evo%5#^z5xItn4jJ_30grZ0$^~Uf$v0<=|qcH?g<3wiD#!
zwEWKtIIL`qIY;z1Yv4^TSj#-KLl7c8^fyMPXoe|*+>wx#5?66f_&edEr80ktv)*$X
z^G-c`y?4=tRDBlT**rs^KsK}4_ijr{*K@0*-L&m)+R6U?5ehyrs|^#k61IdEVr^>S&xD2G;NW^HgHU0n
z?8-dEAhhr>1QXXFl&jbp(F^5zK|x3#%GKK0h~dxG`r#SB_w81yJNP)ntyBgtW{^fI
zgHCoDF?e-s!2jt*4{HeNJU2y|rOI=>
zdcRu3OeU*c0_;UaMfdmjKRK;UN{s#eS#Y
z9K?OQ@4^1*(b`5A-_$45AD^vlZCzJ36L0kO_3h8T=Hw4nkyKZwnw_1U{{35Z_^Dn`
zh%tlr{?SpY$I)(d-V@g7_3dqP?U*yct<6n|h3=0En-mljvvg{VpCKmB1rX=%$(tGegcYTz@ec+K8DGaBS!ka+x<#KO{Yxso*p
zFCZWwqTSHi#>VIM>xa+Pf`lI|?GURfboBHDY3Ju}QYJ)4o7zoOI^Z`2Ui6bl_LfU;
zG|#UI+}_^C`zg%te}gonK(7g#oPq*R(qz7g=)oJBhQVw#g}|9FD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YJn#i4f?cbEn2?YVPM0^JRz}hgYlaaRJygtfPHVKmZHBBCkoB8c
zg9g+1?Hfu#_u(WZ|M;^G{Z{k%L-wyz*K=YjD&%8jmTWY8;5P#lzL}H%r3Qi)gnkX)
zK+Q^^SA1uF@;N;n&09B~UZtUlNJ2-dyz{gg*qZ1;}#aKX)Lw|^yOdoqrbm5^#M_G
z*!?i-fY8uTW)aoa)o&Qh67byuR7d;tL|vW5U3~nEfXvv~7-Hh%wH}%>RW4hf+fUKg
zz&q-q=AVfB{*x_&cSp-0`*Z0x<3c)w9MWEG?d{^QeqVOp34)04zSYGiqoni=qG9V}
z=J~M+N~{Zz>H#tvUt$h`P#atryqzq3U{Xz}q4cLe9nZnW$>|&Tiay7)V5PbO4>_esX^`9Lf)4+WEu3jt{mjdHN91iO`&#?$yCmAq=Gv=%3x;gJd@(
za|?Sh!OC|i_1ak-EyjVs6J+usL5eBG@Ho9ecdjjRA9}OR(!fosu={iK^LoJEcwK42
z(Ktbp$8K!z>wS<2Ag|^LIb4#9)I4HlW?v%8f$Ou}yx9PXgzjys0=K=FT2+o0h23^@
z?5E(6MaVEd${uWkz|%K6FZP_}{&akM!K`N9XR!n=6Xq29)YbyOACA(%B0nAt*Z~GuN|30wjFEc1eX-6qJ`g0Q%I}*ofMS
z1edw71Ox=E?d_ZEeK7Svp@6-?0OQ>U3_B1u3Lz=TO4mG48jSy0
zcI!pwhihrj($FkCjP2~ExWWt)k_Px6q)I^%kwjfo<_et6cNLJDhV{S#3l^+T-Kkm+
zs@uBW1*gFCMj%86N!%U5oEvU&G@_m~POIbMHa1)kY```*U(P6V`ktsjBbG=y@5IAK
zjwc_>eICSwAjoMUx?OR+C@hAV&!*MVl&Aw>6-vG?QSTO(q

diff --git a/docker-compose.yml b/docker-compose.yml
index 88d685d20..47ef76f59 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -30,9 +30,6 @@ services:
 #     - type: bind
 #       source: ./xml-plugin/target/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar
 #       target: /opt/sonarqube/extensions/plugins/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar
-      - type: bind
-        source: common
-        target: /opt/sonarqube/common
       - "extensions:/opt/sonarqube/extensions"
       - "logs:/opt/sonarqube/logs"
       - "data:/opt/sonarqube/data"
diff --git a/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/S72.html b/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/S72.html
index bb3aa530f..3b51bdc50 100644
--- a/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/S72.html
+++ b/php-plugin/src/main/resources/fr/cnumr/l10n/php/rules/custom/S72.html
@@ -1,7 +1,4 @@
 

Executing SQL queries in loop induced unnecessary calculation by the cpu, RAM usage and network transfert.

-ETSdiff percent comparison -

Noncompliant Code Example

     public function foo() {

From 9338329809782fd0d23f98659f9032146f17d21f Mon Sep 17 00:00:00 2001
From: Oussama 
Date: Fri, 23 Dec 2022 09:50:40 +0100
Subject: [PATCH 11/11] New review fix

---
 .gitignore            | 1 +
 INSTALL.md            | 2 +-
 docker-compose.yml    | 8 +-------
 java-plugin/pom.xml   | 1 -
 php-plugin/pom.xml    | 1 -
 pom.xml               | 7 +++++--
 python-plugin/pom.xml | 1 -
 7 files changed, 8 insertions(+), 13 deletions(-)

diff --git a/.gitignore b/.gitignore
index f83f86ce0..ed3d4a52d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@ target
 *.iml
 lib/*.jar
 bin
+dependency-reduced-pom.xml
diff --git a/INSTALL.md b/INSTALL.md
index 3f43217a5..2703f56fa 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -33,7 +33,7 @@ Howto build the SonarQube ecoCode plugins
 
 - Java >= 11.0.17
 - Mvn 3
-- SonarQube 9.4 or higher
+- SonarQube 9.4 to 9.8
 
 ### Build the code
 
diff --git a/docker-compose.yml b/docker-compose.yml
index 47ef76f59..f8fed2f92 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,7 +1,7 @@
 version: "3.3"
 services:
   sonar:
-    image: sonarqube:9.7-community
+    image: sonarqube:9.8-community
     container_name: sonar_standard
     ports:
       - "9000:9000"
@@ -24,12 +24,6 @@ services:
       - type: bind
         source: ./python-plugin/target/ecocode-python-plugin-0.1.0-SNAPSHOT.jar
         target: /opt/sonarqube/extensions/plugins/ecocode-python-plugin-0.1.0-SNAPSHOT.jar
-#     - type: bind
-#       source: ./ecolinter-plugin/target/ecocode-ecolinter-plugin-0.1.0-SNAPSHOT.jar
-#       target: /opt/sonarqube/extensions/plugins/ecocode-ecolinter-plugin-0.1.0-SNAPSHOT.jar
-#     - type: bind
-#       source: ./xml-plugin/target/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar
-#       target: /opt/sonarqube/extensions/plugins/ecocode-xml-plugin-0.1.0-SNAPSHOT.jar
       - "extensions:/opt/sonarqube/extensions"
       - "logs:/opt/sonarqube/logs"
       - "data:/opt/sonarqube/data"
diff --git a/java-plugin/pom.xml b/java-plugin/pom.xml
index 526aa4a73..b8f1bdf77 100644
--- a/java-plugin/pom.xml
+++ b/java-plugin/pom.xml
@@ -97,7 +97,6 @@
             
                 org.apache.maven.plugins
                 maven-shade-plugin
-                ${maven-shade-plugin.version}
                 
                     
                         package
diff --git a/php-plugin/pom.xml b/php-plugin/pom.xml
index ea9b0b699..c96396dd5 100644
--- a/php-plugin/pom.xml
+++ b/php-plugin/pom.xml
@@ -62,7 +62,6 @@
             
                 org.apache.maven.plugins
                 maven-shade-plugin
-                ${maven-shade-plugin.version}
                 
                     
                         package
diff --git a/pom.xml b/pom.xml
index e894618fd..808d63c14 100644
--- a/pom.xml
+++ b/pom.xml
@@ -81,14 +81,12 @@
 				org.sonarsource.analyzer-commons
 				sonar-analyzer-commons
 				${sonar-analyzer-commons.version}
-				compile
 			
 
 			
 				org.sonarsource.sonarqube
 				sonar-plugin-api-impl
 				${sonar-plugin-api-impl.version}
-				compile
 			
 
 			
@@ -182,6 +180,11 @@
 					sonar-packaging-maven-plugin
 					${sonar-packaging.version}
 				
+				
+				org.apache.maven.plugins
+				maven-shade-plugin
+				${maven-shade-plugin.version}
+				
 				
 					org.jacoco
 					jacoco-maven-plugin
diff --git a/python-plugin/pom.xml b/python-plugin/pom.xml
index 751fd1348..43afc307b 100644
--- a/python-plugin/pom.xml
+++ b/python-plugin/pom.xml
@@ -70,7 +70,6 @@
             
                 org.apache.maven.plugins
                 maven-shade-plugin
-                ${maven-shade-plugin.version}
                 
                     
                         package