Skip to content

Commit d07da17

Browse files
committed
2 parents dcd621f + c0f117a commit d07da17

File tree

263 files changed

+1797
-1391
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

263 files changed

+1797
-1391
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,27 @@ jobs:
2525
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
2626

2727
- name: Set up JDK 11
28-
uses: actions/setup-java@v3
28+
uses: actions/setup-java@v4
2929
with:
3030
distribution: 'temurin'
3131
java-version: 11
3232

33+
- name: Cache SonarQube packages
34+
uses: actions/cache@v4
35+
with:
36+
path: ~/.sonar/cache
37+
key: ${{ runner.os }}-sonar
38+
restore-keys: ${{ runner.os }}-sonar
39+
3340
- name: Cache Maven packages
34-
uses: actions/cache@v3
41+
uses: actions/cache@v4
3542
with:
3643
path: ~/.m2
3744
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
3845
restore-keys: ${{ runner.os }}-m2
3946

40-
- name: Verify
41-
run: ./mvnw -e -B verify
47+
- name: Build and analyze
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
50+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
51+
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar

.github/workflows/publish_to_maven_central.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# - Go to: https://s01.oss.sonatype.org/#stagingRepositories
55
# - Check upload and if all is right, "Close" corresponding Staging Repository
66
# - "Release" corresponding Staging Repository
7-
# - Wait some hours and then check availability of release on Maven central: https://search.maven.org/search?q=g:io.ecocode
7+
# - Wait some hours and then check availability of release on Maven central: https://search.maven.org/search?q=g:org.greencodeinitiative
88
#
99
# Additional information:
1010
# - https://docs.github.com/en/actions/publishing-packages/publishing-java-packages-with-maven#publishing-packages-to-the-maven-central-repository
@@ -23,34 +23,34 @@ jobs:
2323
steps:
2424
# Checks out a copy of project's repository.
2525
- name: Checkout
26-
uses: actions/checkout@v3
26+
uses: actions/checkout@v4
2727

2828
# Sets up the Java JDK, and also configures the Maven `settings.xml` file to add authentication for the
2929
# `ossrh` repository using the `OSSRH_USERNAME` and `OSSRH_TOKEN` environment variables.
3030
- name: Set up Maven Central Repository
31-
uses: actions/setup-java@v3
31+
uses: actions/setup-java@v4
3232
with:
3333
java-version: '11'
3434
distribution: 'adopt'
35-
server-id: 'ossrh' # must match the serverId configured for the nexus-staging-maven-plugin in `pom.xml`
36-
server-username: OSSRH_USERNAME
37-
server-password: OSSRH_TOKEN
35+
server-id: 'central' # must match the serverId configured for the central-publishing-maven-plugin in `pom.xml`
36+
server-username: MAVEN_USERNAME
37+
server-password: MAVEN_PASSWORD
3838
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Substituted with the value stored in the referenced secret
3939
gpg-passphrase: MAVEN_GPG_PASSPHRASE # Env var that holds the key's passphrase
4040

41-
- name: Cache Maven packages
42-
uses: actions/cache@v1
43-
with:
44-
path: ~/.m2
45-
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
46-
restore-keys: ${{ runner.os }}-m2
41+
# - name: Cache Maven packages
42+
# uses: actions/cache@v1
43+
# with:
44+
# path: ~/.m2
45+
# key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
46+
# restore-keys: ${{ runner.os }}-m2
4747

48-
# Runs the Maven command to publish to the `ossrh` repository.
49-
# The `OSSRH_USERNAME` environment variable will be set with the contents of your `OSSRH_USERNAME` secret,
50-
# and the `OSSRH_TOKEN` environment variable will be set with the contents of your `OSSRH_TOKEN` secret.
48+
# Runs the Maven command to publish to the maven central repository.
49+
# The `MAVEN_CENTRAL_USERNAME` environment variable will be set with the contents of your `MAVEN_CENTRAL_USERNAME` secret,
50+
# and the `MAVEN_CENTRAL_TOKEN` environment variable will be set with the contents of your `MAVEN_CENTRAL_TOKEN` secret.
5151
- name: Publish package
5252
run: ./mvnw --batch-mode deploy -Pmaven-central-publishing
5353
env:
54-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
55-
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
54+
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
55+
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
5656
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

CHANGELOG.md

Lines changed: 159 additions & 137 deletions
Large diffs are not rendered by default.

