From 7c45498cd34558236c8555293b15f3e4e98aab0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mangaretto=20L=C3=A9o?= Date: Tue, 19 Nov 2024 15:09:52 +0100 Subject: [PATCH 1/6] rename ecocode to creedengo --- doc/CODE_OF_CONDUCT.md | 2 +- doc/CODE_STYLE.md | 2 +- doc/CONTRIBUTING.md | 8 +++--- doc/FAQ.md | 14 +++++----- doc/HOWTO.md | 52 +++++++++++++++++------------------ doc/starter-pack.md | 38 ++++++++++++------------- tools/rules_config/README.md | 6 ++-- tools/rules_config/_config.sh | 4 +-- tools/rules_config/_core.sh | 2 +- 9 files changed, 64 insertions(+), 64 deletions(-) diff --git a/doc/CODE_OF_CONDUCT.md b/doc/CODE_OF_CONDUCT.md index 73156de..e3b9b4d 100644 --- a/doc/CODE_OF_CONDUCT.md +++ b/doc/CODE_OF_CONDUCT.md @@ -1,4 +1,4 @@ -# Code of Conduct - EcoCode +# Code of Conduct - Creedengo - [Our Pledge](#our-pledge) - [Our Standards](#our-standards) diff --git a/doc/CODE_STYLE.md b/doc/CODE_STYLE.md index 58d6722..5a10464 100644 --- a/doc/CODE_STYLE.md +++ b/doc/CODE_STYLE.md @@ -1,4 +1,4 @@ -# Code Style Guide - EcoCode +# Code Style Guide - Creedengo - [Introduction](#introduction) - [Source File Basics](#source-file-basics) diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md index fdb0f5d..13a955e 100644 --- a/doc/CONTRIBUTING.md +++ b/doc/CONTRIBUTING.md @@ -1,4 +1,4 @@ -# Contributing - EcoCode +# Contributing - Creedengo - [Code of Conduct](#code-of-conduct) - [I Have a Question](#i-have-a-question) @@ -88,7 +88,7 @@ When you create an issue, a template is given to you to help you filling it. ### Suggesting Enhancements -This section guides you through submitting an enhancement suggestion for Ecocode repositories, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. +This section guides you through submitting an enhancement suggestion for creedengo repositories, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. #### Before Submitting an Enhancement @@ -105,14 +105,14 @@ Enhancement suggestions are tracked as GitHub issues. - Provide a **step-by-step description of the suggested enhancement** in as many details as possible. - **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. - You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and ["silentcast" tool](https://github.com/colinkeenan/silentcast) or ["byzanz" tool](https://github.com/GNOME/byzanz) on Linux. -- **Explain why this enhancement would be useful** to most Ecocode users. You may also want to point out the other projects that solved it better and which could serve as inspiration. +- **Explain why this enhancement would be useful** to most creedengo users. You may also want to point out the other projects that solved it better and which could serve as inspiration. When you create an issue, a template is given to you. ### How Do I Suggest a New Rule ? - first of all, check if rule isn't existing yet (in `RULES.md` or in Sonarqube native rules list) -- if it isn't exist, create a new issue in `ecocode` repository : choose `new rule template` +- if it isn't exist, create a new issue in `creedengo` repository : choose `new rule template` - fill the template and submit issue ### Your First Code Contribution diff --git a/doc/FAQ.md b/doc/FAQ.md index 1d76263..2545e0b 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -1,13 +1,13 @@ Frequently Ask Questions --- -## I'm using default `Sonar Way` rules (with default `Sonar Way` profile). When I install one of ecoCode plugins (ex : `ecoCode-java plugin`), are new ecoCode rules installed ? and how does the plugin do this ? +## I'm using default `Sonar Way` rules (with default `Sonar Way` profile). When I install one of creedengo plugins (ex : `creedengo-java plugin`), are new creedengo rules installed ? and how does the plugin do this ? -> When an ecoCode plugin is installed by the marketplace, the rules are immediately available on SonarQube. You can find them if you go to "rules" tab, and select rules with tag `ecocode`. +> When an creedengo plugin is installed by the marketplace, the rules are immediately available on SonarQube. You can find them if you go to "rules" tab, and select rules with tag `creedengo`. > -> But by default, ecoCode rules aren't set to an existing Sonarqube profile. +> But by default, creedengo rules aren't set to an existing Sonarqube profile. > -> If you want to use ecoCode rules (for one language for example), you have many ways to configure it : -> 1. create a new profile, then select all wanted rules (ecoCode rules or not) for that new profile, and finally use this new profile as "default" profile for the selected language (or set a few projects to this new profile). -> 2. use our script to create ths kind of profile (explanation here : https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/HOWTO.md#initialize-default-profiles-for-ecocode-plugins) ... WARNING : the new profile created will be set as the default profile for your language ! -> 3. update one of your current profiles you use with new available ecoCode rules \ No newline at end of file +> If you want to use creedengo rules (for one language for example), you have many ways to configure it : +> 1. create a new profile, then select all wanted rules (creedengo rules or not) for that new profile, and finally use this new profile as "default" profile for the selected language (or set a few projects to this new profile). +> 2. use our script to create ths kind of profile (explanation here : https://github.com/green-code-initiative/creedengo-common/blob/main/doc/HOWTO.md#initialize-default-profiles-for-creedengo-plugins) ... WARNING : the new profile created will be set as the default profile for your language ! +> 3. update one of your current profiles you use with new available creedengo rules \ No newline at end of file diff --git a/doc/HOWTO.md b/doc/HOWTO.md index 35d7c0f..ff3804d 100644 --- a/doc/HOWTO.md +++ b/doc/HOWTO.md @@ -1,7 +1,7 @@ - [Global Requirements](#global-requirements) - [DEVELOPMENT](#development) - [Installing Local environment (local SonarQube)](#installing-local-environment-local-sonarqube) - - [HOWTO build the SonarQube ecoCode plugins](#howto-build-the-sonarqube-ecocode-plugins) + - [HOWTO build the SonarQube creedengo plugins](#howto-build-the-sonarqube-creedengo-plugins) - [Requirements](#requirements) - [Build the code](#build-the-code) - [HOWTO install SonarQube dev environment](#howto-install-sonarqube-dev-environment) @@ -11,7 +11,7 @@ - [Change password](#change-password) - [Check plugins installation](#check-plugins-installation) - [Generate access token](#generate-access-token) - - [Initialize default profiles for `ecocode` plugins](#initialize-default-profiles-for-ecocode-plugins) + - [Initialize default profiles for `creedengo` plugins](#initialize-default-profiles-for-creedengo-plugins) - [HOWTO reinstall SonarQube (if needed)](#howto-reinstall-sonarqube-if-needed) - [HOWTO start or stop service (already installed)](#howto-start-or-stop-service-already-installed) - [HOWTO install new plugin version](#howto-install-new-plugin-version) @@ -31,7 +31,7 @@ - [HOWTO publish new release on SonarQube Marketplace](#howto-publish-new-release-on-sonarqube-marketplace) - [New release from scratch](#new-release-from-scratch) - [New release of existing plugin](#new-release-of-existing-plugin) - - [HOWTO publish a new version of ecocode-rules-specifications on Maven Central](#howto-publish-a-new-version-of-ecocode-rules-specifications-on-maven-central) + - [HOWTO publish a new version of creedengo-rules-specifications on Maven Central](#howto-publish-a-new-version-of-creedengo-rules-specifications-on-maven-central) - [Requirements](#requirements-2) - [Maven Central publish process](#maven-central-publish-process) - [HOWTO configure publish process on Maven Central (core-contributor rights needed)](#howto-configure-publish-process-on-maven-central-core-contributor-rights-needed) @@ -59,11 +59,11 @@ ## Installing Local environment (local SonarQube) -### HOWTO build the SonarQube ecoCode plugins +### HOWTO build the SonarQube creedengo plugins #### Requirements -check requirements : https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/starter-pack.md#requirements +check requirements : https://github.com/green-code-initiative/creedengo-common/blob/main/doc/starter-pack.md#requirements #### Build the code @@ -125,7 +125,7 @@ sysctl -w vm.max_map_count=262144 #### Configuration SonarQube -*Purposes* : Configure SonarQube to have all ecocode plugins rules enabled by default. +*Purposes* : Configure SonarQube to have all creedengo plugins rules enabled by default. ##### Change password @@ -138,7 +138,7 @@ sysctl -w vm.max_map_count=262144 - go to "Adminitration" tab - go to "Marketplace" sub-tab - go bottom, and clic on "Installed" sub-tab -- check here, if you have ecoCode plugins displayed with a SNAPSHOT version +- check here, if you have creedengo plugins displayed with a SNAPSHOT version ##### Generate access token @@ -149,9 +149,9 @@ When you are connected, generate a new token on `My Account -> Security -> Gener Instead of login+password authentication, this token can now be used as value for `sonar.login` variable when needed (examples : call sonar scanner to send metrics to SonarQube, on use internal tools, ...) -##### Initialize default profiles for `ecocode` plugins +##### Initialize default profiles for `creedengo` plugins -- use tool `install_profile.sh` in `ecocode-common` repository (inside directory `tools/rules_config`) +- use tool `install_profile.sh` in `creedengo-common` repository (inside directory `tools/rules_config`) - if you want, you can check default configuration of this tool in `_config.sh` file - launch followed command : `./install_profile.sh ` @@ -267,7 +267,7 @@ This step is done on next release of plugin (example : version N). 1. Upgrade the rule implementation to add deprecation information : in plugin repository containing the rule implementation, add a new `@DeprecatedRule` annotation on the rule class 2. Upgrade rules documentation 1. in plugin repository containing the rule implementation, in `RULES.md` file, move rule line from standard rules array to deprecated rules array - 2. in `ecoCode-rules-specification` repository, add deprecation to current rule + 2. in `creedengo-rules-specification` repository, add deprecation to current rule Thus in next release of plugin, the rule will be still present but displayed as deprecated in SonarQube UI. @@ -302,7 +302,7 @@ mvn license:format ### Create a release on DYNAMIC versionning system module -This is the use case for `ecocode` repository +This is the use case for `creedengo` repository 1. **upgrade `CHANGELOG.md`** : add release notes for next release 1. **Replace `Unreleased` title** with the new version like `Release X.Y.Z` and the date @@ -321,7 +321,7 @@ This is the use case for `ecocode` repository ### Create a release on STATIC versionning system module -This is the use case for all plugin repositories except `ecocode` repository +This is the use case for all plugin repositories except `creedengo` repository 1. IF **new release wanted** is a **major** or **minor** version (`X` or `Y` in `X.Y.Z`) 1. **THEN** **modify the old version** to the new version in **all XML/YML files** @@ -358,7 +358,7 @@ This is the use case for all plugin repositories except `ecocode` repository 1. Create a fork of [SonarSource/sonar-update-center-properties](https://github.com/SonarSource/sonar-update-center-properties.git) and clone it locally 2. Create a new branch -3. Change corresponding plugin metadata file (for `ecocode-java`: [ecocodejava.properties](https://github.com/SonarSource/sonar-update-center-properties/blob/master/ecocodejava.properties), for `ecocode-php`: [ecocodephp.properties](https://github.com/SonarSource/sonar-update-center-properties/blob/master/ecocodephp.properties), for `ecocode-python`: [ecocodepython.properties](https://github.com/SonarSource/sonar-update-center-properties/blob/master/ecocodepython.properties)): +3. Change corresponding plugin metadata file (for `creedengo-java`: [creedengojava.properties](https://github.com/SonarSource/sonar-update-center-properties/blob/master/ecocodejava.properties), for `creedengo-php`: [creedengophp.properties](https://github.com/SonarSource/sonar-update-center-properties/blob/master/ecocodephp.properties), for `creedengo-python`: [creedengopython.properties](https://github.com/SonarSource/sonar-update-center-properties/blob/master/ecocodepython.properties)): - Append new version to `publicVersions` value (comma separated value) - Add following properties (where `X.X.X` is new release to publish): - `X.X.X.description`: a summary of main changes for user for this version @@ -393,20 +393,20 @@ Examples : - documentation : [README.md](https://github.com/SonarSource/sonar-update-center-properties/blob/master/README.md) - example : [PR example](https://github.com/SonarSource/sonar-update-center-properties/pull/468) -## HOWTO publish a new version of ecocode-rules-specifications on Maven Central +## HOWTO publish a new version of creedengo-rules-specifications on Maven Central ### Requirements You need write rights to use Maven Central publish process (mainteners or core-team members). -**Create a new release of `ecoCode` repository** : please see above [HOWTO create a release](#howto-create-a-release-core-contributor-rights-needed). +**Create a new release of `creedengo` repository** : please see above [HOWTO create a release](#howto-create-a-release-core-contributor-rights-needed). Why create a new release before ? -Because publish process of `ecocode-rules-specifications` on Maven Central needs a tag on `ecoCode` repository. +Because publish process of `creedengo-rules-specifications` on Maven Central needs a tag on `creedengo` repository. ### Maven Central publish process -- go to "Action" tab of `ecoCode` reposiroty +- go to "Action" tab of `creedengo` repository - click on "Publish to Maven Central" workflow - click on "Run workflow" list button - choose a tag version (and not a branch because SNAPSHOT version won't be published on Maven Central) @@ -424,26 +424,26 @@ Because publish process of `ecocode-rules-specifications` on Maven Central needs `OSSRH_TOKEN` and `OSSRH_USERNAME` are used for communication between Github and Sonatype Nexus system for publish process to Maven Central. Nexus URL : https://s01.oss.sonatype.org/ -These variables are stored in Github Secrets available `Settings` tab of `ecoCode` repository, in `Secrets and variables` sub-tab, in `Actions` sub-section. +These variables are stored in Github Secrets available `Settings` tab of `creedengo` repository, in `Secrets and variables` sub-tab, in `Actions` sub-section. #### Why change these variables ? Values are get from a specific Sonatype Nexus account. -Actually, `ecoCode` Sonatype Nexus account was used to generate values corresponding to `OSSRH_TOKEN` and `OSSRH_USERNAME` variables. +Actually, `creedengo` Sonatype Nexus account was used to generate values corresponding to `OSSRH_TOKEN` and `OSSRH_USERNAME` variables. If we want use another account, we need to change these values by generating new ones on this new account. #### How to generate new values and update Github Secrets ? 1. Go to [Sonatype Nexus](https://oss.sonatype.org/) -2. Login with account (ex : `ecoCode`) +2. Login with account (ex : `creedengo`) 3. Go to `Profile` tab 4. Go to `User Token` sub-tab present in top list (`Summary` value is selected by default) 5. Click on `Access User Token` button 6. New values will be generated and displayed -7. Copy these values and paste them in Github Secrets in `ecoCode` repository, respectively in `OSSRH_TOKEN` variable (the password) and `OSSRH_USERNAME` variable (the username) -8. Check publish process with a new release version (see above [HOWTO configure publish process on Maven Central](#howto-publish-a-new-version-of-ecocode-rules-specifications-on-maven-central)) +7. Copy these values and paste them in Github Secrets in `creedengo` repository, respectively in `OSSRH_TOKEN` variable (the password) and `OSSRH_USERNAME` variable (the username) +8. Check publish process with a new release version (see above [HOWTO configure publish process on Maven Central](#howto-publish-a-new-version-of-creedengo-rules-specifications-on-maven-central)) ### Update GPG Maven Central keys @@ -452,7 +452,7 @@ If we want use another account, we need to change these values by generating new GPG system is used to sign JAR files before publishing them to Maven Central. We have to generate public and private keys, and store them in Github Secrets with `MAVEN_GPG_PRIVATE_KEY` and `MAVEN_GPG_PASSPHRASE` variables. -These GPG keys are stored in Github Secrets available `Settings` tab of `ecoCode` repository, in `Secrets and variables` sub-tab, in `Actions` sub-section. +These GPG keys are stored in Github Secrets available `Settings` tab of `creedengo` repository, in `Secrets and variables` sub-tab, in `Actions` sub-section. Values are generated on local machine with "gpg" command line tool. @@ -503,16 +503,16 @@ If we want to upgrade these keys, we need to generate new ones and reconfigure G 5. Open this local file and copy content (only content between `-----BEGIN PGP PRIVATE KEY BLOCK-----` and `-----END PGP PRIVATE KEY BLOCK-----` included) 6. Paste this content in `MAVEN_GPG_PRIVATE_KEY` variable in Github Secrets 7. If you changed the passphrase in first step, paste it in `MAVEN_GPG_PASSPHRASE` variable in Github Secrets -8. Check publish process with a new release version (see above [HOWTO configure publish process on Maven Central](#howto-publish-a-new-version-of-ecocode-rules-specifications-on-maven-central)) +8. Check publish process with a new release version (see above [HOWTO configure publish process on Maven Central](#howto-publish-a-new-version-of-creedengo-rules-specifications-on-maven-central)) # CONTACT ## HOWTO contact the team Several ways existing : -- go to our website https://ecocode.io/#/ and choose one of different ways : +- go to our website https://green-code-initiative.org/# and choose one of different ways : - on of our 3 social media (top-right menu) - - go to "entreprise" page and you can fill a contact form : https://ecocode.io/#/entreprise + - go to "entreprise" page and you can fill a contact form : https://green-code-initiative.org/#/entreprise - technically : got to our github and create an issue or a discussion - https://github.com/green-code-initiative diff --git a/doc/starter-pack.md b/doc/starter-pack.md index 3d97266..e23d62a 100644 --- a/doc/starter-pack.md +++ b/doc/starter-pack.md @@ -28,7 +28,7 @@ # Basic Explanations -In order to develop a Sonarqube Plugin in Open source for ecocode, two basics should have been understood : +In order to develop a Sonarqube Plugin in Open source for creedengo, two basics should have been understood : - How to develop a Sonarqube plugin - Understand and work with the Gitflow @@ -37,7 +37,7 @@ In order to develop a Sonarqube Plugin in Open source for ecocode, two basics sh ## Sonarqube Plugin Here is official documentation to understand how to develop a sonar plugin : -But ... we are going to help you more specifically for `ecoCode` project in following sections. +But ... we are going to help you more specifically for `creedengo` project in following sections. ### How a SonarQube plugin works @@ -46,7 +46,7 @@ For example, you’ll be able to access of all the `for` loops, to explore conte To better understand AST structure, you can use the [AST Explorer](https://astexplorer.net/) and select the language of the code you want to explore. -The JavaScript Sonar plugin works differently because it doesn't parse the code to transform it into an AST itself, it use the ESLint engine which will do it itself ([More information here](https://github.com/green-code-initiative/ecoCode-javascript/blob/main/CONTRIBUTING.md)). The good part is that it means that all Ecocode JavaScript rules are made available both to Sonar and to [ESLint](https://eslint.org/) through an [Ecocode ESLint plugin](https://www.npmjs.com/package/@ecocode/eslint-plugin). +The JavaScript Sonar plugin works differently because it doesn't parse the code to transform it into an AST itself, it use the ESLint engine which will do it itself ([More information here](https://github.com/green-code-initiative/ecoCode-javascript/blob/main/CONTRIBUTING.md)). The good part is that it means that all Creedengo JavaScript rules are made available both to Sonar and to [ESLint](https://eslint.org/) through an [Creedengo ESLint plugin](https://www.npmjs.com/package/@ecocode/eslint-plugin). ## Gitflow @@ -57,7 +57,7 @@ please check following section ## Github Green-Code-Initiative -- common part (doc / tools) : +- common part (doc / tools) : - rules specification : - several mobile repositories - several standard repositories @@ -91,7 +91,7 @@ For Windows OS : - execute script : `./check_requirements.bat` - then check versions displayed -PS : if you have some problems with this script, please feel free to create a new issue here +PS : if you have some problems with this script, please feel free to create a new issue here ### Method 2 - Manual check (if above "method 1" doesn't work) @@ -101,7 +101,7 @@ PS : if you have some problems with this script, please feel free to create a ne - `Maven` for Sonarqube plugin Development : - `Git` : -If you want, you can check following file to know what are min and max versions for each tool : +If you want, you can check following file to know what are min and max versions for each tool : Then launch check commands as follows (and check versions displayed) : @@ -119,20 +119,20 @@ Clone the project with (standard, mobile or/and common) : please see all availab Example for Java plugin (with SSH) : ```sh -git clone git@github.com:green-code-initiative/ecoCode-java.git +git clone git@github.com:green-code-initiative/creedengo-java.git ``` -*WARNING* : if you are a new contributor (an not identified project `maintainer`), you have to use FORK / Pull Request System like explained here +*WARNING* : if you are a new contributor (an not identified project `maintainer`), you have to use FORK / Pull Request System like explained here ## Start local environment You will find all steps to start and configure your local Sonarqube dev Environment here : -- 1st step - build your local plugin: -- 2nd step - launch local Sonarqube (with installation of previous local plugin built) : -- 3rd step - check that local environment is running perfectly : choose one of repositories with suffix "test-project" (ex : ) +- 1st step - build your local plugin: +- 2nd step - launch local Sonarqube (with installation of previous local plugin built) : +- 3rd step - check that local environment is running perfectly : choose one of repositories with suffix "test-project" (ex : ) - next, launch script `tool_send_to_sonar.sh` (using previous secruitty token created on the first step) - - finally, open local SonarQube GUI () to verify if alone project raises ecoCode errors + - finally, open local SonarQube GUI () to verify if alone project raises creedengo errors # Implement a new rule @@ -166,13 +166,13 @@ Many ways to do this : For a new rule implementation, we strongly recommend you to follow this check-list : -- [ ] Check if rule doesn't exist in our referential rules list yet (`RULES.md` file or `ecocode-rules-specifications` module in `ecoCode` repository) -- [ ] Create PR on the `ecocode` repository to add the new rule definition (`ecocode-rules-specifications`) +- [ ] Check if rule doesn't exist in our referential rules list yet (`RULES.md` file or `creedengo-rules-specifications` module in `creedengo` repository) +- [ ] Create PR on the `creedengo` repository to add the new rule definition (`creedengo-rules-specifications`) - [ ] To choose the new rule id : - - [ ] if rule is already existing in `RULES.md` file or in `ecocode-rules-specifications` module, please use the given rule id - - [ ] if rule doesn't already exist in `RULES.md` file or in `ecocode-rules-specifications` module, please use a random number between 1000 and 1500 (ex : "EC1289") and use it (later, you will be asked to change it) - - [ ] You can use SNAPSHOT version of `ecocode-rules-specifications` during your local rule implementation to go forward -- [ ] Implement rule in your local specific language repository with a reference to local SNAPSHOT of `ecocode-rules-specifications` module (previously, install it locally with maven command) + - [ ] if rule is already existing in `RULES.md` file or in `creedengo-rules-specifications` module, please use the given rule id + - [ ] if rule doesn't already exist in `RULES.md` file or in `creedengo-rules-specifications` module, please use a random number between 1000 and 1500 (ex : "EC1289") and use it (later, you will be asked to change it) + - [ ] You can use SNAPSHOT version of `creedengo-rules-specifications` during your local rule implementation to go forward +- [ ] Implement rule in your local specific language repository with a reference to local SNAPSHOT of `creedengo-rules-specifications` module (previously, install it locally with maven command) - [ ] Write Unit tests (and maximize code coverage) - [ ] Update `RULES.md` file - [ ] Update `CHANGELOG.md` file (inside `Unreleased` section) @@ -231,5 +231,5 @@ Here is the SonarQube : , move it from the "In Progress" column to the "Done" column. +Once your PR is validated, your rule integrates creedengo. In , move it from the "In Progress" column to the "Done" column. Well done. diff --git a/tools/rules_config/README.md b/tools/rules_config/README.md index bbdcb5f..bdd20f6 100644 --- a/tools/rules_config/README.md +++ b/tools/rules_config/README.md @@ -7,11 +7,11 @@ Add one new tag to a list of rules from `SONAR_RULES_REUSED.md` (using SonarQube API). Why ? because maybe some original SonarQube rules are already ready for being part of this plugin -### EcoCode Quality Profile +### Creedengo Quality Profile Add one new Profile by language inherited from SonarWay (using SonarQube API). Why ? -- we must create a custom Profile to use new eco-design rules from ecocode plugins +- we must create a custom Profile to use new eco-design rules from creedengo plugins - the new profile is inherited from SonarWay to keep natives SonarWay rules also The script attach the new rules with the new quality profile. The new profile becomes the default profile for the language. @@ -29,7 +29,7 @@ The new profile becomes the default profile for the language. - name of tag to add (`TAG_ECODESIGN` variable) : the name of the new tag to add to a list of rules - file path to `SONAR_RULES_REUSED.md` (`FILEPATH_SONAR_RULES_REUSED` variable) : filepath in the local folder. Contains all rules. - name of profile to add (`PROFILE_ECODESIGN` variable) : the name of the new profile to add for each language - - language keys list (string format separated with one comma) (`PROFILES_LANGUAGE_KEYS` variable) : specify here the list of all keys language that you want to add the new ecocode quality profile + - language keys list (string format separated with one comma) (`PROFILES_LANGUAGE_KEYS` variable) : specify here the list of all keys language that you want to add the new creedengo quality profile - profiles set as default (`IS_PROFILE_ECODESIGN_DEFAULT` variable) : 1 if we want to set created profiles as default profile for each language, 0 if we don't want ## Local develop Environment diff --git a/tools/rules_config/_config.sh b/tools/rules_config/_config.sh index 32a421a..51e0a29 100755 --- a/tools/rules_config/_config.sh +++ b/tools/rules_config/_config.sh @@ -25,7 +25,7 @@ SONAR_TOKEN=$2 SONAR_URL=http://localhost:$SONAR_PORT # new tag to add to rules (tagging tools) or to use for rules added to new profiles created (install_profile tool) -TAG_ECODESIGN=ecocode +TAG_ECODESIGN=creedengo ##### @@ -36,7 +36,7 @@ TAG_ECODESIGN=ecocode FILEPATH_SONAR_RULES_REUSED='./SONAR_RULES_REUSED.md' # name quality profile to create with "install_profile.sh" tool -PROFILE_ECODESIGN="EcoCodeProfile" +PROFILE_ECODESIGN="CreedengoProfile" # programming languages list to create with "install_profile.sh" tool PROFILES_LANGUAGE_KEYS=php,py,java,cs diff --git a/tools/rules_config/_core.sh b/tools/rules_config/_core.sh index 4734a73..9aeb966 100755 --- a/tools/rules_config/_core.sh +++ b/tools/rules_config/_core.sh @@ -127,7 +127,7 @@ function change_parent_profile_sonarapi(){ ### $1 : language ### $2 : key quality Profile ### $3 : tags list in string format separated by comma -function activate_rules_ecocode_profile_sonarapi(){ +function activate_rules_creedengo_profile_sonarapi(){ echo $(curl -u $SONAR_TOKEN: --request POST "$SONAR_URL/api/qualityprofiles/activate_rules?languages=$1&targetKey=$2&tags=$3" 2>/dev/null) } From 8789ae6020ebf1840d124cd12f2a1ad71b528d52 Mon Sep 17 00:00:00 2001 From: David DE CARVALHO Date: Thu, 5 Dec 2024 21:14:08 +0100 Subject: [PATCH 2/6] migration from ecocode to creedengo --- doc/CODE_OF_CONDUCT.md | 17 +++--- doc/CODE_STYLE.md | 77 ++++++++++++++------------- doc/CONTRIBUTING.md | 63 +++++++++++----------- doc/FAQ.md | 14 ++--- doc/HOWTO.md | 58 ++++++++++---------- doc/starter-pack.md | 58 ++++++++++---------- tools/rules_config/README.md | 6 +-- tools/rules_config/_config.sh | 4 +- tools/rules_config/_core.sh | 2 +- tools/rules_config/install_profile.sh | 2 +- 10 files changed, 152 insertions(+), 149 deletions(-) diff --git a/doc/CODE_OF_CONDUCT.md b/doc/CODE_OF_CONDUCT.md index 73156de..7afaa36 100644 --- a/doc/CODE_OF_CONDUCT.md +++ b/doc/CODE_OF_CONDUCT.md @@ -1,11 +1,12 @@ -# Code of Conduct - EcoCode +# Code of Conduct - Creedengo -- [Our Pledge](#our-pledge) -- [Our Standards](#our-standards) -- [Our Responsibilities](#our-responsibilities) -- [Scope](#scope) -- [Enforcement](#enforcement) -- [Attribution](#attribution) +- [Code of Conduct - Creedengo](#code-of-conduct---creedengo) + - [Our Pledge](#our-pledge) + - [Our Standards](#our-standards) + - [Our Responsibilities](#our-responsibilities) + - [Scope](#scope) + - [Enforcement](#enforcement) + - [Attribution](#attribution) ## Our Pledge @@ -63,7 +64,7 @@ representative at an online or offline event. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported to the community leaders responsible for enforcement with [form contact](https://www.ecocode.io/contact). +reported to the community leaders responsible for enforcement with [form contact](https://green-code-initiative.org/). All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the diff --git a/doc/CODE_STYLE.md b/doc/CODE_STYLE.md index 58d6722..44f32d5 100644 --- a/doc/CODE_STYLE.md +++ b/doc/CODE_STYLE.md @@ -1,41 +1,42 @@ -# Code Style Guide - EcoCode - -- [Introduction](#introduction) -- [Source File Basics](#source-file-basics) - - [File encoding: UTF-8](#file-encoding-utf-8) - - [Indentation](#indentation) -- [Source file structure](#source-file-structure) - - [Import statements](#import-statements) - - [Java source file organization](#java-source-file-organization) -- [Formatting](#formatting) - - [Braces](#braces) - - [Block-like constructs: K\&R style](#block-like-constructs-kr-style) - - [Line wrapping](#line-wrapping) - - [Blank Lines](#blank-lines) -- [Class declaration](#class-declaration) -- [Naming](#naming) - - [Constant names](#constant-names) - - [Variable names](#variable-names) -- [Programming Practices](#programming-practices) - - [File history](#file-history) - - [Organization of setter methods](#organization-of-setter-methods) - - [Ternary Operator](#ternary-operator) - - [Null Checks](#null-checks) - - [Use of @Override](#use-of-override) - - [Utility classes](#utility-classes) - - [Field and method references](#field-and-method-references) - - [Local variable type inference](#local-variable-type-inference) - - [Some rules from experience](#some-rules-from-experience) - - [Protections against ClassCast exceptions](#protections-against-classcast-exceptions) -- [Javadoc](#javadoc) - - [Javadoc formatting](#javadoc-formatting) -- [Tests](#tests) - - [Testing Framework](#testing-framework) - - [Naming](#naming-1) - - [Assertions](#assertions) - - [Mocking](#mocking) - - [Some rules from experience](#some-rules-from-experience-1) - - [Unit tests](#unit-tests) +# Code Style Guide - Creedengo + +- [Code Style Guide - Creedengo](#code-style-guide---creedengo) + - [Introduction](#introduction) + - [Source File Basics](#source-file-basics) + - [File encoding: UTF-8](#file-encoding-utf-8) + - [Indentation](#indentation) + - [Source file structure](#source-file-structure) + - [Import statements](#import-statements) + - [Java source file organization](#java-source-file-organization) + - [Formatting](#formatting) + - [Braces](#braces) + - [Block-like constructs: K\&R style](#block-like-constructs-kr-style) + - [Line wrapping](#line-wrapping) + - [Blank Lines](#blank-lines) + - [Class declaration](#class-declaration) + - [Naming](#naming) + - [Constant names](#constant-names) + - [Variable names](#variable-names) + - [Programming Practices](#programming-practices) + - [File history](#file-history) + - [Organization of setter methods](#organization-of-setter-methods) + - [Ternary Operator](#ternary-operator) + - [Null Checks](#null-checks) + - [Use of @Override](#use-of-override) + - [Utility classes](#utility-classes) + - [Field and method references](#field-and-method-references) + - [Local variable type inference](#local-variable-type-inference) + - [Some rules from experience](#some-rules-from-experience) + - [Protections against ClassCast exceptions](#protections-against-classcast-exceptions) + - [Javadoc](#javadoc) + - [Javadoc formatting](#javadoc-formatting) + - [Tests](#tests) + - [Testing Framework](#testing-framework) + - [Naming](#naming-1) + - [Assertions](#assertions) + - [Mocking](#mocking) + - [Some rules from experience](#some-rules-from-experience-1) + - [Unit tests](#unit-tests) ## Introduction diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md index fdb0f5d..96d8c56 100644 --- a/doc/CONTRIBUTING.md +++ b/doc/CONTRIBUTING.md @@ -1,21 +1,22 @@ -# Contributing - EcoCode - -- [Code of Conduct](#code-of-conduct) -- [I Have a Question](#i-have-a-question) -- [I Want To Contribute](#i-want-to-contribute) - - [Legal Notice](#legal-notice) - - [Reporting Bugs](#reporting-bugs) - - [Before Submitting a Bug Report](#before-submitting-a-bug-report) - - [How Do I Submit a Good Bug Report?](#how-do-i-submit-a-good-bug-report) - - [Suggesting Enhancements](#suggesting-enhancements) - - [Before Submitting an Enhancement](#before-submitting-an-enhancement) - - [How Do I Submit a Good Enhancement Suggestion?](#how-do-i-submit-a-good-enhancement-suggestion) - - [How Do I Suggest a New Rule ?](#how-do-i-suggest-a-new-rule-) - - [Your First Code Contribution](#your-first-code-contribution) - - [Improving The Documentation](#improving-the-documentation) -- [Styleguides](#styleguides) -- [Join The Project Team](#join-the-project-team) -- [Attribution](#attribution) +# Contributing - Creedengo + +- [Contributing - Creedengo](#contributing---creedengo) + - [Code of Conduct](#code-of-conduct) + - [I Have a Question](#i-have-a-question) + - [I Want To Contribute](#i-want-to-contribute) + - [Legal Notice](#legal-notice) + - [Reporting Bugs](#reporting-bugs) + - [Before Submitting a Bug Report](#before-submitting-a-bug-report) + - [How Do I Submit a Good Bug Report?](#how-do-i-submit-a-good-bug-report) + - [Suggesting Enhancements](#suggesting-enhancements) + - [Before Submitting an Enhancement](#before-submitting-an-enhancement) + - [How Do I Submit a Good Enhancement Suggestion?](#how-do-i-submit-a-good-enhancement-suggestion) + - [How Do I Suggest a New Rule ?](#how-do-i-suggest-a-new-rule-) + - [Your First Code Contribution](#your-first-code-contribution) + - [Improving The Documentation](#improving-the-documentation) + - [Styleguides](#styleguides) + - [Join The Project Team](#join-the-project-team) + - [Attribution](#attribution) First off, thanks for taking the time to contribute! ❤️ @@ -31,13 +32,13 @@ All types of contributions are encouraged and valued. See the Table of Contents ## Code of Conduct These projects and everyone participating in are governed by the -Code of Conduct ([CODE_OF_CONDUCT.md](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CODE_OF_CONDUCT.md)). +Code of Conduct ([CODE_OF_CONDUCT.md](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/CODE_OF_CONDUCT.md)). By participating, you are expected to uphold this code. Please report unacceptable behavior -with [form contact](https://www.ecocode.io/contact). +with [form contact](https://green-code-initiative.org). ## I Have a Question -> If you want to ask a question, we assume that you have read the available [Starter pack](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/starter-pack.md). +> If you want to ask a question, we assume that you have read the available [Starter pack](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/starter-pack.md). Before you ask a question, it is best to search for existing [Issues](/issues) that might help you (in the right repository). In case you have found a suitable issue and still need clarification, you can write your question in this issue. It is also advisable to search the internet for answers first. @@ -62,7 +63,7 @@ We will then take care of the issue as soon as possible. A good bug report shouldn't leave others needing to chase you up for more information. Therefore, we ask you to investigate carefully, collect information and describe the issue in detail in your report. Please complete the following steps in advance to help us fix any potential bug as fast as possible. - Make sure that you are using the latest version. -- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [Starter pack](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/starter-pack.md). If you are looking for support, you might want to check [this section](#i-have-a-question)). +- Determine if your bug is really a bug and not an error on your side e.g. using incompatible environment components/versions (Make sure that you have read the [Starter pack](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/starter-pack.md). If you are looking for support, you might want to check [this section](#i-have-a-question)). - To see if other users have experienced (and potentially already solved) the same issue you are having, check if there is not already a bug report existing for your bug or error in the bug tracker. - Also make sure to search the internet (including Stack Overflow) to see if users outside of the GitHub community have discussed the issue. - Collect information about the bug: @@ -74,7 +75,7 @@ A good bug report shouldn't leave others needing to chase you up for more inform #### How Do I Submit a Good Bug Report? -> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent with [form contact](https://www.ecocode.io/contact). +> You must never report security related issues, vulnerabilities or bugs including sensitive information to the issue tracker, or elsewhere in public. Instead sensitive bugs must be sent with [form contact](https://green-code-initiative.org). We use GitHub issues to track bugs and errors. If you run into an issue with the project: @@ -88,12 +89,12 @@ When you create an issue, a template is given to you to help you filling it. ### Suggesting Enhancements -This section guides you through submitting an enhancement suggestion for Ecocode repositories, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. +This section guides you through submitting an enhancement suggestion for Creedengo repositories, **including completely new features and minor improvements to existing functionality**. Following these guidelines will help maintainers and the community to understand your suggestion and find related suggestions. #### Before Submitting an Enhancement - Make sure that you are using the latest version. -- Read the [Starter pack](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/starter-pack.md) carefully and find out if the functionality is already covered, maybe by an individual configuration. +- Read the [Starter pack](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/starter-pack.md) carefully and find out if the functionality is already covered, maybe by an individual configuration. - Perform a search in Issue section of the right repository to see if the enhancement has already been suggested. If it has, add a comment to the existing issue instead of opening a new one. - Find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Keep in mind that we want features that will be useful to the majority of our users and not just a small subset. If you're just targeting a minority of users, consider writing an add-on/plugin library. @@ -105,19 +106,19 @@ Enhancement suggestions are tracked as GitHub issues. - Provide a **step-by-step description of the suggested enhancement** in as many details as possible. - **Describe the current behavior** and **explain which behavior you expected to see instead** and why. At this point you can also tell which alternatives do not work for you. - You may want to **include screenshots and animated GIFs** which help you demonstrate the steps or point out the part which the suggestion is related to. You can use [this tool](https://www.cockos.com/licecap/) to record GIFs on macOS and Windows, and ["silentcast" tool](https://github.com/colinkeenan/silentcast) or ["byzanz" tool](https://github.com/GNOME/byzanz) on Linux. -- **Explain why this enhancement would be useful** to most Ecocode users. You may also want to point out the other projects that solved it better and which could serve as inspiration. +- **Explain why this enhancement would be useful** to most Creedengo users. You may also want to point out the other projects that solved it better and which could serve as inspiration. When you create an issue, a template is given to you. ### How Do I Suggest a New Rule ? - first of all, check if rule isn't existing yet (in `RULES.md` or in Sonarqube native rules list) -- if it isn't exist, create a new issue in `ecocode` repository : choose `new rule template` +- if it isn't exist, create a new issue in `creedengo` repository : choose `new rule template` - fill the template and submit issue ### Your First Code Contribution -Please check [Starter pack](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/starter-pack.md) +Please check [Starter pack](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/starter-pack.md) ### Improving The Documentation @@ -127,9 +128,9 @@ Please make a Pull Request with modifications. Please check : -- [Starter pack](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/starter-pack.md) -- [Code Style Guide](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CODE_STYLE.md) -- [Code of conduct](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CODE_OF_CONDUCT.md) +- [Starter pack](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/starter-pack.md) +- [Code Style Guide](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/CODE_STYLE.md) +- [Code of conduct](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/CODE_OF_CONDUCT.md) ## Join The Project Team diff --git a/doc/FAQ.md b/doc/FAQ.md index 1d76263..10d99ab 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -1,13 +1,13 @@ Frequently Ask Questions --- -## I'm using default `Sonar Way` rules (with default `Sonar Way` profile). When I install one of ecoCode plugins (ex : `ecoCode-java plugin`), are new ecoCode rules installed ? and how does the plugin do this ? +## I'm using default `Sonar Way` rules (with default `Sonar Way` profile). When I install one of creedengo plugins (ex : `creedengo-java plugin`), are new creedengo rules installed ? and how does the plugin do this ? -> When an ecoCode plugin is installed by the marketplace, the rules are immediately available on SonarQube. You can find them if you go to "rules" tab, and select rules with tag `ecocode`. +> When an creedengo plugin is installed by the marketplace, the rules are immediately available on SonarQube. You can find them if you go to "rules" tab, and select rules with tag `eco-design`. > -> But by default, ecoCode rules aren't set to an existing Sonarqube profile. +> But by default, creedengo rules aren't set to an existing Sonarqube profile. > -> If you want to use ecoCode rules (for one language for example), you have many ways to configure it : -> 1. create a new profile, then select all wanted rules (ecoCode rules or not) for that new profile, and finally use this new profile as "default" profile for the selected language (or set a few projects to this new profile). -> 2. use our script to create ths kind of profile (explanation here : https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/HOWTO.md#initialize-default-profiles-for-ecocode-plugins) ... WARNING : the new profile created will be set as the default profile for your language ! -> 3. update one of your current profiles you use with new available ecoCode rules \ No newline at end of file +> If you want to use creedengo rules (for one language for example), you have many ways to configure it : +> 1. create a new profile, then select all wanted rules (creedengo rules or not) for that new profile, and finally use this new profile as "default" profile for the selected language (or set a few projects to this new profile). +> 2. use our script to create ths kind of profile (explanation here : https://github.com/green-code-initiative/creedengo-common/blob/main/doc/HOWTO.md#initialize-default-profiles-for-creedengo-plugins) ... WARNING : the new profile created will be set as the default profile for your language ! +> 3. update one of your current profiles you use with new available creedengo rules \ No newline at end of file diff --git a/doc/HOWTO.md b/doc/HOWTO.md index 0e0b4bb..86e9169 100644 --- a/doc/HOWTO.md +++ b/doc/HOWTO.md @@ -1,7 +1,7 @@ - [Global Requirements](#global-requirements) - [DEVELOPMENT](#development) - [Installing Local environment (local SonarQube)](#installing-local-environment-local-sonarqube) - - [HOWTO build the SonarQube ecoCode plugins](#howto-build-the-sonarqube-ecocode-plugins) + - [HOWTO build the SonarQube creedengo plugins](#howto-build-the-sonarqube-creedengo-plugins) - [Requirements](#requirements) - [Build the code](#build-the-code) - [HOWTO install SonarQube dev environment](#howto-install-sonarqube-dev-environment) @@ -11,7 +11,7 @@ - [Change password](#change-password) - [Check plugins installation](#check-plugins-installation) - [Generate access token](#generate-access-token) - - [Initialize default profiles for `ecocode` plugins](#initialize-default-profiles-for-ecocode-plugins) + - [Initialize default profiles for `creedengo` plugins](#initialize-default-profiles-for-creedengo-plugins) - [HOWTO reinstall SonarQube (if needed)](#howto-reinstall-sonarqube-if-needed) - [HOWTO start or stop service (already installed)](#howto-start-or-stop-service-already-installed) - [HOWTO install new plugin version](#howto-install-new-plugin-version) @@ -31,7 +31,7 @@ - [HOWTO publish new release on SonarQube Marketplace](#howto-publish-new-release-on-sonarqube-marketplace) - [New release from scratch](#new-release-from-scratch) - [New release of existing plugin](#new-release-of-existing-plugin) - - [HOWTO publish a new version of ecocode-rules-specifications on Maven Central](#howto-publish-a-new-version-of-ecocode-rules-specifications-on-maven-central) + - [HOWTO publish a new version of creedengo-rules-specifications on Maven Central](#howto-publish-a-new-version-of-creedengo-rules-specifications-on-maven-central) - [Requirements](#requirements-2) - [Maven Central publish process](#maven-central-publish-process) - [HOWTO configure publish process on Maven Central (core-contributor rights needed)](#howto-configure-publish-process-on-maven-central-core-contributor-rights-needed) @@ -59,11 +59,11 @@ ## Installing Local environment (local SonarQube) -### HOWTO build the SonarQube ecoCode plugins +### HOWTO build the SonarQube creedengo plugins #### Requirements -check requirements : https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/starter-pack.md#requirements +check requirements : https://github.com/green-code-initiative/creedengo-common/blob/main/doc/starter-pack.md#requirements #### Build the code @@ -125,7 +125,7 @@ sysctl -w vm.max_map_count=262144 #### Configuration SonarQube -*Purposes* : Configure SonarQube to have all ecocode plugins rules enabled by default. +*Purposes* : Configure SonarQube to have all creedengo plugins rules enabled by default. ##### Change password @@ -138,7 +138,7 @@ sysctl -w vm.max_map_count=262144 - go to "Adminitration" tab - go to "Marketplace" sub-tab - go bottom, and clic on "Installed" sub-tab -- check here, if you have ecoCode plugins displayed with a SNAPSHOT version +- check here, if you have creedengo plugins displayed with a SNAPSHOT version ##### Generate access token @@ -149,9 +149,9 @@ When you are connected, generate a new token on `My Account -> Security -> Gener Instead of login+password authentication, this token can now be used as value for `sonar.login` variable when needed (examples : call sonar scanner to send metrics to SonarQube, on use internal tools, ...) -##### Initialize default profiles for `ecocode` plugins +##### Initialize default profiles for `creedengo` plugins -- use tool `install_profile.sh` in `ecocode-common` repository (inside directory `tools/rules_config`) +- use tool `install_profile.sh` in `creedengo-common` repository (inside directory `tools/rules_config`) - if you want, you can check default configuration of this tool in `_config.sh` file - launch followed command : `./install_profile.sh ` @@ -247,7 +247,7 @@ To contribute with FORK / PR system, you have to : ### HOWTO debug a rule (with logs) -1. Add logs like in [OptimizeReadFileExceptions](https://github.com/green-code-initiative/ecoCode-java/blob/main/src/main/java/fr/greencodeinitiative/java/checks/OptimizeReadFileExceptions.java) class file +1. Add logs like in [OptimizeReadFileExceptions](https://github.com/green-code-initiative/creedengo-java/blob/main/src/main/java/fr/greencodeinitiative/java/checks/OptimizeReadFileExceptions.java) class file 2. Build plugin JARs with `tool_build.sh` 3. Launch local Sonar with `tool_docker_init.sh` 4. Launch a sonar scanner on an exemple project with `mvn verify` command (only the first time), followed @@ -267,7 +267,7 @@ This step is done on next release of plugin (example : version N). 1. Upgrade the rule implementation to add deprecation information : in plugin repository containing the rule implementation, add a new `@DeprecatedRule` annotation on the rule class 2. Upgrade rules documentation 1. in plugin repository containing the rule implementation, in `RULES.md` file, move rule line from standard rules array to deprecated rules array - 2. in `ecoCode-rules-specification` repository, add deprecation to current rule + 2. in `creedengo-rules-specification` repository, add deprecation to current rule Thus in next release of plugin, the rule will be still present but displayed as deprecated in SonarQube UI. @@ -302,7 +302,7 @@ mvn license:format ### Create a release on DYNAMIC versionning system module -This is the use case for `ecocode` repository +This is the use case for `creedengo` repository 1. **upgrade `CHANGELOG.md`** : add release notes for next release 1. **Replace `Unreleased` title** with the new version like `Release X.Y.Z` and the date @@ -321,7 +321,7 @@ This is the use case for `ecocode` repository ### Create a release on STATIC versionning system module -This is the use case for all plugin repositories except `ecocode` repository +This is the use case for all plugin repositories except `creedengo` repository 1. IF **new release wanted** is a **major** or **minor** version (`X` or `Y` in `X.Y.Z`) 1. **THEN** **modify the old version** to the new version in **all XML/YML files** @@ -358,7 +358,7 @@ This is the use case for all plugin repositories except `ecocode` repository 1. Create a fork of [SonarSource/sonar-update-center-properties](https://github.com/SonarSource/sonar-update-center-properties.git) and clone it locally 2. Create a new branch -3. Change corresponding plugin metadata file (for `ecocode-java`: [ecocodejava.properties](https://github.com/SonarSource/sonar-update-center-properties/blob/master/ecocodejava.properties), for `ecocode-php`: [ecocodephp.properties](https://github.com/SonarSource/sonar-update-center-properties/blob/master/ecocodephp.properties), for `ecocode-python`: [ecocodepython.properties](https://github.com/SonarSource/sonar-update-center-properties/blob/master/ecocodepython.properties)): +3. Change corresponding plugin metadata file (for `creedengo-java`: [creedengojava.properties](https://github.com/SonarSource/sonar-update-center-properties/blob/master/creedengojava.properties), for `creedengo-php`: [creedengophp.properties](https://github.com/SonarSource/sonar-update-center-properties/blob/master/creedengophp.properties), for `creedengo-python`: [creedengopython.properties](https://github.com/SonarSource/sonar-update-center-properties/blob/master/creedengopython.properties)): - Append new version to `publicVersions` value (comma separated value) - Add following properties (where `X.X.X` is new release to publish): - `X.X.X.description`: a summary of main changes for user for this version @@ -393,27 +393,27 @@ Examples : - documentation : [README.md](https://github.com/SonarSource/sonar-update-center-properties/blob/master/README.md) - example : [PR example](https://github.com/SonarSource/sonar-update-center-properties/pull/468) -## HOWTO publish a new version of ecocode-rules-specifications on Maven Central +## HOWTO publish a new version of creedengo-rules-specifications on Maven Central ### Requirements You need write rights to use Maven Central publish process (mainteners or core-team members). -**Create a new release of `ecoCode` repository** : please see above [HOWTO create a release](#howto-create-a-release-core-contributor-rights-needed). +**Create a new release of `creedengo` repository** : please see above [HOWTO create a release](#howto-create-a-release-core-contributor-rights-needed). Why create a new release before ? -Because publish process of `ecocode-rules-specifications` on Maven Central needs a tag on `ecoCode` repository. +Because publish process of `creedengo-rules-specifications` on Maven Central needs a tag on `creedengo` repository. ### Maven Central publish process -- go to "Action" tab of `ecoCode` reposiroty +- go to "Action" tab of `creedengo` reposiroty - click on "Publish to Maven Central" workflow - click on "Run workflow" list button - choose a tag version (and not a branch because SNAPSHOT version won't be published on Maven Central) - click on "Run workflow" button - check launched workflow on Actions tab - 20 minutes later (because of Maven central internal process), check on maven central if new version is published - - check here : https://central.sonatype.com/artifact/io.ecocode/ecocode-rules-specifications/versions + - check here : https://central.sonatype.com/artifact/org.green-code-initiative/creedengo-rules-specifications/versions ## HOWTO configure publish process on Maven Central (core-contributor rights needed) @@ -424,26 +424,26 @@ Because publish process of `ecocode-rules-specifications` on Maven Central needs `OSSRH_TOKEN` and `OSSRH_USERNAME` are used for communication between Github and Sonatype Nexus system for publish process to Maven Central. Nexus URL : https://s01.oss.sonatype.org/ -These variables are stored in Github Secrets available `Settings` tab of `ecoCode` repository, in `Secrets and variables` sub-tab, in `Actions` sub-section. +These variables are stored in Github Secrets available `Settings` tab of `creedengo` repository, in `Secrets and variables` sub-tab, in `Actions` sub-section. #### Why change these variables ? Values are get from a specific Sonatype Nexus account. -Actually, `ecoCode` Sonatype Nexus account was used to generate values corresponding to `OSSRH_TOKEN` and `OSSRH_USERNAME` variables. +Actually, `creedengo` Sonatype Nexus account was used to generate values corresponding to `OSSRH_TOKEN` and `OSSRH_USERNAME` variables. If we want use another account, we need to change these values by generating new ones on this new account. #### How to generate new values and update Github Secrets ? 1. Go to [Sonatype Nexus](https://oss.sonatype.org/) -2. Login with account (ex : `ecoCode`) +2. Login with account (ex : `gci`) 3. Go to `Profile` tab 4. Go to `User Token` sub-tab present in top list (`Summary` value is selected by default) 5. Click on `Access User Token` button 6. New values will be generated and displayed -7. Copy these values and paste them in Github Secrets in `ecoCode` repository, respectively in `OSSRH_TOKEN` variable (the password) and `OSSRH_USERNAME` variable (the username) -8. Check publish process with a new release version (see above [HOWTO configure publish process on Maven Central](#howto-publish-a-new-version-of-ecocode-rules-specifications-on-maven-central)) +7. Copy these values and paste them in Github Secrets in `creedengo` repository, respectively in `OSSRH_TOKEN` variable (the password) and `OSSRH_USERNAME` variable (the username) +8. Check publish process with a new release version (see above [HOWTO configure publish process on Maven Central](#howto-publish-a-new-version-of-creedengo-rules-specifications-on-maven-central)) ### Update GPG Maven Central keys @@ -452,7 +452,7 @@ If we want use another account, we need to change these values by generating new GPG system is used to sign JAR files before publishing them to Maven Central. We have to generate public and private keys, and store them in Github Secrets with `MAVEN_GPG_PRIVATE_KEY` and `MAVEN_GPG_PASSPHRASE` variables. -These GPG keys are stored in Github Secrets available `Settings` tab of `ecoCode` repository, in `Secrets and variables` sub-tab, in `Actions` sub-section. +These GPG keys are stored in Github Secrets available `Settings` tab of `creedengo` repository, in `Secrets and variables` sub-tab, in `Actions` sub-section. Values are generated on local machine with "gpg" command line tool. @@ -503,16 +503,16 @@ If we want to upgrade these keys, we need to generate new ones and reconfigure G 5. Open this local file and copy content (only content between `-----BEGIN PGP PRIVATE KEY BLOCK-----` and `-----END PGP PRIVATE KEY BLOCK-----` included) 6. Paste this content in `MAVEN_GPG_PRIVATE_KEY` variable in Github Secrets 7. If you changed the passphrase in first step, paste it in `MAVEN_GPG_PASSPHRASE` variable in Github Secrets -8. Check publish process with a new release version (see above [HOWTO configure publish process on Maven Central](#howto-publish-a-new-version-of-ecocode-rules-specifications-on-maven-central)) +8. Check publish process with a new release version (see above [HOWTO configure publish process on Maven Central](#howto-publish-a-new-version-of-creedengo-rules-specifications-on-maven-central)) # CONTACT ## HOWTO contact the team Several ways existing : -- go to our website https://ecocode.io/#/ and choose one of different ways : +- go to our website https://green-code-initiative.org/ and choose one of different ways : - on of our 3 social media (top-right menu) - - go to "entreprise" page and you can fill a contact form : https://ecocode.io/#/entreprise + - go to "entreprise" page and you can fill a contact form : https://green-code-initiative.org/#/entreprise - technically : got to our github and create an issue or a discussion - https://github.com/green-code-initiative @@ -524,7 +524,7 @@ A user group has been created to exchange around our plugins. There is a slack channel `#club-utilisateur` on our Slack Here are some feedbacks : - https://lite.framacalc.org/zxw48y210s-a6z2 -- [2024-10-10 user group feedback](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/resources/Club%20utilisateurs%20ecoCode%20-%20Membres%20(version%20Rencontre%205).xlsx) +- [2024-10-10 user group feedback](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/resources/Club%20utilisateurs%20ecoCode%20-%20Membres%20(version%20Rencontre%205).xlsx) ### Contributor Group A contributor group has been created to exchange technically around our plugins. diff --git a/doc/starter-pack.md b/doc/starter-pack.md index eb4d6f8..2a07c4a 100644 --- a/doc/starter-pack.md +++ b/doc/starter-pack.md @@ -28,7 +28,7 @@ # Basic Explanations -In order to develop a Sonarqube Plugin in Open source for ecocode, two basics should have been understood : +In order to develop a Sonarqube Plugin in Open source for creedengo, two basics should have been understood : - How to develop a Sonarqube plugin - Understand and work with the Gitflow @@ -37,7 +37,7 @@ In order to develop a Sonarqube Plugin in Open source for ecocode, two basics sh ## Sonarqube Plugin Here is official documentation to understand how to develop a sonar plugin : -But ... we are going to help you more specifically for `ecoCode` project in following sections. +But ... we are going to help you more specifically for `creedengo` project in following sections. ### How a SonarQube plugin works @@ -46,7 +46,7 @@ For example, you’ll be able to access of all the `for` loops, to explore conte To better understand AST structure, you can use the [AST Explorer](https://astexplorer.net/) and select the language of the code you want to explore. -The JavaScript Sonar plugin works differently because it doesn't parse the code to transform it into an AST itself, it use the ESLint engine which will do it itself ([More information here](https://github.com/green-code-initiative/ecoCode-javascript/blob/main/CONTRIBUTING.md)). The good part is that it means that all Ecocode JavaScript rules are made available both to Sonar and to [ESLint](https://eslint.org/) through an [Ecocode ESLint plugin](https://www.npmjs.com/package/@ecocode/eslint-plugin). +The JavaScript Sonar plugin works differently because it doesn't parse the code to transform it into an AST itself, it use the ESLint engine which will do it itself ([More information here](https://github.com/green-code-initiative/creedengo-javascript/blob/main/CONTRIBUTING.md)). The good part is that it means that all creedengo JavaScript rules are made available both to Sonar and to [ESLint](https://eslint.org/) through an [creedengo ESLint plugin](https://www.npmjs.com/package/@creedengo/eslint-plugin). ## Gitflow @@ -57,8 +57,8 @@ please check following section ## Github Green-Code-Initiative -- common part (doc / tools) : -- rules specification : +- common part (doc / tools) : +- rules specification : - several mobile repositories - several standard repositories - several test project repositories @@ -98,11 +98,11 @@ For Windows OS : - execute script : `./check_requirements.bat` - then check versions displayed -PS : if you have some problems with this script, please feel free to create a new issue here +PS : if you have some problems with this script, please feel free to create a new issue here ### Method 2 - Manual check (if above "method 1" doesn't work) -If you want, you can check following file to know what are min and max versions for each tool : +If you want, you can check following file to know what are min and max versions for each tool : Then launch check commands as follows (and check versions displayed) : @@ -121,20 +121,20 @@ Clone the project with (standard, mobile or/and common) : please see all availab Example for Java plugin (with SSH) : ```sh -git clone git@github.com:green-code-initiative/ecoCode-java.git +git clone git@github.com:green-code-initiative/creedengo-java.git ``` -*WARNING* : if you are a new contributor (an not identified project `maintainer`), you have to use FORK / Pull Request System like explained here +*WARNING* : if you are a new contributor (an not identified project `maintainer`), you have to use FORK / Pull Request System like explained here ## Start local environment You will find all steps to start and configure your local Sonarqube dev Environment here : -- 1st step - build your local plugin: -- 2nd step - launch local Sonarqube (with installation of previous local plugin built) : -- 3rd step - check that local environment is running perfectly : choose one of repositories with suffix "test-project" (ex : ) +- 1st step - build your local plugin: +- 2nd step - launch local Sonarqube (with installation of previous local plugin built) : +- 3rd step - check that local environment is running perfectly : choose one of repositories with suffix "test-project" (ex : ) - next, launch script `tool_send_to_sonar.sh` (using previous secruitty token created on the first step) - - finally, open local SonarQube GUI () to verify if alone project raises ecoCode errors + - finally, open local SonarQube GUI () to verify if alone project raises creedengo errors # Implement a new rule @@ -152,40 +152,40 @@ Many ways to do this : | Plugin Language | Plugin Rules Ideas | |-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| Java | [💡 rule-idea](https://github.com/green-code-initiative/ecoCode-java/issues?q=is%3Aissue+is%3Aopen+label%3A%F0%9F%92%A1rule-idea) | -| JavaScript | [🗃️ rule or 💡 rule-idea](https://github.com/green-code-initiative/ecoCode-javascript/issues?q=is%3Aopen+is%3Aissue+label%3A%22%F0%9F%92%A1+rule-idea%22%2C%22%F0%9F%97%83%EF%B8%8F+rule%22+label%3A%22%F0%9F%8F%86+challenge+%F0%9F%8F%86%22) | -| HTML | [🗃️ rule or 💡 rule-idea](https://github.com/green-code-initiative/ecoCode-html/issues?q=is%3Aopen+is%3Aissue+label%3A%22%F0%9F%92%A1+rule-idea%22%2C%22%F0%9F%97%83%EF%B8%8F+rule%22+label%3A%22%F0%9F%8F%86+challenge+%F0%9F%8F%86%22) | +| Java | [💡 rule-idea](https://github.com/green-code-initiative/creedengo-java/issues?q=is%3Aissue+is%3Aopen+label%3A%F0%9F%92%A1rule-idea) | +| JavaScript | [🗃️ rule or 💡 rule-idea](https://github.com/green-code-initiative/creedengo-javascript/issues?q=is%3Aopen+is%3Aissue+label%3A%22%F0%9F%92%A1+rule-idea%22%2C%22%F0%9F%97%83%EF%B8%8F+rule%22+label%3A%22%F0%9F%8F%86+challenge+%F0%9F%8F%86%22) | +| HTML | [🗃️ rule or 💡 rule-idea](https://github.com/green-code-initiative/creedengo-html/issues?q=is%3Aopen+is%3Aissue+label%3A%22%F0%9F%92%A1+rule-idea%22%2C%22%F0%9F%97%83%EF%B8%8F+rule%22+label%3A%22%F0%9F%8F%86+challenge+%F0%9F%8F%86%22) | | | | - second way : choose a rule in following tables - - [Web rules](https://github.com/green-code-initiative/ecoCode/blob/main/RULES.md) - - [Android (Java) rules](https://github.com/green-code-initiative/ecoCode-android/blob/main/android-plugin/RULES.md) - - [iOS (Swift) rules](https://github.com/green-code-initiative/ecoCode-ios/blob/main/RULES.md) + - [Web rules](https://github.com/green-code-initiative/creedengo/blob/main/RULES.md) + - [Android (Java) rules](https://github.com/green-code-initiative/creedengo-android/blob/main/android-plugin/RULES.md) + - [iOS (Swift) rules](https://github.com/green-code-initiative/creedengo-ios/blob/main/RULES.md) - third way : check rule ideas in Kanban project board [here](https://github.com/orgs/green-code-initiative/projects/1) and select implementable (or hardly implementable) ticket, and create an issue in the right language repositoyr -- fourth way : Go and give a hand to the [spotters team](https://github.com/green-code-initiative/ecoCode-challenge/blob/main/spotters.md) who will give you some rules to implement +- fourth way : Go and give a hand to the [spotters team](https://github.com/green-code-initiative/creedengo-challenge/blob/main/spotters.md) who will give you some rules to implement ## Check `Definition Of Done` for new rule implementation For a new rule implementation, we strongly recommend you to follow this check-list : -- [ ] Check if rule doesn't exist in our referential rules list yet (`RULES.md` file or `ecocode-rules-specifications` module in `ecoCode` repository) -- [ ] Create PR on the `ecocode` repository to add the new rule definition (`ecocode-rules-specifications`) +- [ ] Check if rule doesn't exist in our referential rules list yet (`RULES.md` file or `creedengo-rules-specifications` module in `creedengo` repository) +- [ ] Create PR on the `creedengo` repository to add the new rule definition (`creedengo-rules-specifications`) - [ ] To choose the new rule id : - - [ ] if rule is already existing in `RULES.md` file or in `ecocode-rules-specifications` module, please use the given rule id - - [ ] if rule doesn't already exist in `RULES.md` file or in `ecocode-rules-specifications` module, please use a random number between 1000 and 1500 (ex : "EC1289") and use it (later, you will be asked to change it) - - [ ] You can use SNAPSHOT version of `ecocode-rules-specifications` during your local rule implementation to go forward -- [ ] Implement rule in your local specific language repository with a reference to local SNAPSHOT of `ecocode-rules-specifications` module (previously, install it locally with maven command) + - [ ] if rule is already existing in `RULES.md` file or in `creedengo-rules-specifications` module, please use the given rule id + - [ ] if rule doesn't already exist in `RULES.md` file or in `creedengo-rules-specifications` module, please use a random number between 1000 and 1500 (ex : "EC1289") and use it (later, you will be asked to change it) + - [ ] You can use SNAPSHOT version of `creedengo-rules-specifications` during your local rule implementation to go forward +- [ ] Implement rule in your local specific language repository with a reference to local SNAPSHOT of `creedengo-rules-specifications` module (previously, install it locally with maven command) - [ ] Write Unit tests (and maximize code coverage) - [ ] Update `RULES.md` file - [ ] Update `CHANGELOG.md` file (inside `Unreleased` section) -- [ ] Create PR on the real test project to add a triggering case (check [local procedure](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/starter-pack.md#start-local-environment)) +- [ ] Create PR on the real test project to add a triggering case (check [local procedure](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/starter-pack.md#start-local-environment)) - [ ] Fix potential SonarCloud issues / out-of-date warnings (report is sent after creating PR) - [ ] In next review step, reviewer will ask you to use a specific id rule if you have chosen a random one ## Test your rule implementation - First kind of test : Unit tests (please check `Definition of Done` above) -- Second kind of test : End-to-End tests in a real local environment (please check `Definition of Done` above and [local procedure](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/starter-pack.md#start-local-environment) ) +- Second kind of test : End-to-End tests in a real local environment (please check `Definition of Done` above and [local procedure](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/starter-pack.md#start-local-environment) ) > Each rule needs to have scripts in a specific language (i.e. Python, Rust, JS, PHP and JAVA) in order to test directly inside Sonarqube that the rule has been implemented. > To validate that the rule has been implemented, you need to execute a scan on those scripts. You will need sonar scanner: @@ -233,5 +233,5 @@ Here is the SonarQube : , move it from the "In Progress" column to the "Done" column. +Once your PR is validated, your rule integrates creedengo. In , move it from the "In Progress" column to the "Done" column. Well done. diff --git a/tools/rules_config/README.md b/tools/rules_config/README.md index 2083a1f..3e7c226 100644 --- a/tools/rules_config/README.md +++ b/tools/rules_config/README.md @@ -7,11 +7,11 @@ Add one new tag to a list of rules from `SONAR_RULES_REUSED.md` (using SonarQube API). Why ? because maybe some original SonarQube rules are already ready for being part of this plugin -### EcoCode Quality Profile +### Creedengo Quality Profile Add one new Profile by language inherited from SonarWay (using SonarQube API). Why ? -- we must create a custom Profile to use new eco-design rules from ecocode plugins +- we must create a custom Profile to use new eco-design rules from creedengo plugins - the new profile is inherited from SonarWay to keep natives SonarWay rules also The script attach the new rules with the new quality profile. The new profile becomes the default profile for the language. @@ -29,7 +29,7 @@ The new profile becomes the default profile for the language. - name of tag to add (`TAG_ECODESIGN` variable) : the name of the new tag to add to a list of rules - file path to `SONAR_RULES_REUSED.md` (`FILEPATH_SONAR_RULES_REUSED` variable) : filepath in the local folder. Contains all rules. - name of profile to add (`PROFILE_ECODESIGN` variable) : the name of the new profile to add for each language - - language keys list (string format separated with one comma) (`PROFILES_LANGUAGE_KEYS` variable) : specify here the list of all keys language that you want to add the new ecocode quality profile + - language keys list (string format separated with one comma) (`PROFILES_LANGUAGE_KEYS` variable) : specify here the list of all keys language that you want to add the new creedengo quality profile - profiles set as default (`IS_PROFILE_ECODESIGN_DEFAULT` variable) : 1 if we want to set created profiles as default profile for each language, 0 if we don't want ## Local develop Environment diff --git a/tools/rules_config/_config.sh b/tools/rules_config/_config.sh index 32a421a..d444950 100755 --- a/tools/rules_config/_config.sh +++ b/tools/rules_config/_config.sh @@ -25,7 +25,7 @@ SONAR_TOKEN=$2 SONAR_URL=http://localhost:$SONAR_PORT # new tag to add to rules (tagging tools) or to use for rules added to new profiles created (install_profile tool) -TAG_ECODESIGN=ecocode +TAG_ECODESIGN=creedengo ##### @@ -36,7 +36,7 @@ TAG_ECODESIGN=ecocode FILEPATH_SONAR_RULES_REUSED='./SONAR_RULES_REUSED.md' # name quality profile to create with "install_profile.sh" tool -PROFILE_ECODESIGN="EcoCodeProfile" +PROFILE_ECODESIGN="creedengoProfile" # programming languages list to create with "install_profile.sh" tool PROFILES_LANGUAGE_KEYS=php,py,java,cs diff --git a/tools/rules_config/_core.sh b/tools/rules_config/_core.sh index 4734a73..9aeb966 100755 --- a/tools/rules_config/_core.sh +++ b/tools/rules_config/_core.sh @@ -127,7 +127,7 @@ function change_parent_profile_sonarapi(){ ### $1 : language ### $2 : key quality Profile ### $3 : tags list in string format separated by comma -function activate_rules_ecocode_profile_sonarapi(){ +function activate_rules_creedengo_profile_sonarapi(){ echo $(curl -u $SONAR_TOKEN: --request POST "$SONAR_URL/api/qualityprofiles/activate_rules?languages=$1&targetKey=$2&tags=$3" 2>/dev/null) } diff --git a/tools/rules_config/install_profile.sh b/tools/rules_config/install_profile.sh index eb76c6f..425cb6e 100755 --- a/tools/rules_config/install_profile.sh +++ b/tools/rules_config/install_profile.sh @@ -36,7 +36,7 @@ do key_profile=$(echo "$res_json" | jq -r '.profiles[].key') debug "Activate rules for language '$language' and key profile '$key_profile'" - activate_rules_ecocode_profile_sonarapi "$language" "$key_profile" "$TAG_ECODESIGN" + activate_rules_creedengo_profile_sonarapi "$language" "$key_profile" "$TAG_ECODESIGN" if [ $IS_PROFILE_ECODESIGN_DEFAULT == 1 ]; then debug "Set '$PROFILE_ECODESIGN' profile for language '$language' to Default" From 46d39235cf582a74c967301c5d889602c9b1ac03 Mon Sep 17 00:00:00 2001 From: David DE CARVALHO Date: Mon, 9 Dec 2024 18:40:42 +0100 Subject: [PATCH 3/6] update HOWTO with new configuration process to deploy on maven central --- doc/HOWTO.md | 112 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 76 insertions(+), 36 deletions(-) diff --git a/doc/HOWTO.md b/doc/HOWTO.md index 86e9169..f4f4b3b 100644 --- a/doc/HOWTO.md +++ b/doc/HOWTO.md @@ -415,49 +415,42 @@ Because publish process of `creedengo-rules-specifications` on Maven Central nee - 20 minutes later (because of Maven central internal process), check on maven central if new version is published - check here : https://central.sonatype.com/artifact/org.green-code-initiative/creedengo-rules-specifications/versions -## HOWTO configure publish process on Maven Central (core-contributor rights needed) +# CONFIGURATION -### Update OSSRH token +## HOWTO configure publish system on Maven Central -#### What is OSSRH token ? +requirements : core-contributor rights needed +technical doc used to configure system : https://medium.com/@jtbsorensen/publish-your-artifact-to-the-maven-central-repository-using-github-actions-15d3b5d9ce88 -`OSSRH_TOKEN` and `OSSRH_USERNAME` are used for communication between Github and Sonatype Nexus system for publish process to Maven Central. -Nexus URL : https://s01.oss.sonatype.org/ - -These variables are stored in Github Secrets available `Settings` tab of `creedengo` repository, in `Secrets and variables` sub-tab, in `Actions` sub-section. - -#### Why change these variables ? +### Step 1 : GPG signing system -Values are get from a specific Sonatype Nexus account. - -Actually, `creedengo` Sonatype Nexus account was used to generate values corresponding to `OSSRH_TOKEN` and `OSSRH_USERNAME` variables. +#### What is GPG ? -If we want use another account, we need to change these values by generating new ones on this new account. - -#### How to generate new values and update Github Secrets ? - -1. Go to [Sonatype Nexus](https://oss.sonatype.org/) -2. Login with account (ex : `gci`) -3. Go to `Profile` tab -4. Go to `User Token` sub-tab present in top list (`Summary` value is selected by default) -5. Click on `Access User Token` button -6. New values will be generated and displayed -7. Copy these values and paste them in Github Secrets in `creedengo` repository, respectively in `OSSRH_TOKEN` variable (the password) and `OSSRH_USERNAME` variable (the username) -8. Check publish process with a new release version (see above [HOWTO configure publish process on Maven Central](#howto-publish-a-new-version-of-creedengo-rules-specifications-on-maven-central)) +GPG system is used to sign JAR files before publishing them to Maven Central. +We have to generate public and private keys, and store them in Github Secrets with `MAVEN_GPG_PRIVATE_KEY` and `MAVEN_GPG_PASSPHRASE` variables. -### Update GPG Maven Central keys +These GPG keys are stored in Github Secrets available `Settings` tab of the repository, in `Secrets and variables` sub-tab, in `Actions` sub-section. -#### What is GPG Maven Central keys ? +#### How to install and use GPG ? METHOD 1 : with "GPG KeyChain" software (MAC OS) -GPG system is used to sign JAR files before publishing them to Maven Central. -We have to generate public and private keys, and store them in Github Secrets with `MAVEN_GPG_PRIVATE_KEY` and `MAVEN_GPG_PASSPHRASE` variables. +Download and install GPG KeyChain software from [GPG Suite](https://gpgtools.org/) +Launch GPG KeyChain software and follow these steps : +- create a new key pair by clicking on `New` button and feed the form + - `Name` : your name + - `Email` : your email - WARNING : for next maven central process (secrets generation, ...), you must have admin rights on your web site on the same hostname as your email + - `Passphrase` / `password` : a passphrase to protect your private key + - `expiration date` : never + - other options : default values +- publish your public key to a key server by clicking on `Send` button + - (if you open settings option menu, you can see that key server is `hkps://keys.openpgp.org`) +- get public key (and private key if needed), by clicking on `Export` button + - you can export public key to a local file (with `.asc` extension) + - you can also export private key if option checked in export form -These GPG keys are stored in Github Secrets available `Settings` tab of `creedengo` repository, in `Secrets and variables` sub-tab, in `Actions` sub-section. +#### How to install and use GPG ? METHOD 2 : command line tool Values are generated on local machine with "gpg" command line tool. -#### How to install and use GPG command line tool ? - on MAC OS (for the moment) : - `brew install gpg` to install tool @@ -488,21 +481,68 @@ Hachage : SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224 Compression : Non compressé, ZIP, ZLIB, BZIP2 ``` -#### Why change these variables ? +##### Why change these variables ? We can check expiration date with `gpg --list-keys` command. Current keys are valid until **2026-08-07**. If we want to upgrade these keys, we need to generate new ones and reconfigure Github Secrets. -#### How to generate new values and update Github Secrets ? +##### How to generate new values 1. Generate new keys with `gpg --gen-key` command : we need to give a passphrase (you can give old one) 2. Send public key to keyserver with `gpg --keyserver keyserver.ubuntu.com --send-keys ` command 3. Check and get public key from keyserver with `gpg --keyserver keyserver.ubuntu.com --recv-keys ` command 4. Export private key to a local `private.pgp` file with `gpg --output private.pgp --armor --export-secret-key ""` -5. Open this local file and copy content (only content between `-----BEGIN PGP PRIVATE KEY BLOCK-----` and `-----END PGP PRIVATE KEY BLOCK-----` included) -6. Paste this content in `MAVEN_GPG_PRIVATE_KEY` variable in Github Secrets -7. If you changed the passphrase in first step, paste it in `MAVEN_GPG_PASSPHRASE` variable in Github Secrets + +#### Update Github Secrets + +1. Open exported local file and copy content (only content between `-----BEGIN PGP PRIVATE KEY BLOCK-----` and `-----END PGP PRIVATE KEY BLOCK-----` included) +2. Paste this content in `MAVEN_GPG_PRIVATE_KEY` variable in Github Secrets on the current repository (Secrets and variables / Actions / Repository secrets) +3. Paste the passphrase used in previous step, in `MAVEN_GPG_PASSPHRASE` variable in Github Secrets on the current repository (Secrets and variables / Actions / Repository secrets) +4. Check below OSSHR token process and then Check publish process with a new release version (see above [HOWTO configure publish process on Maven Central](#howto-publish-a-new-version-of-creedengo-rules-specifications-on-maven-central)) + +### Step 2 : Maven Central account + +- Create an account on on central.sonatype.com as described in step 1 [here](https://medium.com/@jtbsorensen/publish-your-artifact-to-the-maven-central-repository-using-github-actions-15d3b5d9ce88) +- Register your domain as described in step 5 [here](https://medium.com/@jtbsorensen/publish-your-artifact-to-the-maven-central-repository-using-github-actions-15d3b5d9ce88) + - WARNING : you need admin rights on your web site (the host used inside your email !) to check de verification process + +### Step 3 : Maven Central secrets + +#### New way (from march 2024) + +- Generate your secrets (username and password) as described in step 7 [here](https://medium.com/@jtbsorensen/publish-your-artifact-to-the-maven-central-repository-using-github-actions-15d3b5d9ce88) +- Create Github Secrets with these values as described in step 8 [here](https://medium.com/@jtbsorensen/publish-your-artifact-to-the-maven-central-repository-using-github-actions-15d3b5d9ce88) +- in your code, update `pom.xml` and github action files with your new secrets (GPG and maven central) as described in step 2 and 3 [here](https://medium.com/@jtbsorensen/publish-your-artifact-to-the-maven-central-repository-using-github-actions-15d3b5d9ce88) + +#### Legacy way (before march 2024) + +##### Update OSSRH token + +###### What is OSSRH token ? + +`OSSRH_TOKEN` and `OSSRH_USERNAME` are used for communication between Github and Sonatype Nexus system for publish process to Maven Central. +Nexus URL : https://s01.oss.sonatype.org/ + +These variables are stored in Github Secrets available `Settings` tab of `creedengo` repository (Secrets and variables / Actions / Repository secrets) + +###### Why change these variables ? + +Values are get from a specific Sonatype Nexus account. + +Actually, `creedengo` Sonatype Nexus account was used to generate values corresponding to `OSSRH_TOKEN` and `OSSRH_USERNAME` variables. + +If we want use another account, we need to change these values by generating new ones on this new account. + +###### How to generate new values and update Github Secrets ? + +1. Go to [Sonatype Nexus](https://s01.oss.sonatype.org/) +2. Login with account (ex : `gci`) +3. Go to `Profile` tab +4. Go to `User Token` sub-tab present in top list (`Summary` value is selected by default) +5. Click on `Access User Token` button +6. New values will be generated and displayed +7. Copy these values and paste them in Github Secrets in `creedengo` repository, respectively in `OSSRH_TOKEN` variable (the password) and `OSSRH_USERNAME` variable (the username) 8. Check publish process with a new release version (see above [HOWTO configure publish process on Maven Central](#howto-publish-a-new-version-of-creedengo-rules-specifications-on-maven-central)) # CONTACT From fdae44fc05ada37294a6560e4bae1f389b1d095a Mon Sep 17 00:00:00 2001 From: David DE CARVALHO Date: Wed, 11 Dec 2024 00:39:09 +0100 Subject: [PATCH 4/6] update sommaire HOWTO --- doc/HOWTO.md | 49 ++++++++++++++++++------------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/doc/HOWTO.md b/doc/HOWTO.md index f4f4b3b..7e5502f 100644 --- a/doc/HOWTO.md +++ b/doc/HOWTO.md @@ -34,16 +34,19 @@ - [HOWTO publish a new version of creedengo-rules-specifications on Maven Central](#howto-publish-a-new-version-of-creedengo-rules-specifications-on-maven-central) - [Requirements](#requirements-2) - [Maven Central publish process](#maven-central-publish-process) - - [HOWTO configure publish process on Maven Central (core-contributor rights needed)](#howto-configure-publish-process-on-maven-central-core-contributor-rights-needed) - - [Update OSSRH token](#update-ossrh-token) - - [What is OSSRH token ?](#what-is-ossrh-token-) - - [Why change these variables ?](#why-change-these-variables-) - - [How to generate new values and update Github Secrets ?](#how-to-generate-new-values-and-update-github-secrets-) +- [CONFIGURATION](#configuration) + - [HOWTO configure publish system on Maven Central](#howto-configure-publish-system-on-maven-central) - [Update GPG Maven Central keys](#update-gpg-maven-central-keys) - [What is GPG Maven Central keys ?](#what-is-gpg-maven-central-keys-) - - [How to install and use GPG command line tool ?](#how-to-install-and-use-gpg-command-line-tool-) + - [How to install and use GPG ? METHOD 1 : with "GPG KeyChain" software (MAC OS)](#how-to-install-and-use-gpg--method-1--with-gpg-keychain-software-mac-os) + - [How to install and use GPG ? METHOD 2 : command line tool](#how-to-install-and-use-gpg--method-2--command-line-tool) + - [Why change these variables ?](#why-change-these-variables-) + - [How to generate new values](#how-to-generate-new-values) + - [Update Github Secrets](#update-github-secrets) + - [Update OSSRH token](#update-ossrh-token) + - [What is OSSRH token ?](#what-is-ossrh-token-) - [Why change these variables ?](#why-change-these-variables--1) - - [How to generate new values and update Github Secrets ?](#how-to-generate-new-values-and-update-github-secrets--1) + - [How to generate new values and update Github Secrets ?](#how-to-generate-new-values-and-update-github-secrets-) - [CONTACT](#contact) - [HOWTO contact the team](#howto-contact-the-team) - [Feedbacks](#feedbacks) @@ -420,11 +423,11 @@ Because publish process of `creedengo-rules-specifications` on Maven Central nee ## HOWTO configure publish system on Maven Central requirements : core-contributor rights needed -technical doc used to configure system : https://medium.com/@jtbsorensen/publish-your-artifact-to-the-maven-central-repository-using-github-actions-15d3b5d9ce88 +exaplanation : -### Step 1 : GPG signing system +### Update GPG Maven Central keys -#### What is GPG ? +#### What is GPG Maven Central keys ? GPG system is used to sign JAR files before publishing them to Maven Central. We have to generate public and private keys, and store them in Github Secrets with `MAVEN_GPG_PRIVATE_KEY` and `MAVEN_GPG_PASSPHRASE` variables. @@ -437,7 +440,7 @@ Download and install GPG KeyChain software from [GPG Suite](https://gpgtools.org Launch GPG KeyChain software and follow these steps : - create a new key pair by clicking on `New` button and feed the form - `Name` : your name - - `Email` : your email - WARNING : for next maven central process (secrets generation, ...), you must have admin rights on your web site on the same hostname as your email + - `Email` : your email - `Passphrase` / `password` : a passphrase to protect your private key - `expiration date` : never - other options : default values @@ -501,32 +504,16 @@ If we want to upgrade these keys, we need to generate new ones and reconfigure G 3. Paste the passphrase used in previous step, in `MAVEN_GPG_PASSPHRASE` variable in Github Secrets on the current repository (Secrets and variables / Actions / Repository secrets) 4. Check below OSSHR token process and then Check publish process with a new release version (see above [HOWTO configure publish process on Maven Central](#howto-publish-a-new-version-of-creedengo-rules-specifications-on-maven-central)) -### Step 2 : Maven Central account - -- Create an account on on central.sonatype.com as described in step 1 [here](https://medium.com/@jtbsorensen/publish-your-artifact-to-the-maven-central-repository-using-github-actions-15d3b5d9ce88) -- Register your domain as described in step 5 [here](https://medium.com/@jtbsorensen/publish-your-artifact-to-the-maven-central-repository-using-github-actions-15d3b5d9ce88) - - WARNING : you need admin rights on your web site (the host used inside your email !) to check de verification process - -### Step 3 : Maven Central secrets - -#### New way (from march 2024) - -- Generate your secrets (username and password) as described in step 7 [here](https://medium.com/@jtbsorensen/publish-your-artifact-to-the-maven-central-repository-using-github-actions-15d3b5d9ce88) -- Create Github Secrets with these values as described in step 8 [here](https://medium.com/@jtbsorensen/publish-your-artifact-to-the-maven-central-repository-using-github-actions-15d3b5d9ce88) -- in your code, update `pom.xml` and github action files with your new secrets (GPG and maven central) as described in step 2 and 3 [here](https://medium.com/@jtbsorensen/publish-your-artifact-to-the-maven-central-repository-using-github-actions-15d3b5d9ce88) - -#### Legacy way (before march 2024) - -##### Update OSSRH token +### Update OSSRH token -###### What is OSSRH token ? +#### What is OSSRH token ? `OSSRH_TOKEN` and `OSSRH_USERNAME` are used for communication between Github and Sonatype Nexus system for publish process to Maven Central. Nexus URL : https://s01.oss.sonatype.org/ These variables are stored in Github Secrets available `Settings` tab of `creedengo` repository (Secrets and variables / Actions / Repository secrets) -###### Why change these variables ? +#### Why change these variables ? Values are get from a specific Sonatype Nexus account. @@ -534,7 +521,7 @@ Actually, `creedengo` Sonatype Nexus account was used to generate values corresp If we want use another account, we need to change these values by generating new ones on this new account. -###### How to generate new values and update Github Secrets ? +#### How to generate new values and update Github Secrets ? 1. Go to [Sonatype Nexus](https://s01.oss.sonatype.org/) 2. Login with account (ex : `gci`) From 0720e758c454dfc976525efafd20a919c3a6e4a3 Mon Sep 17 00:00:00 2001 From: David DE CARVALHO Date: Fri, 13 Dec 2024 11:18:57 +0100 Subject: [PATCH 5/6] migration from ecocode to creedengo --- doc/CODE_STYLE.md | 2 +- doc/CONTRIBUTING.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/CODE_STYLE.md b/doc/CODE_STYLE.md index 44f32d5..6090331 100644 --- a/doc/CODE_STYLE.md +++ b/doc/CODE_STYLE.md @@ -256,7 +256,7 @@ The use of `var` for variable declarations (_local variable type inference_) is #### Protections against ClassCast exceptions -From experience with issue [#42](https://github.com/green-code-initiative/ecoCode/issues/42), when an exception occurs during Sonar analysis with maven command, the consequence is a crash. If this phase is launched in a CI/CD pipeline, this crash will block the pipeline. Thus, our plugins will be deleted until next corrections. +From experience with issue [#42](https://github.com/green-code-initiative/creedengo-rules-specifications/issues/42), when an exception occurs during Sonar analysis with maven command, the consequence is a crash. If this phase is launched in a CI/CD pipeline, this crash will block the pipeline. Thus, our plugins will be deleted until next corrections. Please, make a maximum of controls in the code to avoid ClassCast exceptions and thus, avoid uninstalling our plugin from SonarQube. diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md index 96d8c56..7894080 100644 --- a/doc/CONTRIBUTING.md +++ b/doc/CONTRIBUTING.md @@ -134,7 +134,7 @@ Please check : ## Join The Project Team -[contributors](https://github.com/green-code-initiative/ecoCode#-main-contributors) +[contributors](https://github.com/green-code-initiative/creedengo-rules-specifications#-main-contributors) ## Attribution From a8fa054eb62e9832a37c988f8dae8aa5d50c5876 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mangaretto=20L=C3=A9o?= Date: Mon, 6 Jan 2025 11:37:42 +0100 Subject: [PATCH 6/6] creedengo renaming in some .md files --- doc/CODE_OF_CONDUCT.md | 13 ++++---- doc/CODE_STYLE.md | 74 +++++++++++++++++++++--------------------- doc/CONTRIBUTING.md | 2 +- doc/HOWTO.md | 6 ++-- doc/starter-pack.md | 2 +- 5 files changed, 48 insertions(+), 49 deletions(-) diff --git a/doc/CODE_OF_CONDUCT.md b/doc/CODE_OF_CONDUCT.md index 7afaa36..e401188 100644 --- a/doc/CODE_OF_CONDUCT.md +++ b/doc/CODE_OF_CONDUCT.md @@ -1,12 +1,11 @@ # Code of Conduct - Creedengo -- [Code of Conduct - Creedengo](#code-of-conduct---creedengo) - - [Our Pledge](#our-pledge) - - [Our Standards](#our-standards) - - [Our Responsibilities](#our-responsibilities) - - [Scope](#scope) - - [Enforcement](#enforcement) - - [Attribution](#attribution) +- [Our Pledge](#our-pledge) +- [Our Standards](#our-standards) +- [Our Responsibilities](#our-responsibilities) +- [Scope](#scope) +- [Enforcement](#enforcement) +- [Attribution](#attribution) ## Our Pledge diff --git a/doc/CODE_STYLE.md b/doc/CODE_STYLE.md index 6090331..74f8ff9 100644 --- a/doc/CODE_STYLE.md +++ b/doc/CODE_STYLE.md @@ -1,42 +1,42 @@ # Code Style Guide - Creedengo -- [Code Style Guide - Creedengo](#code-style-guide---creedengo) - - [Introduction](#introduction) - - [Source File Basics](#source-file-basics) - - [File encoding: UTF-8](#file-encoding-utf-8) - - [Indentation](#indentation) - - [Source file structure](#source-file-structure) - - [Import statements](#import-statements) - - [Java source file organization](#java-source-file-organization) - - [Formatting](#formatting) - - [Braces](#braces) - - [Block-like constructs: K\&R style](#block-like-constructs-kr-style) - - [Line wrapping](#line-wrapping) - - [Blank Lines](#blank-lines) - - [Class declaration](#class-declaration) - - [Naming](#naming) - - [Constant names](#constant-names) - - [Variable names](#variable-names) - - [Programming Practices](#programming-practices) - - [File history](#file-history) - - [Organization of setter methods](#organization-of-setter-methods) - - [Ternary Operator](#ternary-operator) - - [Null Checks](#null-checks) - - [Use of @Override](#use-of-override) - - [Utility classes](#utility-classes) - - [Field and method references](#field-and-method-references) - - [Local variable type inference](#local-variable-type-inference) - - [Some rules from experience](#some-rules-from-experience) - - [Protections against ClassCast exceptions](#protections-against-classcast-exceptions) - - [Javadoc](#javadoc) - - [Javadoc formatting](#javadoc-formatting) - - [Tests](#tests) - - [Testing Framework](#testing-framework) - - [Naming](#naming-1) - - [Assertions](#assertions) - - [Mocking](#mocking) - - [Some rules from experience](#some-rules-from-experience-1) - - [Unit tests](#unit-tests) + +- [Introduction](#introduction) +- [Source File Basics](#source-file-basics) + - [File encoding: UTF-8](#file-encoding-utf-8) + - [Indentation](#indentation) +- [Source file structure](#source-file-structure) + - [Import statements](#import-statements) + - [Java source file organization](#java-source-file-organization) +- [Formatting](#formatting) + - [Braces](#braces) + - [Block-like constructs: K\&R style](#block-like-constructs-kr-style) + - [Line wrapping](#line-wrapping) + - [Blank Lines](#blank-lines) +- [Class declaration](#class-declaration) +- [Naming](#naming) + - [Constant names](#constant-names) + - [Variable names](#variable-names) +- [Programming Practices](#programming-practices) + - [File history](#file-history) + - [Organization of setter methods](#organization-of-setter-methods) + - [Ternary Operator](#ternary-operator) + - [Null Checks](#null-checks) + - [Use of @Override](#use-of-override) + - [Utility classes](#utility-classes) + - [Field and method references](#field-and-method-references) + - [Local variable type inference](#local-variable-type-inference) + - [Some rules from experience](#some-rules-from-experience) + - [Protections against ClassCast exceptions](#protections-against-classcast-exceptions) +- [Javadoc](#javadoc) + - [Javadoc formatting](#javadoc-formatting) +- [Tests](#tests) + - [Testing Framework](#testing-framework) + - [Naming](#naming-1) + - [Assertions](#assertions) + - [Mocking](#mocking) + - [Some rules from experience](#some-rules-from-experience-1) + - [Unit tests](#unit-tests) ## Introduction diff --git a/doc/CONTRIBUTING.md b/doc/CONTRIBUTING.md index 13a955e..2c8cd43 100644 --- a/doc/CONTRIBUTING.md +++ b/doc/CONTRIBUTING.md @@ -112,7 +112,7 @@ When you create an issue, a template is given to you. ### How Do I Suggest a New Rule ? - first of all, check if rule isn't existing yet (in `RULES.md` or in Sonarqube native rules list) -- if it isn't exist, create a new issue in `creedengo` repository : choose `new rule template` +- if it isn't exist, create a new issue in `creedengo-rules-specifications` repository : choose `new rule template` - fill the template and submit issue ### Your First Code Contribution diff --git a/doc/HOWTO.md b/doc/HOWTO.md index b39ab3d..80456cd 100644 --- a/doc/HOWTO.md +++ b/doc/HOWTO.md @@ -302,7 +302,7 @@ mvn license:format ### Create a release on DYNAMIC versionning system module -This is the use case for `creedengo` repository +This is the use case for `creedengo-rules-specifications` repository 1. **upgrade `CHANGELOG.md`** : add release notes for next release 1. **Replace `Unreleased` title** with the new version like `Release X.Y.Z` and the date @@ -406,7 +406,7 @@ Because publish process of `creedengo-rules-specifications` on Maven Central nee ### Maven Central publish process -- go to "Action" tab of `creedengo` repository +- go to "Action" tab of `creedengo-rules-specifications` repository - click on "Publish to Maven Central" workflow - click on "Run workflow" list button - choose a tag version (and not a branch because SNAPSHOT version won't be published on Maven Central) @@ -452,7 +452,7 @@ If we want use another account, we need to change these values by generating new GPG system is used to sign JAR files before publishing them to Maven Central. We have to generate public and private keys, and store them in Github Secrets with `MAVEN_GPG_PRIVATE_KEY` and `MAVEN_GPG_PASSPHRASE` variables. -These GPG keys are stored in Github Secrets available `Settings` tab of `creedengo` repository, in `Secrets and variables` sub-tab, in `Actions` sub-section. +These GPG keys are stored in Github Secrets available `Settings` tab of `creedengo-rules-specifications` repository, in `Secrets and variables` sub-tab, in `Actions` sub-section. Values are generated on local machine with "gpg" command line tool. diff --git a/doc/starter-pack.md b/doc/starter-pack.md index 33944f5..42641de 100644 --- a/doc/starter-pack.md +++ b/doc/starter-pack.md @@ -132,7 +132,7 @@ You will find all steps to start and configure your local Sonarqube dev Environm - 1st step - build your local plugin: - 2nd step - launch local Sonarqube (with installation of previous local plugin built) : -- 3rd step - check that local environment is running perfectly : choose one of repositories with suffix "test-project" (ex : ) +- 3rd step - check that local environment is running perfectly : choose one of repositories with suffix "test-project" (ex : ) - next, launch script `tool_send_to_sonar.sh` (using previous secruitty token created on the first step) - finally, open local SonarQube GUI () to verify if alone project raises creedengo errors