Skip to content

Commit 3a34bf8

Browse files
authored
Merge pull request #1 from green-code-initiative/ISSUE_142
[ISSUE 142] new python rule : AvoidMultipleIfElseStatement
2 parents eea176a + 0c0155a commit 3a34bf8

File tree

9 files changed

+775
-10
lines changed

9 files changed

+775
-10
lines changed

.github/workflows/tag_release.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
uses: actions/upload-artifact@v3
4545
with:
4646
name: ecocode-plugins
47-
path: lib
47+
path: target
4848
- name: Export UPLOAD_URL
4949
id: export_upload_url
5050
run: echo "upload_url=${{ steps.create_release.outputs.upload_url }}" >> $GITHUB_OUTPUT
@@ -58,14 +58,14 @@ jobs:
5858
uses: actions/download-artifact@v3
5959
with:
6060
name: ecocode-plugins
61-
path: lib
61+
path: target
6262
- name: Upload Release Asset - Python Plugin
6363
id: upload-release-asset
6464
uses: actions/upload-release-asset@v1
6565
env:
6666
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6767
with:
6868
upload_url: ${{needs.build.outputs.upload_url}}
69-
asset_path: lib/ecocode-python-plugin-${{ github.ref_name }}.jar
69+
asset_path: target/ecocode-python-plugin-${{ github.ref_name }}.jar
7070
asset_name: ecocode-python-plugin-${{ github.ref_name }}.jar
7171
asset_content_type: application/zip

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111

1212
- Python rules moved from `ecoCode` repository to current repository
13+
- [#142](https://github.com/green-code-initiative/ecoCode/issues/142) new Python rule : Multiple if-else statement + refactoring implementation
1314
- [#205](https://github.com/green-code-initiative/ecoCode/issues/205) compatibility with SonarQube 10.1
1415

1516
### Changed
1617

1718
### Deleted
1819

20+
## [0.0.0]
21+
22+
### Added
23+
24+
### Changed
25+
26+
### Deleted
27+
1928
[unreleased]: https://github.com/green-code-initiative/ecoCode-python/compare/v0.0.1...HEAD
29+
[0.0.1]: https://github.com/green-code-initiative/ecoCode-python/compare/v0.0.0...0.0.1

pom.xml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@
2222
<distribution>repo</distribution>
2323
</license>
2424
</licenses>
25+
<scm>
26+
<connection>scm:git:https://github.com/green-code-initiative/ecocode-python</connection>
27+
<developerConnection>scm:git:https://github.com/green-code-initiative/ecocode-python</developerConnection>
28+
<url>https://github.com/green-code-initiative/ecocode-python</url>
29+
<tag>HEAD</tag>
30+
</scm>
2531
<issueManagement>
2632
<system>GitHub</system>
2733
<url>https://github.com/green-code-initiative/ecoCode-python/issues</url>
@@ -40,19 +46,19 @@
4046
<sonar.organization>green-code-initiative</sonar.organization>
4147
<sonar.host.url>https://sonarcloud.io</sonar.host.url>
4248

49+
<!-- max version with SonarQube 10.0 -->
4350
<sonarqube.version>9.4.0.54424</sonarqube.version>
44-
<sonarjava.version>7.19.0.31550</sonarjava.version>
45-
<sonarpython.version>4.3.0.11660</sonarpython.version>
51+
52+
<!-- max version with SonarQube 10.0 : check lib/extension directory -->
53+
<sonarpython.version>4.1.0.11333</sonarpython.version>
4654

4755
<sonar-packaging.version>1.21.0.505</sonar-packaging.version>
4856
<sonar.skipDependenciesPackaging>true</sonar.skipDependenciesPackaging>
4957

50-
<junit.jupiter.version>5.9.1</junit.jupiter.version>
51-
<assertJ.version>3.23.1</assertJ.version>
5258
<mockito.version>5.3.1</mockito.version>
5359

5460
<!-- temporary version waiting for real automatic release in ecocode repository -->
55-
<ecocode-rules-specifications.version>0.0.2</ecocode-rules-specifications.version>
61+
<ecocode-rules-specifications.version>0.0.3</ecocode-rules-specifications.version>
5662

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

@@ -81,6 +87,14 @@
8187
<scope>provided</scope>
8288
</dependency>
8389

90+
<!-- To keep because of dependency used at runtime (or else error at starting SonarQube) -->
91+
<dependency>
92+
<groupId>org.sonarsource.analyzer-commons</groupId>
93+
<artifactId>sonar-analyzer-commons</artifactId>
94+
<version>${sonar-analyzer-commons.version}</version>
95+
</dependency>
96+
97+
<!-- TEST sources dependencies -->
8498
<dependency>
8599
<groupId>org.sonarsource.python</groupId>
86100
<artifactId>python-checks-testkit</artifactId>
@@ -173,6 +187,7 @@
173187
<jreMinVersion>${java.version}</jreMinVersion>
174188
</configuration>
175189
</plugin>
190+
<!-- To keep because of dependency sonar-analyzer-commons -->
176191
<plugin>
177192
<groupId>org.apache.maven.plugins</groupId>
178193
<artifactId>maven-shade-plugin</artifactId>

src/main/java/fr/greencodeinitiative/python/PythonRuleRepository.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ public List<Class> checkClasses() {
6363
NoFunctionCallWhenDeclaringForLoop.class,
6464
AvoidFullSQLRequest.class,
6565
AvoidListComprehensionInIterations.class,
66-
DetectUnoptimizedImageFormat.class
66+
DetectUnoptimizedImageFormat.class,
67+
AvoidMultipleIfElseStatementCheck.class
6768
);
6869
}
6970
}

0 commit comments

Comments
 (0)