Skip to content

Feature/rename project #11

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

Merged
merged 9 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: mvn -e -B sonar:sonar -Dsonar.projectKey=green-code-initiative_ecoCode-csharp-sonarqube -Pcode-analysis
run: mvn -e -B sonar:sonar -Dsonar.projectKey=green-code-initiative_creedengo-csharp-sonarqube -Pcode-analysis
4 changes: 2 additions & 2 deletions .github/workflows/build_container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ on:

env:
# github.repository as <account>/<repo>
IMAGE_NAME: sonarqube-ecocode-csharp
IMAGE_NAME: sonarqube-creedengo-csharp
IMAGES: |
ghcr.io/${{ github.repository_owner }}/sonarqube-ecocode-csharp
ghcr.io/${{ github.repository_owner }}/sonarqube-creedengo-csharp

jobs:
Build:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tag_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
id: export_jar_files
uses: actions/upload-artifact@v4
with:
name: ecocode-plugins
name: creedengo-plugins
path: target
overwrite: true
- name: Export UPLOAD_URL
Expand All @@ -61,7 +61,7 @@ jobs:
id: import_jar_files
uses: actions/download-artifact@v4
with:
name: ecocode-plugins
name: creedengo-plugins
path: target
- name: Upload Release Asset - C# Plugin
id: upload-release-asset
Expand All @@ -70,6 +70,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{needs.build.outputs.upload_url}}
asset_path: target/ecocode-csharp-plugin-${{ github.ref_name }}.jar
asset_name: ecocode-csharp-plugin-${{ github.ref_name }}.jar
asset_path: target/creedengo-csharp-plugin-${{ github.ref_name }}.jar
asset_name: creedengo-csharp-plugin-${{ github.ref_name }}.jar
asset_content_type: application/zip
15 changes: 12 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Deleted

## [2.1.0] - 2025-02-17

### Changed

- First official release of creedengo-csharp-sonarqube plugin (renaming ECxx rule ids to GCIxx rule ids)
- Update creedengo-rules-specifications to 2.2.1
- Update nuget package Creedengo to 2.1.0

## [1.5.1] - 2024-11-01

### Changed
Expand All @@ -28,6 +36,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Depend on ecocode-rules-specifications v1.5.4
- Depend on nuget package EcoCode v1.1.0