CODE_STYLE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Please read common [CODE_STYLE.md](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CODE_STYLE.md) in `ecoCode-common` repository.
1+
Please read common [CODE_STYLE.md](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/CODE_STYLE.md) in `creedengo-common` repository.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Please read common [CONTRIBUTING.md](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CONTRIBUTING.md) in `ecoCode-common` repository.
1+
Please read common [CONTRIBUTING.md](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/CONTRIBUTING.md) in `creedengo-common` repository.

INSTALL.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,6 @@
66

77
## Common installation notes / requirements
88

9-
Please read common [HOWTO.md](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/HOWTO.md)
10-
in `ecoCode-common` repository. Please follow the specific guides below for additional information on installing the
9+
Please read common [HOWTO.md](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/HOWTO.md)
10+
in `creedengo-common` repository. Please follow the specific guides below for additional information on installing the
1111
desired plugins.
12-
13-
## Special points for Standard plugins
14-
15-
### Project structure
16-
17-
Here is a preview of project tree :
18-
19-
```txt
20-
ecoCode # Root directory
21-
|
22-
+--ecocode-rules-specifications # rules specifications
23-
24-
```
25-
26-
You will find more information about the plugins’ architecture in their folders

README.md

Lines changed: 82 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
1-
![Logo](docs/resources/logo-large.png)
1+
![Logo](docs/resources/creedengo_logo.png)
22
======================================
33

4-
_ecoCode_ is a collective project aiming to reduce environmental footprint of software at the code level. The goal of
4+
_creedengo_ is a collective project aiming to reduce environmental footprint of software at the code level. The goal of
55
the project is to provide a list of static code analyzers to highlight code structures that may have a negative
66
ecological impact: energy and resources over-consumption, "fatware", shortening terminals' lifespan, etc.
77

8-
_ecoCode_ is based on evolving catalogs of [good practices](docs/rules), for various technologies. A SonarQube plugin
8+
_creedengo_ is based on evolving catalogs of [good practices](docs/rules), for various technologies. A SonarQube plugin
99
then implements these catalogs as rules for scanning your projects.
1010

1111
**Warning**: this is still a very early stage project. Any feedback or contribution will be highly appreciated. Please
1212
refer to the contribution section.
1313

1414
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
15-
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CODE_OF_CONDUCT.md)
15+
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/CODE_OF_CONDUCT.md)
1616

1717
🌿 SonarQube Plugins
1818
-------------------
1919

20-
7 technologies are supported by ecoCode right now:
20+
7 technologies are supported by creedengo right now:
2121

