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

Update main #4

Merged
merged 48 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f324104
[ISSUE 216] upgrade EC2 rule pour Java (multiple If/Else/Elseif)
dedece35 Aug 15, 2023
bca1538
[ISSUE 216] upgrade EC2 rule pour Java (multiple If/Else/Elseif) - up…
dedece35 Aug 15, 2023
25bdb8b
Update README.md
utarwyn Aug 17, 2023
ead21dc
Merge branch 'main' into ISSUE_216_javaMultipleIfElse
dedece35 Aug 25, 2023
2ef316d
Merge pull request #222 from green-code-initiative/ISSUE_216_javaMult…
dedece35 Sep 1, 2023
fdaac90
[ISSUE 216] upgrade EC2 rule pour Java (multiple If/Else/Elseif) - up…
dedece35 Sep 1, 2023
c2e2cbe
[ISSUE 106] rule EC67 not relevant neither for python nor Rust
dedece35 Sep 1, 2023
27bab5e
[ISSUE 106] rule EC67 not relevant neither for python nor Rust - upgr…
dedece35 Sep 1, 2023
30dc28b
Update CHANGELOG.md
dedece35 Sep 8, 2023
1ac339d
move enum to another package
dedece35 Sep 15, 2023
d89e2a2
refacto - upgrade licences
dedece35 Sep 15, 2023
a12180a
refacto - upgrade licences : update CHANGELOG
dedece35 Sep 15, 2023
5783040
Merge pull request #225 from green-code-initiative/REFACTO_LICENCE
dedece35 Sep 22, 2023
1bd5870
[ISSUE 140] rule EC3 : no implementation for python
dedece35 Sep 22, 2023
f55d00c
[ISSUE 140] rule EC3 : no implementation for python - CHANGELOG
dedece35 Sep 22, 2023
67e93e7
[ISSUE 136] rule EC53 : no implementation for python
dedece35 Sep 22, 2023
cd0e442
Use Java 17 for the SonarQube scan
utarwyn Oct 5, 2023
e59aa05
Add new issue template to suggest new rule
dedece35 Oct 6, 2023
16d1c90
Merge pull request #229 from green-code-initiative/sonar-scanner-jdk-17
utarwyn Oct 6, 2023
745f6ad
[PR 128-ecocode] replace EC34 by EC35 : update CHANGELOG, update rule…
dedece35 Oct 21, 2023
cba9523
chore: Adds rule specifications from: https://github.com/green-code-i…
jycr Jun 29, 2023
18ff499
chore: Adds rule specifications from: https://github.com/green-code-i…
jycr Jul 2, 2023
e8d214f
chore: Adds rule specifications from: https://github.com/green-code-i…
jycr Jul 2, 2023
ce9105c
refactor(rule/android - java): Modify rule keys
jycr Jun 29, 2023
29e326d
feat(rule/android - java): Convert HTML to ASCIIDOC
jycr Jul 2, 2023
135f0c9
refactor(rule/android - java): Move ecoScore to JSON metadata
jycr Jul 2, 2023
8b4a685
refactor(rule/android - xml): Modify rule keys
jycr Jul 2, 2023
a95712e
refactor(rule/ios - swift): Modify rule keys
jycr Jul 2, 2023
5a28f8d
feat(rule/ios - swift): Convert HTML to ASCIIDOC
jycr Jul 2, 2023
a751983
feat(rule/android - xml): Convert HTML to ASCIIDOC
jycr Jul 2, 2023
85ebbe7
Removes some warnings in build
jycr Jul 10, 2023
8f46e41
Removes metadata for rules not available in corresponding language
jycr Jul 10, 2023
e577d18
Renames "js" and "ts" languages to "javascript"
jycr Jul 10, 2023
d23fcab
Removes unnecessary dependencies and plugins
jycr Jul 10, 2023
45ab514
Changes resources processing from Groovy script to java/jshell script
jycr Aug 3, 2023
16560b4
[PR 128-ecocode] replace EC34 by EC35 : keep EC34 to be deleted later
dedece35 Oct 23, 2023
e97e9fc
[PR 128-ecocode] replace EC34 by EC35 : correct typo
dedece35 Oct 23, 2023
6535e31
Merge pull request #236 from green-code-initiative/EC34-replace
dedece35 Oct 27, 2023
175a2d3
[ISSUE 209] fix: "java.lang.NoClassDefFoundError: org/sonarsource/ana…
jycr Oct 27, 2023
8d513e6
Merge branch 'main' into feature/optimize-rules-specifications-artifact
jycr Oct 27, 2023
47ae217
Merge pull request #209 from green-code-initiative/feature/optimize-r…
jycr Oct 27, 2023
3a98026
Add doc for rules added in JS module v1.4.0
utarwyn Sep 18, 2023
9ea9efa
Move all Javascript rules
utarwyn Sep 18, 2023
dc9ba2e
Merge branch 'main' into feature/migrate-mobile-rule
jycr Oct 27, 2023
d21cee0
Merge pull request #226 from green-code-initiative/add-javascript-rules
utarwyn Oct 27, 2023
3794bd5
update ecocode-rule-specifications version
dedece35 Oct 27, 2023
576bf4d
update ecocode-rule-specifications version
dedece35 Oct 27, 2023
20035d7
Merge pull request #237 from green-code-initiative/feature/migrate-mo…
jycr Oct 28, 2023
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
118 changes: 118 additions & 0 deletions .github/ISSUE_TEMPLATE/new_rule_suggestion.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
---
name: New rule suggestion
about: Suggest an new rule idea for this project
title: ''
labels: 'rule'
assignees: ''