[unreleased](https://github.com/green-code-initiative/ecoCode-csharp-sonarqube/compare/1.5.1...HEAD)
[1.5.1](https://github.com/green-code-initiative/ecoCode-csharp-sonarqube/compare/1.1.0...1.5.1)
[1.1.0](https://github.com/green-code-initiative/ecoCode-csharp-sonarqube/releases/tag/1.1.0)
[unreleased](https://github.com/green-code-initiative/creedengo-csharp-sonarqube/compare/2.1.0...HEAD)
[2.1.0](https://github.com/green-code-initiative/creedengo-csharp-sonarqube/compare/1.5.1...2.1.0)
[1.5.1](https://github.com/green-code-initiative/creedengo-csharp-sonarqube/compare/1.1.0...1.5.1)
[1.1.0](https://github.com/green-code-initiative/creedengo-csharp-sonarqube/releases/tag/1.1.0)
2 changes: 1 addition & 1 deletion CODE_STYLE.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Code Style

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,3 +1,3 @@
# Contributing

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.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ ARG SONARQUBE_VERSION=9.9-community

FROM maven:${MAVEN_BUILDER} AS builder

WORKDIR /usr/src/ecocode
WORKDIR /usr/src/creedengo
COPY src src/
COPY pom.xml tool_build.sh ./

RUN ./tool_build.sh

FROM sonarqube:${SONARQUBE_VERSION}
COPY --from=builder /usr/src/ecocode/target/ecocode-*.jar /opt/sonarqube/extensions/plugins/
COPY --from=builder /usr/src/creedengo/target/creedengo-*.jar /opt/sonarqube/extensions/plugins/
USER sonarqube
47 changes: 24 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
EcoCode C#
Creedengo C#
===========

_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](https://github.com/green-code-initiative/ecoCode/blob/main/docs/rules), for various technologies.
_creedengo_ is based on evolving catalogs
of [good practices](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/docs/rules), for various technologies.
This SonarQube plugin then implements these catalogs as rules for scanning your C# projects.

This SonarQube plugin is based on a generated plugin from [SonarSource Sonarqube Roslyn SDK](https://github.com/SonarSource/sonarqube-roslyn-sdk) with a slightly different rules import process.

The _EcoCode C# Sonarqube plugin_ relies on the [EcoCode nuget package](https://www.nuget.org/packages/EcoCode) that is responsible of the codebase analysing part. You can then track detected issues within a compatible Sonarqube instance.
The _Creedengo C# Sonarqube plugin_ relies on the [Creedengo nuget package](https://www.nuget.org/packages/Creedengo) that is responsible of the codebase analysing part. You can then track detected issues within a compatible Sonarqube instance.

> ⚠️ This is still a very early stage project. Any feedback or contribution will be highly appreciated. Please
> refer to the contribution section.

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![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)
[![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)

🌿 SonarQube Plugins
-------------------

This plugin is part of the ecoCode project.\
This plugin is part of the creedengo project.\
You can find a list of all our other plugins in
the [ecoCode repository](https://github.com/green-code-initiative/ecoCode#-sonarqube-plugins)
the [creedengo repository](https://github.com/green-code-initiative/creedengo-rules-specifications#-sonarqube-plugins)

🚀 Getting Started
------------------
Expand All @@ -34,31 +34,31 @@ You can give a try with a one command docker :
```sh
docker run -ti --rm \
-p 9000:9000 \
--name sonarqube-ecocode-csharp ghcr.io/green-code-initiative/sonarqube-ecocode-csharp:latest
--name sonarqube-creedengo-csharp ghcr.io/green-code-initiative/sonarqube-creedengo-csharp:latest
```

or (with logs and data locally stored) :

```sh
docker run -ti --rm \
-v sq_ecocode_logs:/opt/sonarqube/logs \
-v sq_ecocode_data:/opt/sonarqube/data \
-v sq_creedengo_logs:/opt/sonarqube/logs \
-v sq_creedengo_data:/opt/sonarqube/data \
-p 9000:9000 \
--name sonarqube-ecocode-csharp ghcr.io/green-code-initiative/sonarqube-ecocode-csharp:latest
--name sonarqube-creedengo-csharp ghcr.io/green-code-initiative/sonarqube-creedengo-csharp:latest
```

... and configure local SonarQube (security config and quality profile : see [configuration](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/INSTALL.md#configuration-sonarqube) for more details).
... and configure local SonarQube (security config and quality profile : see [configuration](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/HOWTO.md#installing-local-environment-local-sonarqube) for more details).

To install other `ecocode` plugins, you can also :
To install other `creedengo` plugins, you can also :

- download each plugin separatly and copy the plugin (jar file) to `$SONAR_INSTALL_DIR/extensions/plugins` and restart SonarQube.
- install different ecocode plugins with Marketplace (inside admin panel of SonarQube)
- install different creedengo plugins with Marketplace (inside admin panel of SonarQube)

Then you can use C# test project repository to test the environment : see README.md of [C# test project](https://github.com/green-code-initiative/ecoCode-csharp-test-project)
Then you can use C# test project repository to test the environment : see README.md of [C# test project](https://github.com/green-code-initiative/creedengo-csharp-test-project)

To analyze a .net codebase without having to install required components (i.e. .net SDK, JDK/JRE, etc.), you can use our [docker dotnetscan wrapper](./docker-dotnetscan/README.md).

Finally, you can directly use a [all-in-one docker-compose](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/INSTALL.md#start-sonarqube-if-first-time)
Finally, you can directly use a [all-in-one docker-compose](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/HOWTO.md#installing-local-environment-local-sonarqube)

By default, `Dockerfile` use the official [Sonarqube LTS Community](https://hub.docker.com/_/sonarqube) image version.
You can override this behaviour and use a custom version of your choice by specifying a `build-arg` to the build command, for example :
Expand All @@ -77,24 +77,25 @@ docker compose up -d --no-build
🛒 Distribution
------------------

Ready to use binaries are available [from GitHub](https://github.com/green-code-initiative/ecoCode-csharp-sonarqube/releases).
Ready to use binaries are available [from GitHub](https://github.com/green-code-initiative/creedengo-csharp-sonarqube/releases).

🧩 Compatibility
-----------------

| Plugin version | SonarQube version | EcoCode nuget package version |
| -------------- | ------------------- | ----------------------------- |
| 1.1.0+ | 9.9.+ LTS to 10.5.1 | 1.1.0 |
| Plugin version | SonarQube version | creedengo nuget package version |
| -------------- | ------------------- | ------------------------------- |
| 1.1.0+ | 9.9.+ LTS to 10.5.1 | 1.1.0 |
| 2.1.0+ | 9.9.+ LTS to 10.5.1 | 2.1.0 |

🤝 Contribution
---------------

check [ecoCode repository](https://github.com/green-code-initiative/ecoCode#-contribution)
check [creedengo repository](https://github.com/green-code-initiative/creedengo-rules-specifications#-contribution)

🤓 Main contributors
--------------------

check [ecoCode repository](https://github.com/green-code-initiative/ecoCode#-main-contributors)
check [creedengo repository](https://github.com/green-code-initiative/creedengo-rules-specifications#-main-contributors)

Links
-----
Expand Down
2 changes: 1 addition & 1 deletion RULES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Rules
===========

Please read [RULES.md](https://github.com/green-code-initiative/ecoCode/blob/main/RULES.md) in `ecoCode` repository.
Please read [RULES.md](https://github.com/green-code-initiative/creedengo-rules-specifications/blob/main/RULES.md) in `creedengo-rules-specification` repository.
6 changes: 3 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
name: sonarqube_ecocode_csharp
name: sonarqube_creedengo_csharp

services:
sonar:
build: .
container_name: sonar_ecocode_csharp
container_name: sonar_creedengo_csharp
ports:
- "9000:9000"
networks:
Expand All @@ -29,7 +29,7 @@ services:

db:
image: postgres:12
container_name: postgresql_ecocode_csharp
container_name: postgresql_creedengo_csharp
networks:
- sonarnet
volumes:
Expand Down
4 changes: 2 additions & 2 deletions docker-dotnetscan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ docker build -t scanner .
#### Prerequisites

You need to have an up and running Sonarqube instance with :
- the EcoCode CSharp plugin installed
- Quality profile with EcoCode rules activated
- the creedengo CSharp plugin installed
- Quality profile with creedengo rules activated
- An user token, global or project analysis token, cf. Sonarqube documentation : [Generating and using tokens](https://docs.sonarsource.com/sonarqube/latest/user-guide/user-account/generating-and-using-tokens/)

The following samples commands are based on these assumptions :
Expand Down
4 changes: 2 additions & 2 deletions docker-dotnetscan/docker_dotnetscan_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ get_help_scanning_options() {
echo -e "\t-t|--token\tSonarqube global or project analysis auth token."
echo -e "or\t-l|--login\tSonarqube user auth token.\n"
echo "Optional:"
echo -e "\t-p|--project\tProject key (default: ecoCode-csharp-test-project)"
echo -e "\t-p|--project\tProject key (default: creedengo-csharp-test-project)"
echo -e "\t-u|--url\tUrl to Sonarqube instance (default: http://localhost:9000)"
echo -e "\t-h|--help\tPrint this help\n"
echo "Arguments:"
Expand Down Expand Up @@ -85,7 +85,7 @@ if [[ "$1" == '--' ]]; then shift; fi
CMD_ARGS=$@

# Get passed args value or set to default value
PROJECT_KEY=${project:=ecoCode-csharp-test-project}
PROJECT_KEY=${project:=creedengo-csharp-test-project}
SONAR_HOST=${url:=http://localhost:9000}
if [[ -z $CMD_ARGS ]]; then
DOTNET_ARGS="build"
Expand Down
50 changes: 26 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.ecocode</groupId>
<artifactId>ecocode-csharp-plugin</artifactId>
<version>1.5.2-SNAPSHOT</version>
<groupId>org.green-code-initiative</groupId>
<artifactId>creedengo-csharp-plugin</artifactId>
<version>2.1.0-SNAPSHOT</version>

<packaging>sonar-plugin</packaging>

<name>ecoCode - C# language</name>
<name>creedengo - C# language</name>
<description>Provides rules to reduce the environmental footprint of your C# programs</description>
<inceptionYear>2024</inceptionYear>

<url>https://github.com/green-code-initiative/ecoCode-csharp-sonarqube</url>
<url>https://github.com/green-code-initiative/creedengo-csharp-sonarqube</url>
<organization>
<name>green-code-initiative</name>
<url>https://github.com/green-code-initiative</url>
Expand All @@ -27,15 +29,15 @@
</licenses>

<scm>
<connection>scm:git:https://github.com/green-code-initiative/ecoCode-csharp-sonarqube</connection>
<developerConnection>scm:git:https://github.com/green-code-initiative/ecoCode-csharp-sonarqube</developerConnection>
<url>https://github.com/green-code-initiative/ecoCode-csharp-sonarqube</url>
<connection>scm:git:https://github.com/green-code-initiative/creedengo-csharp-sonarqube</connection>
<developerConnection>scm:git:https://github.com/green-code-initiative/creedengo-csharp-sonarqube</developerConnection>
<url>https://github.com/green-code-initiative/creedengo-csharp-sonarqube</url>
<tag>HEAD</tag>
</scm>

<issueManagement>
<system>GitHub</system>
<url>https://github.com/green-code-initiative/ecoCode-csharp-sonarqube/issues</url>
<url>https://github.com/green-code-initiative/creedengo-csharp-sonarqube/issues</url>
</issueManagement>

<properties>
Expand All @@ -58,17 +60,17 @@
<sonar-analyzer-commons.version>2.5.0.1358</sonar-analyzer-commons.version>
<sonar-packaging.version>1.23.0.740</sonar-packaging.version>

<!-- EcoCode rules specifications from which rules would be used -->
<ecocode-rules-specifications.version>1.6.5</ecocode-rules-specifications.version>
<!-- EcoCode nuget package version to use to build the plugin -->
<nuget.package.ecocode.version>1.5.1</nuget.package.ecocode.version>
<!-- Creedengo rules specifications from which rules would be used -->
<creedengo-rules-specifications.version>2.2.1</creedengo-rules-specifications.version>
<!-- Creedengo nuget package version to use to build the plugin -->
<nuget.package.creedengo.version>2.1.0</nuget.package.creedengo.version>
</properties>

<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>ecocode-rules-specifications</artifactId>
<version>${ecocode-rules-specifications.version}</version>
<groupId>org.green-code-initiative</groupId>
<artifactId>creedengo-rules-specifications</artifactId>
<version>${creedengo-rules-specifications.version}</version>
<classifier>csharp</classifier>
</dependency>
<dependency>
Expand Down Expand Up @@ -152,7 +154,7 @@
<version>3.11.0</version>
</plugin>
<plugin>
<!-- Download EcoCode nuget package and include it as part of generated plugin jar -->
<!-- Download Creedengo nuget package and include it as part of generated plugin jar -->
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
<version>1.3.0</version>
Expand All @@ -163,8 +165,8 @@
<goal>wget</goal>
</goals>
<configuration>
<url>https://www.nuget.org/api/v2/package/EcoCode/${nuget.package.ecocode.version}</url>
<outputFileName>EcoCode.${nuget.package.ecocode.version}.zip</outputFileName>
<url>https://www.nuget.org/api/v2/package/Creedengo/${nuget.package.creedengo.version}</url>
<outputFileName>Creedengo.${nuget.package.creedengo.version}.zip</outputFileName>
<outputDirectory>${project.build.directory}/classes/static</outputDirectory>
</configuration>
</execution>
Expand All @@ -176,8 +178,8 @@
<version>${sonar-packaging.version}</version>
<extensions>true</extensions>
<configuration>
<pluginKey>ecocodecsharp</pluginKey>
<pluginClass>io.ecocode.csharp.CSharpPlugin</pluginClass>
<pluginKey>creedengocsharp</pluginKey>
<pluginClass>org.greencodeinitiative.creedengo.csharp.CSharpPlugin</pluginClass>
<sonarLintSupported>true</sonarLintSupported>
<pluginApiMinVersion>${sonar-plugin-api.version}</pluginApiMinVersion>
<skipDependenciesPackaging>true</skipDependenciesPackaging>
Expand Down Expand Up @@ -229,7 +231,7 @@
<createDependencyReducedPom>false</createDependencyReducedPom>
<filters>
<filter>
<artifact>io.ecocode:ecocode-rules-specifications:*</artifact>
<artifact>org.green-code-initiative:creedengo-rules-specifications:*</artifact>
<excludes>
<exclude>META-INF/**</exclude>
</excludes>
Expand Down Expand Up @@ -270,7 +272,7 @@
<configuration>
<properties>
<owner>Green Code Initiative</owner>
<email>https://www.ecocode.io</email>
<email>https://green-code-initiative.org</email>
</properties>
<licenseSets>
<licenseSet>
Expand Down
Loading
Loading