2222
- "standard" plugins :
23-
- [Java plugin](https://github.com/green-code-initiative/ecoCode-java)
24-
- [JavaScript plugin](https://github.com/green-code-initiative/ecoCode-javascript)
25-
- [PHP plugin](https://github.com/green-code-initiative/ecoCode-php)
26-
- [Python plugin](https://github.com/green-code-initiative/ecoCode-python)
27-
- [C# plugin](https://github.com/green-code-initiative/ecoCode-csharp)
23+
- [Java plugin](https://github.com/green-code-initiative/creedengo-java)
24+
- [JavaScript plugin](https://github.com/green-code-initiative/creedengo-javascript)
25+
- [PHP plugin](https://github.com/green-code-initiative/creedengo-php)
26+
- [Python plugin](https://github.com/green-code-initiative/creedengo-python)
27+
- [C# plugin](https://github.com/green-code-initiative/creedengo-csharp)
2828
- mobile plugins :
29-
- [Android plugin](https://github.com/green-code-initiative/ecoCode-android)
30-
- [iOS plugin](https://github.com/green-code-initiative/ecoCode-ios)
29+
- [Android plugin](https://github.com/green-code-initiative/creedengo-android)
30+
- [iOS plugin](https://github.com/green-code-initiative/creedengo-ios)
3131

3232
![Screenshot](docs/resources/screenshot.PNG)
3333

@@ -44,7 +44,7 @@ There are two kinds of plugins :
4444
The current repository is for web / backOffice
4545
- One for mobile (Android), using [a set of smells](https://olegoaer.perso.univ-pau.fr/android-energy-smells/) theorised
4646
by Olivier Le Goaër for Android.
47-
You can find this plugin in the repository [here](https://github.com/green-code-initiative/ecocode-mobile)
47+
You can find this plugin in the repository [here](https://github.com/green-code-initiative/creedengo-mobile)
4848

4949
### How a SonarQube plugin works
5050

@@ -53,41 +53,88 @@ For example, you’ll be able to access of all your `for` loop, to explore conte
5353

5454
To better understand AST structure, you can use the [AST Explorer](https://astexplorer.net/).
5555

56+
### creedengo rules specification repository
57+
58+
This project contains the specifications of all creedengo rules, for all languages.
59+
60+
#### Structure
61+
62+
Rules are organized by folder based on their ID in the [root rules folder](src/main/rules).
63+
Each of these folders contains a file with the metadata of the rule, and description by language.
64+
65+
The metadata file uses the format supported by
66+
the [SonarSource Analyzers Commons](https://github.com/SonarSource/sonar-analyzer-commons/tree/master/commons) library.
67+
To find out what values can be put there, we advise you to use the
68+
official [SonarQube documentation](https://docs.sonarsource.com/sonarqube/latest/user-guide/rules/overview/), and to
69+
rely on already existing files.
70+
71+
Here is an example:
72+
73+
```text
74+
src/main/rules
75+
├── EC104
76+
│ ├── java
77+
│ │ ├── EC104.asciidoc
78+
│ │ ├── EC104.json
79+
│ ├── php
80+
│ │ ├── EC104.asciidoc
81+
│ ├── python
82+
│ │ ├── EC104.asciidoc
83+
│ └── EC104.json
84+
├── ...
85+
```
86+
87+
To specify metadata for a given language (for example deprecate a rule only for a single language), it is possible to
88+
create a json file in the language folder, and this will be merged with the common file during build. The keys in the
89+
specific file have priority and it is possible to add new ones but not to delete them from the global one.
90+
91+
#### Description language
92+
93+
The description of the rules uses the ASCIIDOC format (
94+
with [Markdown compatibility](https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/#markdown-compatibility))
95+
in order to allow the inclusion of other pages (this feature is not available in standard with Markdown).
96+
97+
See:
98+
99+
* [AsciiDoc Syntax Quick Reference](https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/)
100+
* [Compare AsciiDoc to Markdown](https://docs.asciidoctor.org/asciidoc/latest/asciidoc-vs-markdown/)
101+
102+
56103
🚀 Getting Started
57104
------------------
58105

59-
You can quickly have a look of ecoCode plugins with docker. Plase have a look at "Getting started" section of each plugin :
106+
You can quickly have a look of creedengo plugins with docker. Plase have a look at "Getting started" section of each plugin :
60107

61-
- [Java plugin](https://github.com/green-code-initiative/ecoCode-java?tab=readme-ov-file#-getting-started)
62-
- [PHP plugin](https://github.com/green-code-initiative/ecoCode-php?tab=readme-ov-file#-getting-started)
63-
- [Python plugin](https://github.com/green-code-initiative/ecoCode-python?tab=readme-ov-file#-getting-started)
64-
- [C# plugin](https://github.com/green-code-initiative/ecoCode-csharp?tab=readme-ov-file#-getting-started)
108+
- [Java plugin](https://github.com/green-code-initiative/creedengo-java?tab=readme-ov-file#-getting-started)
109+
- [PHP plugin](https://github.com/green-code-initiative/creedengo-php?tab=readme-ov-file#-getting-started)
110+
- [Python plugin](https://github.com/green-code-initiative/creedengo-python?tab=readme-ov-file#-getting-started)
111+
- [C# plugin](https://github.com/green-code-initiative/creedengo-csharp?tab=readme-ov-file#-getting-started)
65112

66113
🛒 Distribution
67114
------------------
68115

69-
The main way to get ecoCode plugins is to download them from your SonarQube Marketplace (available in Administration section).
116+
The main way to get creedengo plugins is to download them from your SonarQube Marketplace (available in Administration section).
70117
But if you want, you can also download them from GitHub releases.
71118

72-
We had split our plugins repository `ecocode` to one repository for each plugin on december 2023.
119+
We had split our plugins repository `creedengo` to one repository for each plugin on december 2023.
73120
Thus, plugin versions are available on 2 repositories depending on version you want :
74121

75122
- Java plugin :
76-
- from 0.x to 1.4.3 : [ecocode repository](https://github.com/green-code-initiative/ecoCode/releases)
77-
- since 1.5.0 : [ecoCode-java repository](https://github.com/green-code-initiative/ecoCode-java/releases)
123+
- from 0.x to 1.4.3 : [creedengo repository](https://github.com/green-code-initiative/creedengo-rules-specifications/releases)
124+
- since 1.5.0 : [creedengo-java repository](https://github.com/green-code-initiative/creedengo-java/releases)
78125
- PHP plugin :
79-
- from 0.x to 1.3.1 : [ecocode repository](https://github.com/green-code-initiative/ecoCode/releases)
80-
- since 1.4.0 : [ecoCode-php repository](https://github.com/green-code-initiative/ecoCode-php/releases)
126+
- from 0.x to 1.3.1 : [creedengo repository](https://github.com/green-code-initiative/creedengo-rules-specifications/releases)
127+
- since 1.4.0 : [creedengo-php repository](https://github.com/green-code-initiative/creedengo-php/releases)
81128
- Python plugin :
82-
- from 0.x to 1.3.1 : [ecocode repository](https://github.com/green-code-initiative/ecoCode/releases)
83-
- since 1.4.0 : [ecoCode-python repository](https://github.com/green-code-initiative/ecoCode-python/releases)
129+
- from 0.x to 1.3.1 : [creedengo repository](https://github.com/green-code-initiative/creedengo-rules-specifications/releases)
130+
- since 1.4.0 : [creedengo-python repository](https://github.com/green-code-initiative/creedengo-python/releases)
84131
- Javascript plugin :
85-
- from 0.x to 1.3.0 : [ecocode repository](https://github.com/green-code-initiative/ecoCode/releases)
86-
- since 1.4.0 : [ecoCode-javascript repository](https://github.com/green-code-initiative/ecoCode-javascript/releases)
132+
- from 0.x to 1.3.0 : [creedengo repository](https://github.com/green-code-initiative/creedengo-rules-specifications/releases)
133+
- since 1.4.0 : [creedengo-javascript repository](https://github.com/green-code-initiative/creedengo-javascript/releases)
87134
- C# plugin :
88-
- since 0.x : [ecocode repository](https://github.com/green-code-initiative/ecoCode-csharp/releases)
89-
- Android plugin : [ecoCode-android repository](https://github.com/green-code-initiative/ecoCode-android/releases)
90-
- iOS plugin : [ecoCode-ios repository](https://github.com/green-code-initiative/ecoCode-ios/releases)
135+
- since 0.x : [creedengo repository](https://github.com/green-code-initiative/creedengo-csharp/releases)
136+
- Android plugin : [creedengo-android repository](https://github.com/green-code-initiative/creedengo-android/releases)
137+
- iOS plugin : [creedengo-ios repository](https://github.com/green-code-initiative/creedengo-ios/releases)
91138

92139
🧩 Plugins version compatibility
93140
------------------
@@ -128,7 +175,7 @@ We are listening to you to make the project progress collectively, and maybe wit
128175

129176
WE NEED YOU !
130177

131-
Here the [Starter pack](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/starter-pack.md)
178+
Here the [Starter pack](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/starter-pack.md)
132179

133180
🤓 Main contributors
134181
--------------------
@@ -145,8 +192,10 @@ Then, if no answer, contact ...
145192
- [Maxime DUBOIS](https://www.linkedin.com/in/maxime-dubois-%F0%9F%8C%B1-649a3a3/)
146193
- [David DE CARVALHO](https://www.linkedin.com/in/david%E2%80%8E-de-carvalho-8b395284/)
147194
- [Maxime MALGORN](https://www.linkedin.com/in/maximemalgorn/)
195+
- [Gilles GROUSSET](https://www.linkedin.com/in/gillesgrousset/)
148196
- [Vianney DE BELLABRE](https://www.linkedin.com/in/vianney-de-bellabre/)
149197
- [Jérôme CARDON](https://www.linkedin.com/in/jcardon79/)
198+
- [Johanna DUIGOU](https://www.linkedin.com/in/johannaduigou/)
150199

151200
🧐 Core Team Emeriti
152201
--------------------
@@ -157,7 +206,7 @@ Here we honor some no-longer-active core team members who have made valuable con
157206
- [Nicolas Daviet](https://github.com/NicolasDaviet)
158207
- [Mathilde Grapin](https://github.com/fkotd)
159208

160-
They have contributed to the success of ecoCode :
209+
They have contributed to the success of creedengo :
161210

162211
- [Davidson Consulting](https://www.davidson.fr/)
163212
- [Orange Business](https://www.orange-business.com/)

0 commit comments

Comments
 (0)