---

# {Category: RuleTitle (Variant)}

## Platform

| OS | OS version | Langage |
|---------------|--------------|------------|
| {Android/IOS} | {OS version} | {Language} |

## Main caracteristics

| ID | Title | Category | Sub-category |
|----------|----------------------|-------------|----------------|
| {id} | {title} | {Category} | {SubCategory} |

## Severity / Remediation Cost

- **Case 1**:
| Severity | Remediation Cost |
|------------|---------------------|
| {Severity} | {Remediation_Cost} |
- **Case 2**:
| Severity | Remediation Cost |
|------------|---------------------|
| {Severity} | {Remediation_Cost} |

## Rule short description

- **Case 1**: {short description}
- **Case 2**: {short description}

## Rule complete description

## Text

{big description}

## HTML

```html
{html code}
```

## Implementation principle

- {Implementation principe}
- {Implementation principe}
17 h 17
voici le template
17 h 17
et voici un example :
17 h 17

# Optimized API: List Shallow Copy - Module copy

## Platform

| OS | OS version | Langage |
|----------|------------|-----------|
| - | - | Python |

## Main caracteristics

| ID | Title | Category | Sub-category |
|---------|----------------------------------|-------------|----------------|
| EOPT001 | List Shallow Copy - Module copy | Environment | Optimized API |

## Severity / Remediation Cost

| Severity | Remediation Cost |
|----------|------------------|
| Minor | Minor |

## Rule short description

Using `copy.copy(x)` of `module copy` to perform a shallow copy of a list is not energy efficient.

## Rule complete description

### Text

Using `copy.copy(x)` of `module copy` to perform a shallow copy of a list is not energy efficient.
Prefer the usage of `list.copy()` which is more energy friendly.

### HTML

```html
<p>Using <code>copy.copy(x)</code> of <code>module copy</code> to perform a shallow
copy of a list is not energy efficient.</p>
<p>Prefer the usage of <code>list.copy()</code> which is more energy friendly.</p>
<h2>Noncompliant Code Example</h2>
<pre>
import copy
my_list = [1, 2, [3, 4], 5]
list_copy = copy.copy(my_list)
</pre>
<h2>Compliant Solution</h2>
<pre>
my_list = [1, 2, [3, 4], 5]
list_copy = my_list.copy()
</pre>
```

## Implementation principle

- Inspect the import node to find `copy` import
- Inspect the ARG_LIST node
- If the direct parent is CALL_EXPR tree and the function is `copy.copy()`
- If the function is present, check the first argument
- If it is a list, report the line
40 changes: 28 additions & 12 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Build and Tests

on:
push:
branches:
Expand All @@ -9,7 +10,8 @@ on:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
pull_request:
types: [opened, synchronize, reopened]
types: [ opened, synchronize, reopened ]

jobs:
build:
name: Build
Expand All @@ -18,27 +20,41 @@ jobs:
pull-requests: read # allows SonarCloud to decorate PRs with analysis results
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Set up JDK 11
uses: actions/setup-java@v1
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 11
- name: Cache SonarCloud packages
uses: actions/cache@v1
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: Cache Maven packages
uses: actions/cache@v1
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and analyze

