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

chore: rename rule keys ECXXX to the Green Code Initiative naming convention GCIXXX #75

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [#59](https://github.com/green-code-initiative/ecoCode-java/pull/59) Add builtin profile `ecoCode way` to aggregate all implemented ecoCode rules by this plugin
- [#53](https://github.com/green-code-initiative/ecoCode-java/issues/53) Improve integration tests
- Rename rules ECXXX to the new Green Code Initiative naming convention GCIXXX

### Changed

Expand Down
16 changes: 8 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<name>ecoCode - Java language</name>
<description>Provides rules to reduce the environmental footprint of your Java programs</description>
<inceptionYear>2023</inceptionYear>
<inceptionYear>2024</inceptionYear>

<url>https://github.com/green-code-initiative/ecoCode-java</url>
<organization>
Expand Down Expand Up @@ -71,8 +71,8 @@

<google.re2j>1.7</google.re2j>

<!-- Version of ecoCode rules specifications implemented by this plugin -->
<ecocode-rules-specifications.version>1.6.5</ecocode-rules-specifications.version>
<!-- Version of creedengo rules specifications implemented by this plugin -->
<creedengo-rules-specifications.version>2.0.0</creedengo-rules-specifications.version>

<!-- URL of the Maven repository where sonarqube will be downloaded -->
<test-it.orchestrator.artifactory.url>https://repo1.maven.org/maven2</test-it.orchestrator.artifactory.url>
Expand All @@ -91,9 +91,9 @@

<dependencies>
<dependency>
<groupId>${project.groupId}</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>java</classifier>
</dependency>

Expand Down Expand Up @@ -238,7 +238,7 @@
<extensions>true</extensions>
<configuration>
<pluginKey>ecocodejava</pluginKey>
<pluginClass>fr.greencodeinitiative.java.JavaPlugin</pluginClass>
<pluginClass>org.greencodeinitiative.java.JavaPlugin</pluginClass>
<sonarLintSupported>true</sonarLintSupported>
<pluginApiMinVersion>${sonarqube.version}</pluginApiMinVersion>
<skipDependenciesPackaging>true</skipDependenciesPackaging>
Expand Down Expand Up @@ -470,7 +470,7 @@
</test-it.plugins>
<!-- Comma separated JSON profile file URIs to load -->
<test-it.additional-profile-uris>
${project.baseUri}/src/main/resources/fr/greencodeinitiative/java/ecoCode_way_profile.json,
${project.baseUri}/src/main/resources/org/greencodeinitiative/java/ecoCode_way_profile.json,
</test-it.additional-profile-uris>
<!-- Comma separated paths of "test projects" to analyze. Syntaxe: `sonar.projectKey|sonar.projectName|project.pomUri` -->
<test-it.test-projects>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ void test() {
assertThat(issuesForArrayCopyCheck)
.hasSize(1)
.first().satisfies(issue -> {
assertThat(issue.getRule()).isEqualTo("ecocode-java:EC69");
assertThat(issue.getRule()).isEqualTo("ecocode-java:GCI69");
assertThat(issue.getSeverity()).isEqualTo(MINOR);
assertThat(issue.getLine()).isEqualTo(18);
assertThat(issue.getTextRange().getStartLine()).isEqualTo(18);
Expand Down Expand Up @@ -445,4 +445,4 @@ private static WsClient newWsClient(Orchestrator orchestrator) {
.url(orchestrator.getServer().getUrl())
.build());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
* "name": "ecoCode way",
* "language": "java",
* "ruleKeys": [
* "EC1",
* "EC2"
* "GCI1",
* "GCI2"
* ]
* }
* </pre>
Expand All @@ -36,14 +36,14 @@
* &lt;rules&gt;
* &lt;rule&gt;
* &lt;repositoryKey&gt;ecocode-java&lt;/repositoryKey&gt;
* &lt;key&gt;EC1&lt;/key&gt;
* &lt;key&gt;GCI1&lt;/key&gt;
* &lt;type&gt;CODE_SMELL&lt;/type&gt;
* &lt;priority&gt;MINOR&lt;/priority&gt;
* &lt;parameters /&gt;
* &lt;/rule&gt;
* &lt;rule&gt;
* &lt;repositoryKey&gt;ecocode-java&lt;/repositoryKey&gt;
* &lt;key&gt;EC2&lt;/key&gt;
* &lt;key&gt;GCI2&lt;/key&gt;
* &lt;type&gt;CODE_SMELL&lt;/type&gt;
* &lt;priority&gt;MINOR&lt;/priority&gt;
* &lt;parameters /&gt;
Expand Down Expand Up @@ -160,4 +160,4 @@ public String language() {
public String name() {
return profileMetadata().getName();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.util.Arrays;

Expand Down Expand Up @@ -490,4 +490,4 @@ private boolean transform(boolean a) {
return !a;
}

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

class AvoidFullSQLRequestCheck {
AvoidFullSQLRequestCheck(AvoidFullSQLRequestCheck mc) {
Expand Down Expand Up @@ -27,4 +27,4 @@ private void dummyCall(String request) {

}

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -18,4 +18,4 @@ public void ignoredLoop() {
System.out.println("numberList.size()");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -17,4 +17,4 @@ public void badForLoop() {
System.out.println("numberList.size()");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.util.Collection;
import java.util.ArrayList;
Expand All @@ -20,4 +20,4 @@ public void goodForLoop() {
int size2 = numberList.size(); // Compliant with this rule
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.util.ArrayList;
import java.util.Iterator;
Expand All @@ -20,4 +20,4 @@ public void badForLoop() {
System.out.println("numberList.size()");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -19,4 +19,4 @@ public void badWhileLoop() {
i++;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.util.ArrayList;
import java.util.List;
Expand All @@ -21,4 +21,4 @@ public void goodWhileLoop() {
i++;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.util.ArrayList;
import java.util.Iterator;
Expand All @@ -21,4 +21,4 @@ public void badWhileLoop() {
System.out.println("numberList.size()");
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

class AvoidMultipleIfElseStatement {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

class AvoidMultipleIfElseStatementCompareMethodNoIssue {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs
* Copyright © 2023 Green Code Initiative (https://www.ecocode.io)
* Copyright © 2024 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
Expand All @@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

interface AvoidMultipleIfElseStatementInterfaceNoIssue {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs
* Copyright © 2023 Green Code Initiative (https://www.ecocode.io)
* Copyright © 2024 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
Expand All @@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

class AvoidMultipleIfElseStatementNoBlockNoIssue {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

class AvoidMultipleIfElseStatementNoIssue {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.util.regex.Pattern;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.sql.Connection;
import java.sql.DriverManager;
Expand Down Expand Up @@ -131,4 +131,4 @@ public void testWithWhileLoop() {
}
}

}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.math.BigDecimal;
import java.sql.Connection;
Expand Down Expand Up @@ -148,4 +148,4 @@ public double getField4() {
}


}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs
* Copyright © 2023 Green Code Initiative (https://www.ecocode.io)
* Copyright © 2024 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
Expand All @@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
Expand Down Expand Up @@ -54,4 +54,4 @@ public interface EmployeeRepository extends JpaRepository<Employee, Integer> {

}

}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ecoCode - Java language - Provides rules to reduce the environmental footprint of your Java programs
* Copyright © 2023 Green Code Initiative (https://www.ecocode.io)
* Copyright © 2024 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
Expand All @@ -15,7 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.jpa.repository.JpaRepository;
Expand Down Expand Up @@ -122,4 +122,4 @@ public Employee(Integer id, String name) {

public interface EmployeeRepository extends JpaRepository<Employee, Integer> {
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.sql.Connection;
import java.sql.DriverManager;
Expand All @@ -17,4 +17,4 @@ public void insert() throws SQLException {
Statement statement = connection.createStatement();
statement.executeUpdate("INSERT INTO persons(id, name) VALUES(2, 'Toto')"); // Noncompliant {{You must not use Statement for a DML query}}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.util.*;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.io.*;

Expand Down Expand Up @@ -35,4 +35,4 @@ public void foo2() throws IOException {
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package fr.greencodeinitiative.java.checks;
package org.greencodeinitiative.java.checks;

import java.util.*;

Expand Down
Loading
Loading