diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7625c69..8a1c382 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/build_container.yml b/.github/workflows/build_container.yml index df416bd..b4bc6f5 100644 --- a/.github/workflows/build_container.yml +++ b/.github/workflows/build_container.yml @@ -14,9 +14,9 @@ on: env: # github.repository as / - 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: diff --git a/.github/workflows/tag_release.yml b/.github/workflows/tag_release.yml index 139fb6a..3692e42 100644 --- a/.github/workflows/tag_release.yml +++ b/.github/workflows/tag_release.yml @@ -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 @@ -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 @@ -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 diff --git a/CHANGELOG.md b/CHANGELOG.md index bbfaffe..8946e20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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) diff --git a/CODE_STYLE.md b/CODE_STYLE.md index 4253a9e..af78d1c 100644 --- a/CODE_STYLE.md +++ b/CODE_STYLE.md @@ -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. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ecfa2a0..13a03d9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/Dockerfile b/Dockerfile index 2b5ce24..de764b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/README.md b/README.md index 8228926..2c7a497 100644 --- a/README.md +++ b/README.md @@ -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 ------------------ @@ -34,67 +34,68 @@ 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 : ```sh -docker build --build-arg SONARQUBE_VERSION=10.5.1-community . +docker build --build-arg SONARQUBE_VERSION=25.2.0.102705-community . ``` -If you want to use the `docker-compose` file, you can use the below commands to use an overriding `dockerfile` build : +If you want to use the `docker-compose` file, you can use the below commands to use an overrided `dockerfile` build : ```sh -docker compose build --build-arg SONARQUBE_VERSION=10.5.1-community +docker compose build --build-arg SONARQUBE_VERSION=25.2.0.102705-community 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 and above | 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 ----- diff --git a/RULES.md b/RULES.md index c6831bb..e909d8f 100644 --- a/RULES.md +++ b/RULES.md @@ -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. diff --git a/docker-compose.yml b/docker-compose.yml index 5441ad5..43091ab 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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: @@ -29,7 +29,7 @@ services: db: image: postgres:12 - container_name: postgresql_ecocode_csharp + container_name: postgresql_creedengo_csharp networks: - sonarnet volumes: diff --git a/docker-dotnetscan/Dockerfile b/docker-dotnetscan/Dockerfile index 1be8869..e7f3998 100644 --- a/docker-dotnetscan/Dockerfile +++ b/docker-dotnetscan/Dockerfile @@ -1,6 +1,8 @@ # syntax=docker/dockerfile:1.0 -FROM mcr.microsoft.com/dotnet/sdk:8.0 +ARG DOTNET_SDK=9.0 + +FROM mcr.microsoft.com/dotnet/sdk:${DOTNET_SDK} RUN dotnet tool install --global dotnet-sonarscanner RUN set -ex; \ diff --git a/docker-dotnetscan/README.md b/docker-dotnetscan/README.md index d0d527f..173673d 100644 --- a/docker-dotnetscan/README.md +++ b/docker-dotnetscan/README.md @@ -1,5 +1,4 @@ -.net analysis docker utility container -=========== +# .net analysis docker utility container Docker utility container for dotnet codebase analysis that can be use to scan .net code and upload result to a Sonarqube instance. This container is intended to be used as a standalone tool with the docker-compose configuration provided in this repo that starts a Sonarqube instance or an existing Sonarqube instance. @@ -15,35 +14,47 @@ Build the docker image and tag it with a convenient name (for instance we named docker build -t scanner . ``` +### Use a specific .Net SDK version + +By default building docker image will use `.Net SDK 9.0`. You can use a version that will suit you usecase by specifying the version you want to use with a `build-arg` : + +```sh +docker build -t scanner --build-arg DOTNET_SDK=8.0 . +``` + +Obviously, you can tag your image using `-t scanner:8.0` for example and adapt below analysing commands accordingly. + ### Analyze your code #### 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 : -| Property | Parameter | Value | Comments | -| ------------- | --------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------- | -| Project key | -p | `myDotNetProject` | Project will be create automatically if you use a user token (i.e. `-l`) that is allowed to create one (i.e. admin rights) | -| Auth token | -l | `squ_123456789` | User token are `squ_XXXX`, projet analysis token are `sqp_XXXX` | -| Sonarqube url | -u | `http://localhost:9000` | Note : this is the default url if you omit to specify one with `-u` parameter | +| Property | Parameter | Value | Comments | +| ------------------------- | --------- | ----------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| Project key | -p | `myDotNetProject` | Project will be create automatically if you use a user token (i.e. `-l`) that is allowed to create one (i.e. admin rights) | +| User auth token | -l | `squ_123456789` | User token are `squ_XXXX`. [_Deprecated by Sonarqube and will be remove in the future, use -t instead_] | +| Global/Project auth token | -t | `sqp_123456789` | Global or projet analysis token are `sqp_XXXX` | +| Sonarqube url | -u | `http://localhost:9000` | Note : this is the default url if you omit to specify one with `-u` parameter | Running a SonarQube analysis is straighforward. You just need to execute the following commands at **the root of your solution**. #### With a Sonarqube instance from our docker-compose ```sh -docker run --rm -it --mount type=bind,src="$(pwd)",target=/src --network sonarnet scanner -p myDotNetProject -u http://sonar:9000 -l squ_123456789 +docker run --rm -it --mount type=bind,src="$(pwd)",target=/src --network sonarnet scanner -p myDotNetProject -u http://sonar:9000 -t sqp_123456789 ``` #### With an existing Sonarqube instance ```sh -docker run --rm -it --mount type=bind,src="$(pwd)",target=/src --network host scanner -p myDotNetProject -u http://localhost:9000 -l squ_123456789 +docker run --rm -it --mount type=bind,src="$(pwd)",target=/src --network host scanner -p myDotNetProject -u http://localhost:9000 -t sqp_123456789 ``` For further available parameters, refer to Help diff --git a/docker-dotnetscan/docker_dotnetscan_entrypoint.sh b/docker-dotnetscan/docker_dotnetscan_entrypoint.sh index d6b0bd6..00b68bf 100755 --- a/docker-dotnetscan/docker_dotnetscan_entrypoint.sh +++ b/docker-dotnetscan/docker_dotnetscan_entrypoint.sh @@ -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:" @@ -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" diff --git a/pom.xml b/pom.xml index 1941d2d..c28c169 100644 --- a/pom.xml +++ b/pom.xml @@ -1,18 +1,20 @@ - + 4.0.0 - io.ecocode - ecocode-csharp-plugin - 1.5.2-SNAPSHOT + org.green-code-initiative + creedengo-csharp-plugin + 2.1.0-SNAPSHOT sonar-plugin - ecoCode - C# language + creedengo - C# language Provides rules to reduce the environmental footprint of your C# programs 2024 - https://github.com/green-code-initiative/ecoCode-csharp-sonarqube + https://github.com/green-code-initiative/creedengo-csharp-sonarqube green-code-initiative https://github.com/green-code-initiative @@ -27,19 +29,19 @@ - scm:git:https://github.com/green-code-initiative/ecoCode-csharp-sonarqube - scm:git:https://github.com/green-code-initiative/ecoCode-csharp-sonarqube - https://github.com/green-code-initiative/ecoCode-csharp-sonarqube + scm:git:https://github.com/green-code-initiative/creedengo-csharp-sonarqube + scm:git:https://github.com/green-code-initiative/creedengo-csharp-sonarqube + https://github.com/green-code-initiative/creedengo-csharp-sonarqube HEAD GitHub - https://github.com/green-code-initiative/ecoCode-csharp-sonarqube/issues + https://github.com/green-code-initiative/creedengo-csharp-sonarqube/issues - 11 + 17 ${java.version} ${java.version} @@ -58,17 +60,17 @@ 2.5.0.1358 1.23.0.740 - - 1.6.5 - - 1.5.1 + + 2.2.1 + + 2.1.0 - ${project.groupId} - ecocode-rules-specifications - ${ecocode-rules-specifications.version} + org.green-code-initiative + creedengo-rules-specifications + ${creedengo-rules-specifications.version} csharp @@ -152,7 +154,7 @@ 3.11.0 - + com.googlecode.maven-download-plugin download-maven-plugin 1.3.0 @@ -163,8 +165,8 @@ wget - https://www.nuget.org/api/v2/package/EcoCode/${nuget.package.ecocode.version} - EcoCode.${nuget.package.ecocode.version}.zip + https://www.nuget.org/api/v2/package/Creedengo/${nuget.package.creedengo.version} + Creedengo.${nuget.package.creedengo.version}.zip ${project.build.directory}/classes/static @@ -176,9 +178,9 @@ ${sonar-packaging.version} true - ecocodecsharp - io.ecocode.csharp.CSharpPlugin - true + creedengocsharp + org.greencodeinitiative.creedengo.csharp.CSharpPlugin + false ${sonar-plugin-api.version} true ${java.version} @@ -229,7 +231,7 @@ false - io.ecocode:ecocode-rules-specifications:* + org.green-code-initiative:creedengo-rules-specifications:* META-INF/** @@ -270,7 +272,7 @@ Green Code Initiative - https://www.ecocode.io + https://green-code-initiative.org diff --git a/src/main/java/io/ecocode/csharp/CSharpConfiguration.java b/src/main/java/org/greencodeinitiative/creedengo/csharp/CSharpConfiguration.java similarity index 94% rename from src/main/java/io/ecocode/csharp/CSharpConfiguration.java rename to src/main/java/org/greencodeinitiative/creedengo/csharp/CSharpConfiguration.java index e0b64fb..35d6f52 100644 --- a/src/main/java/io/ecocode/csharp/CSharpConfiguration.java +++ b/src/main/java/org/greencodeinitiative/creedengo/csharp/CSharpConfiguration.java @@ -1,6 +1,6 @@ /* - * ecoCode - C# language - Provides rules to reduce the environmental footprint of your C# programs - * Copyright © 2024 Green Code Initiative (https://www.ecocode.io) + * creedengo - C# language - Provides rules to reduce the environmental footprint of your C# programs + * Copyright © 2024 Green Code Initiative (https://green-code-initiative.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package io.ecocode.csharp; +package org.greencodeinitiative.creedengo.csharp; import java.io.IOException; import java.io.InputStreamReader; @@ -39,7 +39,7 @@ public class CSharpConfiguration { private final Map pluginProperties; public CSharpConfiguration() { - this("/io/ecocode/csharp/configuration.xml"); + this("/org/greencodeinitiative/creedengo/csharp/configuration.xml"); } CSharpConfiguration(String resourcePath) { diff --git a/src/main/java/io/ecocode/csharp/CSharpPlugin.java b/src/main/java/org/greencodeinitiative/creedengo/csharp/CSharpPlugin.java similarity index 85% rename from src/main/java/io/ecocode/csharp/CSharpPlugin.java rename to src/main/java/org/greencodeinitiative/creedengo/csharp/CSharpPlugin.java index 57970dc..ff8eaba 100644 --- a/src/main/java/io/ecocode/csharp/CSharpPlugin.java +++ b/src/main/java/org/greencodeinitiative/creedengo/csharp/CSharpPlugin.java @@ -1,6 +1,6 @@ /* - * ecoCode - C# language - Provides rules to reduce the environmental footprint of your C# programs - * Copyright © 2024 Green Code Initiative (https://www.ecocode.io) + * creedengo - C# language - Provides rules to reduce the environmental footprint of your C# programs + * Copyright © 2024 Green Code Initiative (https://green-code-initiative.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package io.ecocode.csharp; +package org.greencodeinitiative.creedengo.csharp; import java.util.ArrayList; import java.util.Collections; diff --git a/src/main/java/io/ecocode/csharp/CSharpPluginProperties.java b/src/main/java/org/greencodeinitiative/creedengo/csharp/CSharpPluginProperties.java similarity index 87% rename from src/main/java/io/ecocode/csharp/CSharpPluginProperties.java rename to src/main/java/org/greencodeinitiative/creedengo/csharp/CSharpPluginProperties.java index aa280ba..15a0ee4 100644 --- a/src/main/java/io/ecocode/csharp/CSharpPluginProperties.java +++ b/src/main/java/org/greencodeinitiative/creedengo/csharp/CSharpPluginProperties.java @@ -1,6 +1,6 @@ /* - * ecoCode - C# language - Provides rules to reduce the environmental footprint of your C# programs - * Copyright © 2024 Green Code Initiative (https://www.ecocode.io) + * creedengo - C# language - Provides rules to reduce the environmental footprint of your C# programs + * Copyright © 2024 Green Code Initiative (https://green-code-initiative.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package io.ecocode.csharp; +package org.greencodeinitiative.creedengo.csharp; import java.util.ArrayList; import java.util.Collections; diff --git a/src/main/java/io/ecocode/csharp/CSharpRulesDefinition.java b/src/main/java/org/greencodeinitiative/creedengo/csharp/CSharpRulesDefinition.java similarity index 92% rename from src/main/java/io/ecocode/csharp/CSharpRulesDefinition.java rename to src/main/java/org/greencodeinitiative/creedengo/csharp/CSharpRulesDefinition.java index 422f310..1a01c0f 100644 --- a/src/main/java/io/ecocode/csharp/CSharpRulesDefinition.java +++ b/src/main/java/org/greencodeinitiative/creedengo/csharp/CSharpRulesDefinition.java @@ -1,6 +1,6 @@ /* - * ecoCode - C# language - Provides rules to reduce the environmental footprint of your C# programs - * Copyright © 2024 Green Code Initiative (https://www.ecocode.io) + * creedengo - C# language - Provides rules to reduce the environmental footprint of your C# programs + * Copyright © 2024 Green Code Initiative (https://green-code-initiative.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package io.ecocode.csharp; +package org.greencodeinitiative.creedengo.csharp; import java.io.IOException; import java.net.URL; @@ -46,7 +46,7 @@ public class CSharpRulesDefinition implements RulesDefinition { private final SonarRuntime sonarRuntime; public CSharpRulesDefinition(CSharpConfiguration config, SonarRuntime sonarRuntime) { - this(config, sonarRuntime, "io/ecocode/rules/csharp"); + this(config, sonarRuntime, "org/green-code-initiative/rules/csharp"); } public CSharpRulesDefinition(CSharpConfiguration config, SonarRuntime sonarRuntime, String rulesResourceBasePath) { @@ -64,7 +64,7 @@ public void define(Context context) { List jsonRules = this.listJsonRules(); - LOG.debug("C# Rules found : {}", jsonRules.size()); + LOG.info("C# Rules found : {}", jsonRules.size()); LOG.debug("Rule names: {}", jsonRules); RuleMetadataLoader ruleMetadataLoader = new RuleMetadataLoader(rulesResourceBasePath, sonarRuntime); diff --git a/src/main/java/io/ecocode/csharp/package-info.java b/src/main/java/org/greencodeinitiative/creedengo/csharp/package-info.java similarity index 76% rename from src/main/java/io/ecocode/csharp/package-info.java rename to src/main/java/org/greencodeinitiative/creedengo/csharp/package-info.java index 489a874..4630784 100644 --- a/src/main/java/io/ecocode/csharp/package-info.java +++ b/src/main/java/org/greencodeinitiative/creedengo/csharp/package-info.java @@ -1,6 +1,6 @@ /* - * ecoCode - C# language - Provides rules to reduce the environmental footprint of your C# programs - * Copyright © 2024 Green Code Initiative (https://www.ecocode.io) + * creedengo - C# language - Provides rules to reduce the environmental footprint of your C# programs + * Copyright © 2024 Green Code Initiative (https://green-code-initiative.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -16,6 +16,6 @@ * along with this program. If not, see . */ @ParametersAreNonnullByDefault -package io.ecocode.csharp; +package org.greencodeinitiative.creedengo.csharp; import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/resources/io/ecocode/csharp/configuration.xml b/src/main/resources/io/ecocode/csharp/configuration.xml deleted file mode 100644 index b6ce569..0000000 --- a/src/main/resources/io/ecocode/csharp/configuration.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - ecocodecsharp - roslyn.ecocode-csharp.cs - cs - ecoCode - - EcoCode - ${nuget.package.ecocode.version} - EcoCode - EcoCode - EcoCode.${nuget.package.ecocode.version}.zip - ecocodecsharp - ${nuget.package.ecocode.version} - - diff --git a/src/main/resources/org/greencodeinitiative/creedengo/csharp/configuration.xml b/src/main/resources/org/greencodeinitiative/creedengo/csharp/configuration.xml new file mode 100644 index 0000000..1e35bc5 --- /dev/null +++ b/src/main/resources/org/greencodeinitiative/creedengo/csharp/configuration.xml @@ -0,0 +1,17 @@ + + + creedengocsharp + roslyn.creedengo.cs + cs + Creedengo + + Creedengo + ${nuget.package.creedengo.version} + Creedengo + Creedengo + Creedengo.${nuget.package.creedengo.version}.zip + creedengocsharp + ${nuget.package.creedengo.version} + + diff --git a/src/test/java/io/ecocode/csharp/CSharpConfigurationTest.java b/src/test/java/org/greencodeinitiative/creedengo/csharp/CSharpConfigurationTest.java similarity index 93% rename from src/test/java/io/ecocode/csharp/CSharpConfigurationTest.java rename to src/test/java/org/greencodeinitiative/creedengo/csharp/CSharpConfigurationTest.java index d8a29fd..95830e0 100644 --- a/src/test/java/io/ecocode/csharp/CSharpConfigurationTest.java +++ b/src/test/java/org/greencodeinitiative/creedengo/csharp/CSharpConfigurationTest.java @@ -1,6 +1,6 @@ /* - * ecoCode - C# language - Provides rules to reduce the environmental footprint of your C# programs - * Copyright © 2024 Green Code Initiative (https://www.ecocode.io) + * creedengo - C# language - Provides rules to reduce the environmental footprint of your C# programs + * Copyright © 2024 Green Code Initiative (https://green-code-initiative.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,10 +15,11 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package io.ecocode.csharp; +package org.greencodeinitiative.creedengo.csharp; import java.util.HashMap; import java.util.Map; + import org.junit.jupiter.api.Test; import static org.fest.assertions.Assertions.assertThat; @@ -95,7 +96,7 @@ void empty() { @Test void default_path() { - assertThat(new CSharpConfiguration().mandatoryProperty("PluginKeyDifferentiator")).isEqualTo("ecocodecsharp"); + assertThat(new CSharpConfiguration().mandatoryProperty("PluginKeyDifferentiator")).isEqualTo("creedengocsharp"); } } diff --git a/src/test/java/io/ecocode/csharp/CSharpPluginPropertiesTest.java b/src/test/java/org/greencodeinitiative/creedengo/csharp/CSharpPluginPropertiesTest.java similarity index 90% rename from src/test/java/io/ecocode/csharp/CSharpPluginPropertiesTest.java rename to src/test/java/org/greencodeinitiative/creedengo/csharp/CSharpPluginPropertiesTest.java index bcaada5..3d51021 100644 --- a/src/test/java/io/ecocode/csharp/CSharpPluginPropertiesTest.java +++ b/src/test/java/org/greencodeinitiative/creedengo/csharp/CSharpPluginPropertiesTest.java @@ -1,6 +1,6 @@ /* - * ecoCode - C# language - Provides rules to reduce the environmental footprint of your C# programs - * Copyright © 2024 Green Code Initiative (https://www.ecocode.io) + * creedengo - C# language - Provides rules to reduce the environmental footprint of your C# programs + * Copyright © 2024 Green Code Initiative (https://green-code-initiative.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,13 +15,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package io.ecocode.csharp; +package org.greencodeinitiative.creedengo.csharp; import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; + import org.junit.jupiter.api.Test; import org.sonar.api.PropertyType; import org.sonar.api.config.PropertyDefinition; diff --git a/src/test/java/io/ecocode/csharp/CSharpPluginTest.java b/src/test/java/org/greencodeinitiative/creedengo/csharp/CSharpPluginTest.java similarity index 88% rename from src/test/java/io/ecocode/csharp/CSharpPluginTest.java rename to src/test/java/org/greencodeinitiative/creedengo/csharp/CSharpPluginTest.java index f96a803..d94454e 100644 --- a/src/test/java/io/ecocode/csharp/CSharpPluginTest.java +++ b/src/test/java/org/greencodeinitiative/creedengo/csharp/CSharpPluginTest.java @@ -1,6 +1,6 @@ /* - * ecoCode - C# language - Provides rules to reduce the environmental footprint of your C# programs - * Copyright © 2024 Green Code Initiative (https://www.ecocode.io) + * creedengo - C# language - Provides rules to reduce the environmental footprint of your C# programs + * Copyright © 2024 Green Code Initiative (https://green-code-initiative.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,11 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package io.ecocode.csharp; +package org.greencodeinitiative.creedengo.csharp; import java.util.ArrayList; import java.util.Collections; import java.util.List; + import org.junit.jupiter.api.Test; import org.sonar.api.Plugin; import org.sonar.api.SonarEdition; @@ -57,7 +58,7 @@ void getExtensions() { @Test void pico_container_key_differentiator() { - assertThat(new CSharpPlugin().toString()).isEqualTo("ecocodecsharp"); + assertThat(new CSharpPlugin().toString()).isEqualTo("creedengocsharp"); } @SuppressWarnings({ "rawtypes", "unchecked" }) diff --git a/src/test/java/io/ecocode/csharp/CSharpRulesDefinitionTest.java b/src/test/java/org/greencodeinitiative/creedengo/csharp/CSharpRulesDefinitionTest.java similarity index 93% rename from src/test/java/io/ecocode/csharp/CSharpRulesDefinitionTest.java rename to src/test/java/org/greencodeinitiative/creedengo/csharp/CSharpRulesDefinitionTest.java index 70c3edf..9f2609b 100644 --- a/src/test/java/io/ecocode/csharp/CSharpRulesDefinitionTest.java +++ b/src/test/java/org/greencodeinitiative/creedengo/csharp/CSharpRulesDefinitionTest.java @@ -1,6 +1,6 @@ /* - * ecoCode - C# language - Provides rules to reduce the environmental footprint of your C# programs - * Copyright © 2024 Green Code Initiative (https://www.ecocode.io) + * creedengo - C# language - Provides rules to reduce the environmental footprint of your C# programs + * Copyright © 2024 Green Code Initiative (https://green-code-initiative.org) * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -15,11 +15,12 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package io.ecocode.csharp; +package org.greencodeinitiative.creedengo.csharp; import java.util.Collections; import java.util.HashMap; import java.util.Map; + import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.RegisterExtension; import org.sonar.api.SonarEdition; @@ -89,7 +90,7 @@ void test_rules_defined() { assertThat(repo.rules()).hasSize(1); Rule rule = repo.rules().get(0); - assertThat(rule.key()).isEqualTo("EC1000"); + assertThat(rule.key()).isEqualTo("GCI1000"); assertThat(rule.name()).isEqualTo("Test rule S1000"); assertThat(rule.severity()).isEqualTo("MINOR"); assertThat(rule.template()).isFalse(); diff --git a/src/test/resources/io/ecocode/rules/csharp/EC1000.html b/src/test/resources/org/green-code-initiative/rules/csharp/GCI1000.html similarity index 100% rename from src/test/resources/io/ecocode/rules/csharp/EC1000.html rename to src/test/resources/org/green-code-initiative/rules/csharp/GCI1000.html diff --git a/src/test/resources/io/ecocode/rules/csharp/EC1000.json b/src/test/resources/org/green-code-initiative/rules/csharp/GCI1000.json similarity index 100% rename from src/test/resources/io/ecocode/rules/csharp/EC1000.json rename to src/test/resources/org/green-code-initiative/rules/csharp/GCI1000.json