- name: Verify
run: mvn -e -B verify

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17

- name: Cache SonarQube packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar

- name: SonarQube Scan
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -e -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=green-code-initiative_ecoCode -Dsonar.exclusions=**/*.groovy,**/*.dummy
run: mvn -e -B org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=green-code-initiative_ecoCode
11 changes: 9 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

### Changed

- [ios#3](https://github.com/green-code-initiative/ecoCode-ios/issues/3) Move iOS rules into centralized rules repository
- [android#67](https://github.com/green-code-initiative/ecoCode-android/issues/67) Move Android rules into centralized rules repository
- [#216](https://github.com/green-code-initiative/ecoCode/issues/216) Upgrade rule EC2 for Java : Multiple if-else statement improvment
- [#106](https://github.com/green-code-initiative/ecoCode/issues/106) Upgrade RULES.md : rule EC67 not relevant neither for Python nor Rust
- [#225](https://github.com/green-code-initiative/ecoCode/pull/225) Upgrade licence system and licence headers of Java files
- [#140](https://github.com/green-code-initiative/ecoCode/issues/140) Upgrade rule EC3 for Python : no implementation possible for python
- [#136](https://github.com/green-code-initiative/ecoCode/issues/136) Upgrade rule EC53 for Python : no implementation possible for python
- [#128](https://github.com/green-code-initiative/ecoCode/pull/128) Adding EC35 rule for Python and PHP : EC35 rule replaces EC34 with a specific use case ("file not found" sepcific)

### Deleted

## [1.4.0] - 2023-08-08
Expand Down
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ refer to the contribution section.

- [Java](java-plugin/)
- [JavaScript](https://github.com/green-code-initiative/ecoCode-javascript)
- [PHP](php-plugin/)
- [PHP](https://github.com/green-code-initiative/ecoCode-php)
- [Python](https://github.com/green-code-initiative/ecoCode-python)

![Screenshot](docs/resources/screenshot.PNG)
Expand Down Expand Up @@ -78,24 +78,26 @@ Ready to use binaries are available [from GitHub](https://github.com/green-code-

| Plugins Version | SonarQube version |
|------------------|-----------------------------|
| 0.1.+ | SonarQube 8.9.+ LTS to 9.3 |
| 0.2.+ | SonarQube 9.4.+ LTS to 9.9 |
| 1.0.+ | SonarQube 9.4.+ LTS to 9.9 |
| 1.1.+ | SonarQube 9.4.+ LTS to 9.9 |
| 1.2.+ | SonarQube 9.4.+ LTS to 10.0 |
| 1.4.+ | SonarQube 9.4.+ LTS to 10.1 |
| 1.3.+ | SonarQube 9.4.+ LTS to 10.0 |
| 1.2.+ | SonarQube 9.4.+ LTS to 10.0 |
| 1.1.+ | SonarQube 9.4.+ LTS to 9.9 |
| 1.0.+ | SonarQube 9.4.+ LTS to 9.9 |
| 0.2.+ | SonarQube 9.4.+ LTS to 9.9 |
| 0.1.+ | SonarQube 8.9.+ LTS to 9.3 |

☕ Plugin Java part compatibility
------------------

| Plugins Version | Java version |
|------------------|--------------|
| 0.1.+ | 11 / 17 |
| 0.2.+ | 11 / 17 |
| 1.0.+ | 11 / 17 |
| 1.1.+ | 11 / 17 |
| 1.2.+ | 11 / 17 |
| 1.4.+ | 11 / 17 |
| 1.3.+ | 11 / 17 |
| 1.2.+ | 11 / 17 |
| 1.1.+ | 11 / 17 |
| 1.0.+ | 11 / 17 |
| 0.2.+ | 11 / 17 |
| 0.1.+ | 11 / 17 |

🤝 Contribution
---------------
Expand Down Expand Up @@ -126,6 +128,7 @@ Then, if no answer, contact ...
- [Olivier Le Goaër](https://olegoaer.perso.univ-pau.fr)
- [Maxime DUBOIS](https://www.linkedin.com/in/maxime-dubois-%F0%9F%8C%B1-649a3a3/)
- [David DE CARVALHO](https://www.linkedin.com/in/david%E2%80%8E-de-carvalho-8b395284/)
- [Maxime MALGORN](https://www.linkedin.com/in/maximemalgorn/)

🧐 Core Team Emeriti
--------------------
Expand Down
Loading
Loading