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

upgrade libraries versions for SonarQube 10.0.0 #188

Merged
merged 11 commits into from
Jun 23, 2023
14 changes: 8 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- [#109](https://github.com/green-code-initiative/ecoCode/issues/109) Add PHP rule EC3: Getting the size of the collection in the loop.
- [#108](https://github.com/green-code-initiative/ecoCode/issues/108) new Python rule EC66 : Use single quote (') instead of quotation mark (")
- [#109](https://github.com/green-code-initiative/ecoCode/issues/109) new PHP rule EC3 : Getting the size of the collection in the loop. For further [RULES.md](./RULES.md) file
- [#113](https://github.com/green-code-initiative/ecoCode/issues/113) new Python rule EC10 : Use unoptimized vector images
- [#127](https://github.com/green-code-initiative/ecoCode/issues/127) new Python rule EC404 : Usage of generator comprehension instead of list comprehension in for loop declaration
- [#190](https://github.com/green-code-initiative/ecoCode/pull/190) Add Python rule: Use unoptimized vector images
- [#127](https://github.com/green-code-initiative/ecoCode/issues/127) Add Python rule EC404: Usage of generator comprehension instead of list comprehension in for loop declaration
- [#192](https://github.com/green-code-initiative/ecoCode/pull/192) Add Python rule EC203: Detect unoptimized file formats
- [#108](https://github.com/green-code-initiative/ecoCode/issues/108) Add Python rule EC66: Use single quote (') instead of quotation mark (")
- [#191](https://github.com/green-code-initiative/ecoCode/issues/191) Update rule tags for Java, Python, and PHP plugins
- [#192](https://github.com/green-code-initiative/ecoCode/pull/192) new Python rule EC203 : Detect unoptimized file formats
- Add JavaScript rules from [ecoCode ESLint plugin v0.2.0](https://github.com/green-code-initiative/ecoCode-linter/releases/tag/eslint-plugin%2F0.2.0)

### Changed

- [#19](https://github.com/green-code-initiative/ecoCode-common/issues/19) process changed for development environment installation : easier to initialize locally environment (check [`INSTALL.md`](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/INSTALL.md#howto-install-sonarqube-dev-environment) file)
- [#107](https://github.com/green-code-initiative/ecoCode/issues/107) upgrade librairies to SonarQube 10.0.0
- [#196](https://github.com/green-code-initiative/ecoCode/issues/196) updating PHP files to make them following the coding standards (PSR-12)
- technical : upgrade of maven plugins versions

Expand Down Expand Up @@ -72,14 +74,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed

- [#40](https://github.com/green-code-initiative/ecoCode/issues/40) Refactoring of package names (`cnumr` to `greencodeinitiative`)
- [#55](https://github.com/green-code-initiative/ecoCode/issues/55) rename `eco-conception` tag of rules to `eco-design`
- [#58](https://github.com/green-code-initiative/ecoCode/issues/58) check and upgrade compatibility to SonarQube 9.9
- move common init scripts to `ecoCode-common` repository
- modifying documentation and move `CONTRIBUTING.md`, `CODE_STYLE.md` and `INSTALL.md` to common doc in `ecoCode-common` repository
- security / performance optimizations : correction of `sonarcloud.io` security hotspots (java / php, python) and move Pattern compilation to static attribute
- [#64](https://github.com/green-code-initiative/ecoCode/issues/64) Python: ecoCode plugin with SonarQube, no code-smell detection
- [#65](https://github.com/green-code-initiative/ecoCode/issues/65) Create a test project to check new plugin rule in real environment
- [#71](https://github.com/green-code-initiative/ecoCode/issues/71) After an PHP analysis, no ecocode code smells appears in my Sonar project
- [#64](https://github.com/green-code-initiative/ecoCode/issues/64) Python: ecoCode plugin with SonarQube, no code-smell detection
- [#55](https://github.com/green-code-initiative/ecoCode/issues/55) rename `eco-conception` tag of rules to `eco-design`
- [#76](https://github.com/green-code-initiative/ecoCode/issues/76) correction of SonarQube plugins homepage link broken
- documentation upgrade

Expand Down
33 changes: 1 addition & 32 deletions java-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,40 +87,9 @@
</configuration>
</plugin>
<plugin>
<!-- shade plugin configuration is on parent pom.xml because of use for other modules -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>commons-*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</filter>
<filter>
<artifact>org.*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
<exclude>org/sonar/api/batch/sensor/**</exclude>
<exclude>javax/annotation/**</exclude>
</excludes>
</filter>
<filter>
<artifact>com.*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class JavaRulesDefinition implements RulesDefinition {
public void define(Context context) {
NewRepository repository = context.createRepository(REPOSITORY_KEY, LANGUAGE).setName(NAME);

SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(9, 8), SonarQubeSide.SCANNER, SonarEdition.DEVELOPER);
SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(10, 0), SonarQubeSide.SCANNER, SonarEdition.DEVELOPER);

RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader(RESOURCE_BASE_PATH, sonarRuntime);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ private static class MockedSonarRuntime implements SonarRuntime {

@Override
public Version getApiVersion() {
return Version.create(9, 9);
return Version.create(10, 0);
}

@Override
Expand Down
30 changes: 5 additions & 25 deletions javascript-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -68,33 +68,13 @@
</configuration>
</plugin>
<plugin>
<!-- plugin TO KEEP because of an error on SonarQube logs when it starts
"java.lang.ClassNotFoundException: org.sonarsource.analyzer.commons.ExternalRuleLoader"
possible reason : some libraries aren't available at runtime if no shaded Jar file produced
-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>commons-*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</filter>
<filter>
<artifact>org.*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
<exclude>org/sonar/api/batch/sensor/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
<!-- shade plugin configuration is on parent pom.xml beacause of use for other modules -->
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ private static class MockedSonarRuntime implements SonarRuntime {

@Override
public Version getApiVersion() {
return Version.create(9, 9);
return Version.create(10, 0);
}

@Override
Expand Down
35 changes: 0 additions & 35 deletions php-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,41 +64,6 @@
<jreMinVersion>${java.version}</jreMinVersion>
</configuration>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-shade-plugin</artifactId>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <phase>package</phase>-->
<!-- <goals>-->
<!-- <goal>shade</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <filters>-->
<!-- <filter>-->
<!-- <artifact>commons-*:*</artifact>-->
<!-- <excludes>-->
<!-- <exclude>META-INF/**</exclude>-->
<!-- </excludes>-->
<!-- </filter>-->
<!-- <filter>-->
<!-- <artifact>org.*:*</artifact>-->
<!-- <excludes>-->
<!-- <exclude>META-INF/**</exclude>-->
<!-- <exclude>org/sonar/api/batch/sensor/**</exclude>-->
<!-- </excludes>-->
<!-- </filter>-->
<!-- <filter>-->
<!-- <artifact>com.*:*</artifact>-->
<!-- <excludes>-->
<!-- <exclude>META-INF/**</exclude>-->
<!-- </excludes>-->
<!-- </filter>-->
<!-- </filters>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class PhpPluginTest {
@Test
public void test() {
SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(9, 9), SonarQubeSide.SCANNER, SonarEdition.DEVELOPER);
SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(10, 0), SonarQubeSide.SCANNER, SonarEdition.DEVELOPER);
Plugin.Context context = new PluginContextImpl.Builder().setSonarRuntime(sonarRuntime).build();
new PHPPlugin().define(context);
assertThat(context.getExtensions()).hasSize(1);
Expand Down
55 changes: 47 additions & 8 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@
<project.build.sourceEncoding>${encoding}</project.build.sourceEncoding>
<project.reporting.outputEncoding>${encoding}</project.reporting.outputEncoding>

<sonarqube.version>9.4.0.54424</sonarqube.version>

<sonar.organization>green-code-initiative</sonar.organization>
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

<sonarjava.version>7.15.0.30507</sonarjava.version>
<sonarpython.version>3.19.0.10254</sonarpython.version>
<sonarphp.version>3.25.0.9077</sonarphp.version>
<sonarjavascript.version>9.13.0.20537</sonarjavascript.version>
<sonarqube.version>9.4.0.54424</sonarqube.version>
<sonar-plugin-api-impl.version>10.0.0.68432</sonar-plugin-api-impl.version>
<sonarjava.version>7.19.0.31550</sonarjava.version>
<sonarpython.version>4.3.0.11660</sonarpython.version>
<sonarphp.version>3.29.0.9684</sonarphp.version>
<sonarjavascript.version>10.2.0.21568</sonarjavascript.version>

<sonar-analyzer-commons.version>2.5.0.1358</sonar-analyzer-commons.version>

<sonar-plugin-api-impl.version>9.7.1.62043</sonar-plugin-api-impl.version>
<sonar-analyzer-commons.version>2.1.0.1111</sonar-analyzer-commons.version>
<sonar-packaging.version>1.21.0.505</sonar-packaging.version>
<sonar.skipDependenciesPackaging>true</sonar.skipDependenciesPackaging>

Expand Down Expand Up @@ -192,6 +192,45 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<!-- common configuration for shade plugin -->
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>commons-*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</filter>
<filter>
<artifact>org.*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
<exclude>org/sonar/api/batch/sensor/**</exclude>
<exclude>javax/annotation/**</exclude>
</excludes>
</filter>
<filter>
<artifact>com.*:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</filter>
<filter>
<artifact>junit:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
35 changes: 0 additions & 35 deletions python-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,41 +61,6 @@
<jreMinVersion>${java.version}</jreMinVersion>
</configuration>
</plugin>
<!-- <plugin>-->
<!-- <groupId>org.apache.maven.plugins</groupId>-->
<!-- <artifactId>maven-shade-plugin</artifactId>-->
<!-- <executions>-->
<!-- <execution>-->
<!-- <phase>package</phase>-->
<!-- <goals>-->
<!-- <goal>shade</goal>-->
<!-- </goals>-->
<!-- <configuration>-->
<!-- <filters>-->
<!-- <filter>-->
<!-- <artifact>commons-*:*</artifact>-->
<!-- <excludes>-->
<!-- <exclude>META-INF/**</exclude>-->
<!-- </excludes>-->
<!-- </filter>-->
<!-- <filter>-->
<!-- <artifact>org.*:*</artifact>-->
<!-- <excludes>-->
<!-- <exclude>META-INF/**</exclude>-->
<!-- <exclude>org/sonar/api/batch/sensor/**</exclude>-->
<!-- </excludes>-->
<!-- </filter>-->
<!-- <filter>-->
<!-- <artifact>com.*:*</artifact>-->
<!-- <excludes>-->
<!-- <exclude>META-INF/**</exclude>-->
<!-- </excludes>-->
<!-- </filter>-->
<!-- </filters>-->
<!-- </configuration>-->
<!-- </execution>-->
<!-- </executions>-->
<!-- </plugin>-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
public class PythonPluginTest {
@Test
public void test() {
SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(9, 9), SonarQubeSide.SCANNER, SonarEdition.DEVELOPER);
SonarRuntime sonarRuntime = SonarRuntimeImpl.forSonarQube(Version.create(10, 0), SonarQubeSide.SCANNER, SonarEdition.DEVELOPER);
Plugin.Context context = new PluginContextImpl.Builder().setSonarRuntime(sonarRuntime).build();
new PythonPlugin().define(context);
assertThat(context.getExtensions()).hasSize(1);
Expand Down