Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lmangaretto rename #47

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@
<mockito.version>5.14.1</mockito.version>

<!-- temporary version waiting for real automatic release in creedengo repository -->
<ecocode-rules-specifications.version>1.6.4</ecocode-rules-specifications.version>
<creedengo-rules-specifications.version>1.6.4</creedengo-rules-specifications.version>

</properties>

<dependencies>
<dependency>
<groupId>io.ecocode</groupId>
<artifactId>ecocode-rules-specifications</artifactId>
<version>${ecocode-rules-specifications.version}</version>
<groupId>org.green-code-initiative</groupId>
<artifactId>creedengo-rules-specifications</artifactId>
<version>${creedengo-rules-specifications.version}</version>
<classifier>python</classifier>
</dependency>

Expand Down Expand Up @@ -221,7 +221,7 @@
</excludes>
</filter>
<filter>
<artifact>io.ecocode:ecocode-rules-specifications:*</artifact>
<artifact>org.green-code-initiative:creedengo-rules-specifications:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ public class PythonRuleRepository implements RulesDefinition, PythonCustomRuleRe
);

public static final String LANGUAGE = "py";
public static final String NAME = "ecoCode";
public static final String RESOURCE_BASE_PATH = "io/ecocode/rules/python";
public static final String REPOSITORY_KEY = "ecocode-python";
public static final String NAME = "creendengo";
public static final String RESOURCE_BASE_PATH = "org/green-code-initiative/rules/python";
public static final String REPOSITORY_KEY = "gci-python";

private final SonarRuntime sonarRuntime;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import java.util.Map;
import java.util.regex.Pattern;

@Rule(key = "EC74")
@Rule(key = "GCI74")
@DeprecatedRuleKey(repositoryKey = "gci-python", ruleKey = "S74")
public class AvoidFullSQLRequest extends PythonSubscriptionCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import org.sonar.plugins.python.api.tree.Tree;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@Rule(key = "EC7")
@Rule(key = "GCI7")
@DeprecatedRuleKey(repositoryKey = "gci-python", ruleKey = "D7")
public class AvoidGettersAndSetters extends PythonSubscriptionCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
import org.sonar.plugins.python.api.tree.YieldStatement;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@Rule(key = "EC4")
@Rule(key = "GCI4")
@DeprecatedRuleKey(repositoryKey = "gci-python", ruleKey = "D4")
public class AvoidGlobalVariableInFunctionCheck extends PythonSubscriptionCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
import static org.sonar.plugins.python.api.tree.Tree.Kind.LIST_COMPREHENSION;
import static org.sonar.plugins.python.api.tree.Tree.Kind.REGULAR_ARGUMENT;

@Rule(key = "EC404")
@Rule(key = "GCI404")
public class AvoidListComprehensionInIterations extends PythonSubscriptionCheck {

public static final String DESCRIPTION = "Use generator comprehension instead of list comprehension in for loop declaration";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
* - an "ELSE" statement is considered as a second IF statement using the same variables used on previous
* - IF and ELSEIF statements are considered as an IF statement
*/
@Rule(key = "EC2")
@Rule(key = "GCI2")
public class AvoidMultipleIfElseStatementCheck extends PythonSubscriptionCheck {

public static final String ERROR_MESSAGE = "Use a match-case statement instead of multiple if-else if possible";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
import org.sonar.plugins.python.api.tree.Tree;
import org.sonarsource.analyzer.commons.annotations.DeprecatedRuleKey;

@Rule(key = "EC72")
@Rule(key = "GCI72")
@DeprecatedRuleKey(repositoryKey = "gci-python", ruleKey = "S72")
public class AvoidSQLRequestInLoop extends PythonSubscriptionCheck {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

import static org.sonar.plugins.python.api.tree.Tree.Kind.CALL_EXPR;

@Rule(key = "EC35")
@Rule(key = "GCI35")
@DeprecatedRuleKey(repositoryKey = "gci-python", ruleKey = "S34")
@DeprecatedRuleKey(ruleKey = "EC34")
@DeprecatedRuleKey(ruleKey = "GCI34")
public class AvoidTryCatchWithFileOpenedCheck extends PythonSubscriptionCheck {

public static final String DESCRIPTION = "Avoid the use of try-catch with a file open in try block";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.sonar.plugins.python.api.tree.RegularArgument;
import org.sonar.plugins.python.api.tree.Tree;

@Rule(key = "EC89")
@Rule(key = "GCI89")
public class AvoidUnlimitedCache extends PythonSubscriptionCheck {

public static final String DESCRIPTION = "Do not set cache size to unlimited";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import org.sonar.plugins.python.api.SubscriptionContext;
import org.sonar.plugins.python.api.tree.*;

@Rule(key = "EC10")
@Rule(key = "GCI10")
public class AvoidUnoptimizedVectorImagesCheck extends PythonSubscriptionCheck {

public static final String DESCRIPTION = "Avoid using unoptimized vector images";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

@Rule(key = "EC203")
@Rule(key = "GCI203")
public class DetectUnoptimizedImageFormat extends PythonSubscriptionCheck {

protected static final String RULE_KEY = "EC203";
protected static final String RULE_KEY = "GCI203";
protected static final String MESSAGERULE = "Detect unoptimized image format";
protected static final String MESSAGEERROR = "If possible, the utilisation of svg image format (or <svg/> html tag) is recommended over other image format.";
protected static final Pattern IMGEXTENSION = Pattern.compile("\\.(bmp|ico|tiff|webp|png|jpg|jpeg|jfif|pjpeg|pjp|gif|avif|apng)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ void init() {
@Test
@DisplayName("Test repository metadata")
void testMetadata() {
assertThat(repository.name()).isEqualTo("ecoCode");
assertThat(repository.name()).isEqualTo("creedengo");
assertThat(repository.language()).isEqualTo("py");
assertThat(repository.key()).isEqualTo("ecocode-python");
assertThat(repository.key()).isEqualTo("gci-python");
}

@Test
Expand All @@ -69,11 +69,11 @@ void checkNumberRules() {
}

@Test
@DisplayName("All rule keys must be prefixed by 'EC'")
@DisplayName("All rule keys must be prefixed by 'GCI'")
void testRuleKeyPrefix() {
SoftAssertions assertions = new SoftAssertions();
repository.rules().forEach(
rule -> assertions.assertThat(rule.key()).startsWith("EC")
rule -> assertions.assertThat(rule.key()).startsWith("GCI")
);
assertions.assertAll();
}
Expand Down
Loading