From 8f32648b3cc148c8054607e3c26bc86e7c3746b4 Mon Sep 17 00:00:00 2001 From: alograg Date: Wed, 17 Jan 2024 17:06:39 +0100 Subject: [PATCH 1/8] fix: :bug: Fix issues #228 #233 #235 #240 --- docker-compose.yml | 4 +- pom.xml | 2 +- .../java/JavaCheckRegistrar.java | 8 - .../checks/AvoidConcatenateStringsInLoop.java | 84 ------- .../AvoidUsingGlobalVariablesCheck.java | 66 ------ .../UnnecessarilyAssignValuesToVariables.java | 217 ------------------ .../java/checks/UseCorrectForLoop.java | 54 ----- .../files/AvoidConcatenateStringsInLoop.java | 49 ---- .../files/AvoidUsingGlobalVariablesCheck.java | 37 --- ...arilyAssignValuesToVariablesTestCheck.java | 95 -------- ...esToVariablesTestCheckWithEmptyReturn.java | 33 --- src/test/files/UseCorrectForLoopCheck.java | 41 ---- .../AvoidConcatenateStringsInLoopTest.java | 42 ---- ...oidUsingGlobalVariablesCheckCheckTest.java | 34 --- ...ecessarilyAssignValuesToVariablesTest.java | 42 ---- .../java/checks/UseCorrectLoopCheckTest.java | 34 --- 16 files changed, 3 insertions(+), 839 deletions(-) delete mode 100644 src/main/java/fr/greencodeinitiative/java/checks/AvoidConcatenateStringsInLoop.java delete mode 100644 src/main/java/fr/greencodeinitiative/java/checks/AvoidUsingGlobalVariablesCheck.java delete mode 100644 src/main/java/fr/greencodeinitiative/java/checks/UnnecessarilyAssignValuesToVariables.java delete mode 100644 src/main/java/fr/greencodeinitiative/java/checks/UseCorrectForLoop.java delete mode 100644 src/test/files/AvoidConcatenateStringsInLoop.java delete mode 100644 src/test/files/AvoidUsingGlobalVariablesCheck.java delete mode 100644 src/test/files/UnnecessarilyAssignValuesToVariablesTestCheck.java delete mode 100644 src/test/files/UnnecessarilyAssignValuesToVariablesTestCheckWithEmptyReturn.java delete mode 100644 src/test/files/UseCorrectForLoopCheck.java delete mode 100644 src/test/java/fr/greencodeinitiative/java/checks/AvoidConcatenateStringsInLoopTest.java delete mode 100644 src/test/java/fr/greencodeinitiative/java/checks/AvoidUsingGlobalVariablesCheckCheckTest.java delete mode 100644 src/test/java/fr/greencodeinitiative/java/checks/UnnecessarilyAssignValuesToVariablesTest.java delete mode 100644 src/test/java/fr/greencodeinitiative/java/checks/UseCorrectLoopCheckTest.java diff --git a/docker-compose.yml b/docker-compose.yml index 1782b70..bd44653 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,8 +16,8 @@ services: SONAR_ES_BOOTSTRAP_CHECKS_DISABLE: 'true' volumes: - type: bind - source: ./target/ecocode-java-plugin-1.5.1-SNAPSHOT.jar - target: /opt/sonarqube/extensions/plugins/ecocode-java-plugin-1.5.1-SNAPSHOT.jar + source: ./target/ecocode-java-plugin-1.5.2-SNAPSHOT.jar + target: /opt/sonarqube/extensions/plugins/ecocode-java-plugin-1.5.2-SNAPSHOT.jar - "extensions:/opt/sonarqube/extensions" - "logs:/opt/sonarqube/logs" - "data:/opt/sonarqube/data" diff --git a/pom.xml b/pom.xml index 25a26bf..dac51ea 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ io.ecocode ecocode-java-plugin - 1.5.1-SNAPSHOT + 1.5.2-SNAPSHOT sonar-plugin diff --git a/src/main/java/fr/greencodeinitiative/java/JavaCheckRegistrar.java b/src/main/java/fr/greencodeinitiative/java/JavaCheckRegistrar.java index f972a20..f4ef343 100644 --- a/src/main/java/fr/greencodeinitiative/java/JavaCheckRegistrar.java +++ b/src/main/java/fr/greencodeinitiative/java/JavaCheckRegistrar.java @@ -21,7 +21,6 @@ import java.util.List; import fr.greencodeinitiative.java.checks.ArrayCopyCheck; -import fr.greencodeinitiative.java.checks.AvoidConcatenateStringsInLoop; import fr.greencodeinitiative.java.checks.AvoidFullSQLRequest; import fr.greencodeinitiative.java.checks.AvoidGettingSizeCollectionInLoop; import fr.greencodeinitiative.java.checks.AvoidMultipleIfElseStatement; @@ -31,14 +30,11 @@ import fr.greencodeinitiative.java.checks.AvoidSpringRepositoryCallInLoopOrStreamCheck; import fr.greencodeinitiative.java.checks.AvoidStatementForDMLQueries; import fr.greencodeinitiative.java.checks.AvoidUsageOfStaticCollections; -import fr.greencodeinitiative.java.checks.AvoidUsingGlobalVariablesCheck; import fr.greencodeinitiative.java.checks.FreeResourcesOfAutoCloseableInterface; import fr.greencodeinitiative.java.checks.IncrementCheck; import fr.greencodeinitiative.java.checks.InitializeBufferWithAppropriateSize; import fr.greencodeinitiative.java.checks.NoFunctionCallWhenDeclaringForLoop; import fr.greencodeinitiative.java.checks.OptimizeReadFileExceptions; -import fr.greencodeinitiative.java.checks.UnnecessarilyAssignValuesToVariables; -import fr.greencodeinitiative.java.checks.UseCorrectForLoop; import org.sonar.plugins.java.api.CheckRegistrar; import org.sonar.plugins.java.api.JavaCheck; import org.sonarsource.api.sonarlint.SonarLintSide; @@ -54,7 +50,6 @@ public class JavaCheckRegistrar implements CheckRegistrar { private static final List> ANNOTATED_RULE_CLASSES = List.of( ArrayCopyCheck.class, IncrementCheck.class, - AvoidConcatenateStringsInLoop.class, AvoidUsageOfStaticCollections.class, AvoidGettingSizeCollectionInLoop.class, AvoidRegexPatternNotStatic.class, @@ -63,11 +58,8 @@ public class JavaCheckRegistrar implements CheckRegistrar { AvoidSpringRepositoryCallInLoopOrStreamCheck.class, AvoidSQLRequestInLoop.class, AvoidFullSQLRequest.class, - UseCorrectForLoop.class, - UnnecessarilyAssignValuesToVariables.class, OptimizeReadFileExceptions.class, InitializeBufferWithAppropriateSize.class, - AvoidUsingGlobalVariablesCheck.class, AvoidSetConstantInBatchUpdate.class, FreeResourcesOfAutoCloseableInterface.class, AvoidMultipleIfElseStatement.class diff --git a/src/main/java/fr/greencodeinitiative/java/checks/AvoidConcatenateStringsInLoop.java b/src/main/java/fr/greencodeinitiative/java/checks/AvoidConcatenateStringsInLoop.java deleted file mode 100644 index 488ebd0..0000000 --- a/src/main/java/fr/greencodeinitiative/java/checks/AvoidConcatenateStringsInLoop.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs - * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package fr.greencodeinitiative.java.checks; - -import java.util.Arrays; -import java.util.List; -import javax.annotation.Nonnull; - -import org.sonar.check.Rule; -import org.sonar.plugins.java.api.IssuableSubscriptionVisitor; -import org.sonar.plugins.java.api.tree.AssignmentExpressionTree; -import org.sonar.plugins.java.api.tree.BaseTreeVisitor; -import org.sonar.plugins.java.api.tree.BinaryExpressionTree; -import org.sonar.plugins.java.api.tree.ExpressionTree; -import org.sonar.plugins.java.api.tree.Tree; -import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; - -/** - * @deprecated because not useless since JDK 8 - */ -@Deprecated(forRemoval = true) -@Rule(key = "EC75") -@DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S75") -public class AvoidConcatenateStringsInLoop extends IssuableSubscriptionVisitor { - - public static final String MESSAGE_RULE = "Don't concatenate Strings in loop, use StringBuilder instead."; - private static final String STRING_CLASS = String.class.getName(); - - private final StringConcatenationVisitor visitor = new StringConcatenationVisitor(); - - @Override - public List nodesToVisit() { - return Arrays.asList( - Tree.Kind.FOR_STATEMENT, - Tree.Kind.FOR_EACH_STATEMENT, - Tree.Kind.WHILE_STATEMENT - ); - } - - @Override - public void visitNode(@Nonnull Tree tree) { - tree.accept(visitor); - } - - private class StringConcatenationVisitor extends BaseTreeVisitor { - @Override - public void visitBinaryExpression(BinaryExpressionTree tree) { - if (tree.is(Tree.Kind.PLUS) && isStringType(tree.leftOperand())) { - reportIssue(tree, MESSAGE_RULE); - } else { - super.visitBinaryExpression(tree); - } - } - - @Override - public void visitAssignmentExpression(AssignmentExpressionTree tree) { - if (tree.is(Tree.Kind.PLUS_ASSIGNMENT) && isStringType(tree.variable())) { - reportIssue(tree, MESSAGE_RULE); - } else { - super.visitAssignmentExpression(tree); - } - } - - private boolean isStringType(ExpressionTree expressionTree) { - return expressionTree.symbolType().is(STRING_CLASS); - } - } - -} diff --git a/src/main/java/fr/greencodeinitiative/java/checks/AvoidUsingGlobalVariablesCheck.java b/src/main/java/fr/greencodeinitiative/java/checks/AvoidUsingGlobalVariablesCheck.java deleted file mode 100644 index 26a6dbd..0000000 --- a/src/main/java/fr/greencodeinitiative/java/checks/AvoidUsingGlobalVariablesCheck.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs - * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package fr.greencodeinitiative.java.checks; - -import com.google.re2j.Pattern; -import org.sonar.check.Rule; -import org.sonar.plugins.java.api.IssuableSubscriptionVisitor; -import org.sonar.plugins.java.api.tree.Tree; -import org.sonar.plugins.java.api.tree.Tree.Kind; -import org.sonar.plugins.java.api.tree.VariableTree; -import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; - -import java.util.Arrays; -import java.util.List; - -/** - * Check to avoid using global variables. - * - * @deprecated because not applicable to Java language, to be removed soon - */ -@Deprecated(forRemoval = true) -@Rule(key = "EC4") -@DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "D4") -public class AvoidUsingGlobalVariablesCheck extends IssuableSubscriptionVisitor { - - private static final String ERROR_MESSAGE = "Avoid using global variables"; - private static final Pattern PATTERN = Pattern.compile("^.*(static).*$", Pattern.CASE_INSENSITIVE); - - @Override - public List nodesToVisit() { - return Arrays.asList(Kind.STATIC_INITIALIZER, Kind.VARIABLE, Kind.METHOD); - } - - @Override - public void visitNode(Tree tree) { - if (tree.is(Kind.STATIC_INITIALIZER)) { - reportIssue(tree, String.format(ERROR_MESSAGE, tree)); - } - if (tree.is(Kind.VARIABLE)) { - VariableTree variableTree = (VariableTree) tree; - int modifiersSize = (variableTree).modifiers().modifiers().size(); - for (int i = 0; i < modifiersSize; i++) { - String modifier = ((VariableTree) tree).modifiers().modifiers().get(i).modifier().toString(); - if (PATTERN.matcher(modifier).matches()) { - reportIssue(tree, String.format(ERROR_MESSAGE, modifier)); - } - } - } - } - -} diff --git a/src/main/java/fr/greencodeinitiative/java/checks/UnnecessarilyAssignValuesToVariables.java b/src/main/java/fr/greencodeinitiative/java/checks/UnnecessarilyAssignValuesToVariables.java deleted file mode 100644 index aba735b..0000000 --- a/src/main/java/fr/greencodeinitiative/java/checks/UnnecessarilyAssignValuesToVariables.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs - * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package fr.greencodeinitiative.java.checks; - -import org.sonar.check.Rule; -import org.sonar.plugins.java.api.JavaFileScanner; -import org.sonar.plugins.java.api.JavaFileScannerContext; -import org.sonar.plugins.java.api.tree.*; -import org.sonar.plugins.java.api.tree.Tree.Kind; -import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; - -import javax.annotation.CheckForNull; -import java.util.*; - -/** - * @deprecated not applicable because of existing Sonarqube native rules : - * - unused variable : https://rules.sonarsource.com/java/tag/unused/RSPEC-1481/ - * - useless assignment : https://rules.sonarsource.com/java/tag/unused/RSPEC-1854 - * - immediately return : https://rules.sonarsource.com/java/RSPEC-1488/ - */ -@Deprecated(forRemoval = true) -@Rule(key = "EC63") -@DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S63") -public class UnnecessarilyAssignValuesToVariables extends BaseTreeVisitor implements JavaFileScanner { - - protected static final String MESSAGERULE1 = "The variable is declared but not really used"; - protected static final String MESSAGERULE2 = "Immediately throw this expression instead of assigning it to the temporary variable"; - protected static final String MESSAGERULE3 = "Immediately return this expression instead of assigning it to the temporary variable"; - private JavaFileScannerContext context; - private String errorMessage; - private final Map variableList = new HashMap<>(); - private static final Map> linesWithIssuesByVariable = new HashMap<>(); - - @Override - public void scanFile(JavaFileScannerContext context) { - this.context = context; - scan(context.getTree()); - } - - @Override - public void visitBlock(BlockTree tree) { - GetVariableVisitor getVariableVisitor = new GetVariableVisitor(); - CheckUseVariableVisitor checkVariable = new CheckUseVariableVisitor(); - super.visitBlock(tree); - checkImmediatelyReturnedVariable(tree); - tree.accept(getVariableVisitor); - tree.accept(checkVariable); - - variableList.forEach(this::reportIfUnknow); - variableList.clear(); - } - - private void reportIfUnknow(String name, Tree tree) { - Integer issueLine = tree.firstToken().range().start().line(); - - if (!(linesWithIssuesByVariable.containsKey(name) && linesWithIssuesByVariable.get(name).contains(issueLine))) { - if (!linesWithIssuesByVariable.containsKey(name)) { - linesWithIssuesByVariable.put(name, new ArrayList<>()); - } - - linesWithIssuesByVariable.get(name).add(issueLine); - - context.reportIssue(this, tree, MESSAGERULE1); - } - } - - private class GetVariableVisitor extends BaseTreeVisitor { - @Override - public void visitVariable(VariableTree tree) { - if (!tree.parent().is(Kind.METHOD)) { - variableList.put(tree.simpleName().name(), tree); - } - super.visitVariable(tree); - } - } - - private class CheckUseVariableVisitor extends BaseTreeVisitor { - - @Override - public void visitIfStatement(IfStatementTree tree) { - variableList.remove(tree.condition().toString()); - super.visitIfStatement(tree); - } - - @Override - public void visitUnaryExpression(UnaryExpressionTree tree) { - variableList.remove(tree.expression().toString()); - super.visitUnaryExpression(tree); - } - - @Override - public void visitForEachStatement(ForEachStatement tree) { - variableList.remove(tree.expression().toString()); - super.visitForEachStatement(tree); - } - - @Override - public void visitMethodInvocation(MethodInvocationTree tree) { - tree.arguments().forEach(e -> { - if (variableList.containsKey(e.toString())) { - variableList.remove(e.toString()); - } - }); - super.visitMethodInvocation(tree); - } - - @Override - public void visitMemberSelectExpression(MemberSelectExpressionTree tree) { - variableList.remove(tree.expression().toString()); - super.visitMemberSelectExpression(tree); - } - - @Override - public void visitTypeCast(TypeCastTree tree) { - variableList.remove(tree.expression().toString()); - super.visitTypeCast(tree); - } - - @Override - public void visitBinaryExpression(BinaryExpressionTree tree) { - if (!tree.operatorToken().is(Kind.ASSIGNMENT)) { - variableList.remove(tree.leftOperand().toString()); - } - variableList.remove(tree.rightOperand().toString()); - super.visitBinaryExpression(tree); - } - - @Override - public void visitNewClass(NewClassTree tree) { - tree.arguments().forEach(e -> { - if (variableList.containsKey(e.toString())) { - variableList.remove(e.toString()); - } - }); - super.visitNewClass(tree); - } - - @Override - public void visitReturnStatement(ReturnStatementTree tree) { - if (tree != null) { - if (tree.expression() != null) { - variableList.remove(tree.expression().toString()); - } - super.visitReturnStatement(tree); - } - } - - @Override - public void visitThrowStatement(ThrowStatementTree tree) { - variableList.remove(tree.expression().toString()); - super.visitThrowStatement(tree); - } - - @Override - public void visitAssignmentExpression(AssignmentExpressionTree tree) { - variableList.remove(tree.expression().toString()); - super.visitAssignmentExpression(tree); - } - - } - - private void checkImmediatelyReturnedVariable(BlockTree tree) { - List statements = tree.body(); - int size = statements.size(); - if (size < 2) { - return; - } - StatementTree butLastStatement = statements.get(size - 2); - if (butLastStatement.is(Kind.VARIABLE)) { - VariableTree variableTree = (VariableTree) butLastStatement; - if (!variableTree.modifiers().annotations().isEmpty()) { - return; - } - StatementTree lastStatement = statements.get(size - 1); - String lastStatementIdentifier = getReturnOrThrowIdentifier(lastStatement); - if (lastStatementIdentifier != null) { - String identifier = variableTree.simpleName().name(); - if (lastStatementIdentifier.equals(identifier)) { - context.reportIssue(this, variableTree.initializer(), errorMessage); - } - } - } - } - - @CheckForNull - private String getReturnOrThrowIdentifier(StatementTree lastStatementOfBlock) { - errorMessage = null; - ExpressionTree expr = null; - if (lastStatementOfBlock.is(Kind.THROW_STATEMENT)) { - errorMessage = MESSAGERULE2; - expr = ((ThrowStatementTree) lastStatementOfBlock).expression(); - } else if (lastStatementOfBlock.is(Kind.RETURN_STATEMENT)) { - errorMessage = MESSAGERULE3; - expr = ((ReturnStatementTree) lastStatementOfBlock).expression(); - } - if (expr != null && expr.is(Kind.IDENTIFIER)) { - return ((IdentifierTree) expr).name(); - } - return null; - } - -} diff --git a/src/main/java/fr/greencodeinitiative/java/checks/UseCorrectForLoop.java b/src/main/java/fr/greencodeinitiative/java/checks/UseCorrectForLoop.java deleted file mode 100644 index 35c7f67..0000000 --- a/src/main/java/fr/greencodeinitiative/java/checks/UseCorrectForLoop.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs - * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package fr.greencodeinitiative.java.checks; - -import java.util.Arrays; -import java.util.List; - -import org.sonar.check.Rule; -import org.sonar.plugins.java.api.IssuableSubscriptionVisitor; -import org.sonar.plugins.java.api.tree.ForEachStatement; -import org.sonar.plugins.java.api.tree.Tree; -import org.sonar.plugins.java.api.tree.Tree.Kind; -import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey; - -/** - * @deprecated there aren't enough good arguments and not enough green measures / benchmarks - * (check discussion on https://github.com/green-code-initiative/ecoCode/issues/240) - */ -@Deprecated(forRemoval = true) -@Rule(key = "EC53") -@DeprecatedRuleKey(repositoryKey = "greencodeinitiative-java", ruleKey = "S53") -public class UseCorrectForLoop extends IssuableSubscriptionVisitor { - - protected static final String MESSAGERULE = "Avoid the use of Foreach with Arrays"; - - @Override - public List nodesToVisit() { - return Arrays.asList(Tree.Kind.FOR_EACH_STATEMENT); - } - - @Override - public void visitNode(Tree tree) { - - ForEachStatement forEachTree = (ForEachStatement) tree; - if (forEachTree.expression().symbolType().isArray()) { - reportIssue(tree, MESSAGERULE); - } - } -} diff --git a/src/test/files/AvoidConcatenateStringsInLoop.java b/src/test/files/AvoidConcatenateStringsInLoop.java deleted file mode 100644 index 4e2a587..0000000 --- a/src/test/files/AvoidConcatenateStringsInLoop.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs - * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package fr.greencodeinitiative.java.utils; - -public class AvoidConcatenateStringsInLoop { - - public String concatenateStrings(String[] strings) { - String result1 = ""; - - for (String string : strings) { - result1 += string; // Noncompliant {{Don't concatenate Strings in loop, use StringBuilder instead.}} - } - return result1; - } - - public String concatenateStrings2() { - String result2 = ""; - - for (int i = 0; i < 1000; ++i) { - result2 += "another"; // Noncompliant {{Don't concatenate Strings in loop, use StringBuilder instead.}} - } - return result2; - } - - public String concatenateStrings3() { - String result3 = ""; - - for (int i = 0; i < 1000; ++i) { - result3 = result3 + "another"; // Noncompliant {{Don't concatenate Strings in loop, use StringBuilder instead.}} - } - return result3; - } - -} diff --git a/src/test/files/AvoidUsingGlobalVariablesCheck.java b/src/test/files/AvoidUsingGlobalVariablesCheck.java deleted file mode 100644 index 557d6fc..0000000 --- a/src/test/files/AvoidUsingGlobalVariablesCheck.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs - * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -public class Openclass { - public static double price = 15.24; // Noncompliant {{Avoid using global variables}} - public static long pages = 1053; // Noncompliant {{Avoid using global variables}} - - public static void main(String[] args) { - double newPrice = Openclass.price; - long newPages = Openclass.pages; - System.out.println(newPrice); - System.out.println(newPages); - static long years = 3000; // Noncompliant {{Avoid using global variables}} - } - static{ // Noncompliant {{Avoid using global variables}} - int a = 4; - } - - public void printingA() { - System.out.println(a); - } - -} \ No newline at end of file diff --git a/src/test/files/UnnecessarilyAssignValuesToVariablesTestCheck.java b/src/test/files/UnnecessarilyAssignValuesToVariablesTestCheck.java deleted file mode 100644 index 17eb069..0000000 --- a/src/test/files/UnnecessarilyAssignValuesToVariablesTestCheck.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs - * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package fr.greencodeinitiative.java.checks; - -class UnnecessarilyAssignValuesToVariablesTestCheck { - UnnecessarilyAssignValuesToVariablesTestCheck(UnnecessarilyAssignValuesToVariablesTestCheck mc) { - } - - public int testSwitchCase() throws Exception { - int variableFor = 5; - int variableIf = 5; - int variableWhile = 5; - int variableExp = 5; - int variableReturn = 5; - int variableCLass = 5; - int[] intArray = {10, 20, 30, 40, 50}; - - Exception variableException = new Exception("message"); - int variableNotUse = 5; // Noncompliant {{The variable is declared but not really used}} - - - variableNotUse = 10; - for (variableFor = 0; variableFor < 5; ++variableFor) { - System.out.println(variableFor); - } - - for (int ia : intArray) { - System.out.println((char) ia); - } - - if (variableIf > 10) { - System.out.println(variableIf); - } - - while (variableWhile > 10) { - System.out.println(variableWhile); - } - - variableExp += 1; - variableNotUse = variableExp; - TestClass testClass = new TestClass(variableCLass); - if (testClass.isTrue()) { - throw variableException; - } - return variableReturn; - } - - private class TestClass { - TestClass(int i) { - ++i; - } - - public boolean isTrue() { - return true; - } - } - - - private int getIntValue() { - return 3; - } - - public int testNonCompliantReturn() { - int i = getIntValue(); // Noncompliant {{Immediately return this expression instead of assigning it to the temporary variable}} - return i; - } - - public int testCompliantReturn() { - return getIntValue(); - } - - public void testNonCompliantThrow() throws Exception { - Exception exception = new Exception("dummy"); // Noncompliant {{Immediately throw this expression instead of assigning it to the temporary variable}} - throw exception; - } - - public void testCompliantThrow() throws Exception { - throw new Exception("dummy"); - } -} \ No newline at end of file diff --git a/src/test/files/UnnecessarilyAssignValuesToVariablesTestCheckWithEmptyReturn.java b/src/test/files/UnnecessarilyAssignValuesToVariablesTestCheckWithEmptyReturn.java deleted file mode 100644 index f70c4c4..0000000 --- a/src/test/files/UnnecessarilyAssignValuesToVariablesTestCheckWithEmptyReturn.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs - * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package fr.greencodeinitiative.java.checks; - -class UnnecessarilyAssignValuesToVariablesTestCheck { - UnnecessarilyAssignValuesToVariablesTestCheck(UnnecessarilyAssignValuesToVariablesTestCheck mc) { - } - - public void testSwitchCase() { - - ArrayList lst = new ArrayList(0); - if (lst == null) { - return; - } - System.out.println(lst); - } - -} \ No newline at end of file diff --git a/src/test/files/UseCorrectForLoopCheck.java b/src/test/files/UseCorrectForLoopCheck.java deleted file mode 100644 index 350ed6e..0000000 --- a/src/test/files/UseCorrectForLoopCheck.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs - * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package fr.greencodeinitiative.java.checks; - -import java.util.Arrays; -import java.util.List; - -class UseCorrectForLoopCheck { - UseCorrectForLoopCheck(UseCorrectForLoopCheck mc) { - } - - private final Integer[] intArray = new Integer[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; - private final List intList = Arrays.asList(intArray); - - public void testForEachLoop() { - int dummy = 0; - for (Integer i : intArray) { // Noncompliant {{Avoid the use of Foreach with Arrays}} - dummy += i; - } - - for (Integer i : intList) { - dummy += i; - } - System.out.println(dummy); - } -} \ No newline at end of file diff --git a/src/test/java/fr/greencodeinitiative/java/checks/AvoidConcatenateStringsInLoopTest.java b/src/test/java/fr/greencodeinitiative/java/checks/AvoidConcatenateStringsInLoopTest.java deleted file mode 100644 index fc85788..0000000 --- a/src/test/java/fr/greencodeinitiative/java/checks/AvoidConcatenateStringsInLoopTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs - * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package fr.greencodeinitiative.java.checks; - -import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.CheckVerifier; - -@Deprecated -class AvoidConcatenateStringsInLoopTest { - - @Test - void checkNonCompliantTests() { - CheckVerifier.newVerifier() - .onFile("src/test/files/AvoidConcatenateStringsInLoop.java") - .withCheck(new AvoidConcatenateStringsInLoop()) - .verifyIssues(); - } - - @Test - void checkCompliantTests() { - CheckVerifier.newVerifier() - .onFile("src/test/files/GoodWayConcatenateStringsLoop.java") - .withCheck(new AvoidConcatenateStringsInLoop()) - .verifyNoIssues(); - } - -} diff --git a/src/test/java/fr/greencodeinitiative/java/checks/AvoidUsingGlobalVariablesCheckCheckTest.java b/src/test/java/fr/greencodeinitiative/java/checks/AvoidUsingGlobalVariablesCheckCheckTest.java deleted file mode 100644 index 31e05b1..0000000 --- a/src/test/java/fr/greencodeinitiative/java/checks/AvoidUsingGlobalVariablesCheckCheckTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs - * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package fr.greencodeinitiative.java.checks; - -import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.CheckVerifier; - -@Deprecated -class AvoidUsingGlobalVariablesCheckCheckTest { - - @Test - void test() { - CheckVerifier.newVerifier() - .onFile("src/test/files/AvoidUsingGlobalVariablesCheck.java") - .withCheck(new AvoidUsingGlobalVariablesCheck()) - .verifyIssues(); - } - -} diff --git a/src/test/java/fr/greencodeinitiative/java/checks/UnnecessarilyAssignValuesToVariablesTest.java b/src/test/java/fr/greencodeinitiative/java/checks/UnnecessarilyAssignValuesToVariablesTest.java deleted file mode 100644 index dda7437..0000000 --- a/src/test/java/fr/greencodeinitiative/java/checks/UnnecessarilyAssignValuesToVariablesTest.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs - * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package fr.greencodeinitiative.java.checks; - -import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.CheckVerifier; - -@Deprecated -class UnnecessarilyAssignValuesToVariablesTest { - - @Test - void test() { - CheckVerifier.newVerifier() - .onFile("src/test/files/UnnecessarilyAssignValuesToVariablesTestCheck.java") - .withCheck(new UnnecessarilyAssignValuesToVariables()) - .verifyIssues(); - } - - @Test - void testIgnoredEmptyReturn() { - CheckVerifier.newVerifier() - .onFile("src/test/files/UnnecessarilyAssignValuesToVariablesTestCheckWithEmptyReturn.java") - .withCheck(new UnnecessarilyAssignValuesToVariables()) - .verifyNoIssues(); - } - -} \ No newline at end of file diff --git a/src/test/java/fr/greencodeinitiative/java/checks/UseCorrectLoopCheckTest.java b/src/test/java/fr/greencodeinitiative/java/checks/UseCorrectLoopCheckTest.java deleted file mode 100644 index a853a6f..0000000 --- a/src/test/java/fr/greencodeinitiative/java/checks/UseCorrectLoopCheckTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs - * Copyright © 2023 Green Code Initiative (https://www.ecocode.io) - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package fr.greencodeinitiative.java.checks; - -import org.junit.jupiter.api.Test; -import org.sonar.java.checks.verifier.CheckVerifier; - -@Deprecated -class UseCorrectLoopCheckTest { - - @Test - void test() { - CheckVerifier.newVerifier() - .onFile("src/test/files/UseCorrectForLoopCheck.java") - .withCheck(new UseCorrectForLoop()) - .verifyIssues(); - } - -} \ No newline at end of file From 00bb38f353283789a66bdd2a8a67f77f0f4eb26d Mon Sep 17 00:00:00 2001 From: alograg Date: Thu, 18 Jan 2024 11:28:46 +0100 Subject: [PATCH 2/8] refactor: :rewind: Following instructions in code review of PR GH-6 --- docker-compose.yml | 4 ++-- pom.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index bd44653..1782b70 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,8 +16,8 @@ services: SONAR_ES_BOOTSTRAP_CHECKS_DISABLE: 'true' volumes: - type: bind - source: ./target/ecocode-java-plugin-1.5.2-SNAPSHOT.jar - target: /opt/sonarqube/extensions/plugins/ecocode-java-plugin-1.5.2-SNAPSHOT.jar + source: ./target/ecocode-java-plugin-1.5.1-SNAPSHOT.jar + target: /opt/sonarqube/extensions/plugins/ecocode-java-plugin-1.5.1-SNAPSHOT.jar - "extensions:/opt/sonarqube/extensions" - "logs:/opt/sonarqube/logs" - "data:/opt/sonarqube/data" diff --git a/pom.xml b/pom.xml index dac51ea..25a26bf 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ io.ecocode ecocode-java-plugin - 1.5.2-SNAPSHOT + 1.5.1-SNAPSHOT sonar-plugin From 9287e3c7563a1ea35b1372d56cea52be6390ffa9 Mon Sep 17 00:00:00 2001 From: alograg Date: Thu, 18 Jan 2024 16:11:00 +0100 Subject: [PATCH 3/8] fix: :white_check_mark: Test update with the changes in ecoCode rules --- .../java/JavaCheckRegistrarTest.java | 2 +- .../java/JavaRulesDefinitionTest.java | 31 +++---------------- 2 files changed, 6 insertions(+), 27 deletions(-) diff --git a/src/test/java/fr/greencodeinitiative/java/JavaCheckRegistrarTest.java b/src/test/java/fr/greencodeinitiative/java/JavaCheckRegistrarTest.java index c38b4c0..02270ca 100644 --- a/src/test/java/fr/greencodeinitiative/java/JavaCheckRegistrarTest.java +++ b/src/test/java/fr/greencodeinitiative/java/JavaCheckRegistrarTest.java @@ -31,7 +31,7 @@ void checkNumberRules() { final JavaCheckRegistrar registrar = new JavaCheckRegistrar(); registrar.register(context); - assertThat(context.checkClasses()).hasSize(19); + assertThat(context.checkClasses()).hasSize(15); assertThat(context.testCheckClasses()).isEmpty(); } diff --git a/src/test/java/fr/greencodeinitiative/java/JavaRulesDefinitionTest.java b/src/test/java/fr/greencodeinitiative/java/JavaRulesDefinitionTest.java index 2c65514..0c0b373 100644 --- a/src/test/java/fr/greencodeinitiative/java/JavaRulesDefinitionTest.java +++ b/src/test/java/fr/greencodeinitiative/java/JavaRulesDefinitionTest.java @@ -38,38 +38,17 @@ class JavaRulesDefinitionTest { private RulesDefinition.Repository repository; private RulesDefinition.Context context; + private int rulesSize; + @BeforeEach void init() { - // TODO: Remove this check after Git repo split - /* - On an IDE (like IntelliJ), if the developer runs the unit tests without building/generating the Maven goals on the - "ecocode-rules-specifications" module before, the unit tests will not see the generated HTML descriptions (from ASCIIDOC files). - The developer must therefore configure his IDE to build the `ecocode-rules-specifications` module before launching the Tests. - - When the `java-plugin` submodule is in a specific Git repository, `ecocode-rules-specifications` will be fetched from a classic - external Maven dependency. There will therefore no longer be any need to perform this specific configuration. - */ - if (JavaRulesDefinition.class.getResource("/io/ecocode/rules/java/EC4.json") == null) { - String message = "'ecocode-rules-specification' resources corrupted. Please check build of 'ecocode-rules-specification' module"; - if (System.getProperties().keySet().stream().anyMatch(k -> k.toString().startsWith("idea."))) { - message += "\n\nOn 'IntelliJ IDEA':" + - "\n1. go to settings :" + - "\n > Build, Execution, Deployment > Build Tools > Maven > Runner" + - "\n2. check option:" + - "\n > Delegate IDE build/run actions to Maven" + - "\n3. Click on menu: " + - "\n > Build > Build Project" - ; - } - fail(message); - } - final SonarRuntime sonarRuntime = mock(SonarRuntime.class); doReturn(Version.create(0, 0)).when(sonarRuntime).getApiVersion(); JavaRulesDefinition rulesDefinition = new JavaRulesDefinition(sonarRuntime); RulesDefinition.Context context = new RulesDefinition.Context(); rulesDefinition.define(context); repository = context.repository(rulesDefinition.repositoryKey()); + rulesSize = 15; } @Test @@ -78,12 +57,12 @@ void testMetadata() { assertThat(repository.name()).isEqualTo("ecoCode"); assertThat(repository.language()).isEqualTo("java"); assertThat(repository.key()).isEqualTo("ecocode-java"); - assertThat(repository.rules()).hasSize(19); + assertThat(repository.rules()).hasSize(rulesSize); } @Test void testRegistredRules() { - assertThat(repository.rules()).hasSize(19); + assertThat(repository.rules()).hasSize(rulesSize); } @Test From 8f44fb028c413bc82a69d18b587e56b80c3dddd2 Mon Sep 17 00:00:00 2001 From: alograg Date: Fri, 19 Jan 2024 11:46:44 +0100 Subject: [PATCH 4/8] docs: :memo: Documentation of changes --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e20803..26e18bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deleted +- Remove depreciated rules EC4, EC53, EC63 and EC75 + ## [1.5.0] - 2024-01-06 ### Added From 2a1a8be7f8e808509156df3726afd2eb18387006 Mon Sep 17 00:00:00 2001 From: alograg Date: Fri, 19 Jan 2024 12:38:22 +0100 Subject: [PATCH 5/8] fix: :bookmark: Version assigned according to pull request comment --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 25a26bf..06248ea 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ 1.7 - 1.4.6 + 1.5.0-SNAPSHOT From a0e7ab7cad0742825ca5bbe8c1646ee6dc247f3b Mon Sep 17 00:00:00 2001 From: alograg Date: Fri, 19 Jan 2024 12:39:06 +0100 Subject: [PATCH 6/8] fix: :memo: Documentation of changes --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 26e18bf..f08d7fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deleted -- Remove depreciated rules EC4, EC53, EC63 and EC75 +- Remove deprecated java rules ## [1.5.0] - 2024-01-06 From 5112e17217694743298a08236b3757c64841ad67 Mon Sep 17 00:00:00 2001 From: Henry Date: Wed, 24 Jan 2024 17:26:58 +0100 Subject: [PATCH 7/8] Update pom.xml Remove snapshot from version od EcoCode --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index ef11335..8af9cbf 100644 --- a/pom.xml +++ b/pom.xml @@ -67,7 +67,7 @@ 1.7 - 1.5.0-SNAPSHOT + 1.5.0 From 2d9b91000e5a79b3b7b59c2b519ede4f240a5717 Mon Sep 17 00:00:00 2001 From: alograg Date: Fri, 2 Feb 2024 15:09:28 +0100 Subject: [PATCH 8/8] fix: :memo: Version et changes correction --- CHANGELOG.md | 2 +- docker-compose.yml | 4 ++-- pom.xml | 6 +++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b176df5..11f3b02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Deleted -- Remove deprecated java rules +- Deprecated java rules EC4, EC53, EC63 and EC75 ## [1.5.0] - 2024-01-06 diff --git a/docker-compose.yml b/docker-compose.yml index 1782b70..bf8e84b 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,8 +16,8 @@ services: SONAR_ES_BOOTSTRAP_CHECKS_DISABLE: 'true' volumes: - type: bind - source: ./target/ecocode-java-plugin-1.5.1-SNAPSHOT.jar - target: /opt/sonarqube/extensions/plugins/ecocode-java-plugin-1.5.1-SNAPSHOT.jar + source: ./target/ecocode-java-plugin-1.6.0-SNAPSHOT.jar + target: /opt/sonarqube/extensions/plugins/ecocode-java-plugin-1.6.0-SNAPSHOT.jar - "extensions:/opt/sonarqube/extensions" - "logs:/opt/sonarqube/logs" - "data:/opt/sonarqube/data" diff --git a/pom.xml b/pom.xml index 8af9cbf..1845604 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ io.ecocode ecocode-java-plugin - 1.5.2-SNAPSHOT + 1.6.0-SNAPSHOT sonar-plugin @@ -67,7 +67,11 @@ 1.7 +<<<<<<< HEAD 1.5.0 +======= + 1.6.0-SNAPSHOT +>>>>>>> 603fbcd (fix: :memo: Version et changes correction)