Skip to content

Commit

Permalink
migration from ecocode to creedengo
Browse files Browse the repository at this point in the history
  • Loading branch information
dedece35 committed Dec 10, 2024
1 parent c1c55fe commit 4cf008d
Show file tree
Hide file tree
Showing 252 changed files with 1,163 additions and 1,038 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,27 @@ jobs:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

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

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

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

- name: Verify
run: ./mvnw -e -B verify
- name: Build and analyze
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=green-code-initiative_creedengo-rules-specifications
22 changes: 11 additions & 11 deletions .github/workflows/publish_to_maven_central.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# - Go to: https://s01.oss.sonatype.org/#stagingRepositories
# - Check upload and if all is right, "Close" corresponding Staging Repository
# - "Release" corresponding Staging Repository
# - Wait some hours and then check availability of release on Maven central: https://search.maven.org/search?q=g:io.ecocode
# - Wait some hours and then check availability of release on Maven central: https://search.maven.org/search?q=g:org.greencodeinitiative
#
# Additional information:
# - https://docs.github.com/en/actions/publishing-packages/publishing-java-packages-with-maven#publishing-packages-to-the-maven-central-repository
Expand All @@ -23,18 +23,18 @@ jobs:
steps:
# Checks out a copy of project's repository.
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

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

Expand All @@ -45,12 +45,12 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

# Runs the Maven command to publish to the `ossrh` repository.
# The `OSSRH_USERNAME` environment variable will be set with the contents of your `OSSRH_USERNAME` secret,
# and the `OSSRH_TOKEN` environment variable will be set with the contents of your `OSSRH_TOKEN` secret.
# Runs the Maven command to publish to the maven central repository.
# The `MAVEN_CENTRAL_USERNAME` environment variable will be set with the contents of your `MAVEN_CENTRAL_USERNAME` secret,
# and the `MAVEN_CENTRAL_TOKEN` environment variable will be set with the contents of your `MAVEN_CENTRAL_TOKEN` secret.
- name: Publish package
run: ./mvnw --batch-mode deploy -Pmaven-central-publishing
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Deleted

## [2.0.0] - 2024-12-10

### Changed

- First official release of creedengo-rules-specifications component (renaming ECxx rule ids to GCIxx rule ids, refactoring)

## [1.6.5] - 2024-10-18

### Changed
Expand Down
2 changes: 1 addition & 1 deletion CODE_STYLE.md
Original file line number Diff line number Diff line change
@@ -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.
Please read common [CODE_STYLE.md](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/CODE_STYLE.md) in `creedengo-common` repository.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Please read common [CONTRIBUTING.md](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CONTRIBUTING.md) in `ecoCode-common` repository.
Please read common [CONTRIBUTING.md](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/CONTRIBUTING.md) in `creedengo-common` repository.
19 changes: 2 additions & 17 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,6 @@

## Common installation notes / requirements

Please read common [HOWTO.md](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/HOWTO.md)
in `ecoCode-common` repository. Please follow the specific guides below for additional information on installing the
Please read common [HOWTO.md](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/HOWTO.md)
in `creedengo-common` repository. Please follow the specific guides below for additional information on installing the
desired plugins.

## Special points for Standard plugins

### Project structure

Here is a preview of project tree :

```txt
ecoCode # Root directory
|
+--ecocode-rules-specifications # rules specifications
```

You will find more information about the plugins’ architecture in their folders
59 changes: 53 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
![Logo](docs/resources/logo-large.png)
======================================

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

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

**Warning**: this is still a very early stage project. Any feedback or contribution will be highly appreciated. Please
Expand Down Expand Up @@ -53,15 +53,62 @@ For example, you’ll be able to access of all your `for` loop, to explore conte

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

### ecoCode rules specification repository

This project contains the specifications of all ecoCode rules, for all languages.

#### Structure

Rules are organized by folder based on their ID in the [root rules folder](../src/main/rules).
Each of these folders contains a file with the metadata of the rule, and description by language.

The metadata file uses the format supported by
the [SonarSource Analyzers Commons](https://github.com/SonarSource/sonar-analyzer-commons/tree/master/commons) library.
To find out what values can be put there, we advise you to use the
official [SonarQube documentation](https://docs.sonarsource.com/sonarqube/latest/user-guide/rules/overview/), and to
rely on already existing files.

Here is an example:

```text
src/main/rules
├── EC104
│ ├── java
│ │ ├── EC104.asciidoc
│ │ ├── EC104.json
│ ├── php
│ │ ├── EC104.asciidoc
│ ├── python
│ │ ├── EC104.asciidoc
│ └── EC104.json
├── ...
```

To specify metadata for a given language (for example deprecate a rule only for a single language), it is possible to
create a json file in the language folder, and this will be merged with the common file during build. The keys in the
specific file have priority and it is possible to add new ones but not to delete them from the global one.

#### Description language

The description of the rules uses the ASCIIDOC format (
with [Markdown compatibility](https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/#markdown-compatibility))
in order to allow the inclusion of other pages (this feature is not available in standard with Markdown).

See:

* [AsciiDoc Syntax Quick Reference](https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/)
* [Compare AsciiDoc to Markdown](https://docs.asciidoctor.org/asciidoc/latest/asciidoc-vs-markdown/)


🚀 Getting Started
------------------

You can quickly have a look of ecoCode plugins with docker. Plase have a look at "Getting started" section of each plugin :

- [Java plugin](https://github.com/green-code-initiative/ecoCode-java?tab=readme-ov-file#-getting-started)
- [PHP plugin](https://github.com/green-code-initiative/ecoCode-php?tab=readme-ov-file#-getting-started)
- [Python plugin](https://github.com/green-code-initiative/ecoCode-python?tab=readme-ov-file#-getting-started)
- [C# plugin](https://github.com/green-code-initiative/ecoCode-csharp?tab=readme-ov-file#-getting-started)
- [Java plugin](https://github.com/green-code-initiative/creedengo-java?tab=readme-ov-file#-getting-started)
- [PHP plugin](https://github.com/green-code-initiative/creedengo-php?tab=readme-ov-file#-getting-started)
- [Python plugin](https://github.com/green-code-initiative/creedengo-python?tab=readme-ov-file#-getting-started)
- [C# plugin](https://github.com/green-code-initiative/creedengo-csharp?tab=readme-ov-file#-getting-started)

🛒 Distribution
------------------
Expand Down
45 changes: 0 additions & 45 deletions ecocode-rules-specifications/README.md

This file was deleted.

Loading

0 comments on commit 4cf008d

Please sign in to comment.