diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index d977a8fec..2dc9155b4 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -25,17 +25,27 @@ jobs:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 11
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: 11
+ - name: Cache SonarQube packages
+ uses: actions/cache@v4
+ with:
+ path: ~/.sonar/cache
+ key: ${{ runner.os }}-sonar
+ restore-keys: ${{ runner.os }}-sonar
+
- name: Cache Maven packages
- uses: actions/cache@v3
+ uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- - name: Verify
- run: ./mvnw -e -B verify
+ - name: Build and analyze
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=green-code-initiative_creedengo-rules-specifications
diff --git a/.github/workflows/publish_to_maven_central.yml b/.github/workflows/publish_to_maven_central.yml
index cfe7d0b3a..61b664641 100644
--- a/.github/workflows/publish_to_maven_central.yml
+++ b/.github/workflows/publish_to_maven_central.yml
@@ -4,7 +4,7 @@
# - Go to: https://s01.oss.sonatype.org/#stagingRepositories
# - Check upload and if all is right, "Close" corresponding Staging Repository
# - "Release" corresponding Staging Repository
-# - Wait some hours and then check availability of release on Maven central: https://search.maven.org/search?q=g:io.ecocode
+# - Wait some hours and then check availability of release on Maven central: https://search.maven.org/search?q=g:org.greencodeinitiative
#
# Additional information:
# - https://docs.github.com/en/actions/publishing-packages/publishing-java-packages-with-maven#publishing-packages-to-the-maven-central-repository
@@ -23,18 +23,18 @@ jobs:
steps:
# Checks out a copy of project's repository.
- name: Checkout
- uses: actions/checkout@v3
+ uses: actions/checkout@v4
# Sets up the Java JDK, and also configures the Maven `settings.xml` file to add authentication for the
# `ossrh` repository using the `OSSRH_USERNAME` and `OSSRH_TOKEN` environment variables.
- name: Set up Maven Central Repository
- uses: actions/setup-java@v3
+ uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
- server-id: 'ossrh' # must match the serverId configured for the nexus-staging-maven-plugin in `pom.xml`
- server-username: OSSRH_USERNAME
- server-password: OSSRH_TOKEN
+ server-id: 'central' # must match the serverId configured for the central-publishing-maven-plugin in `pom.xml`
+ server-username: MAVEN_USERNAME
+ server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Substituted with the value stored in the referenced secret
gpg-passphrase: MAVEN_GPG_PASSPHRASE # Env var that holds the key's passphrase
@@ -45,12 +45,12 @@ jobs:
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- # Runs the Maven command to publish to the `ossrh` repository.
- # The `OSSRH_USERNAME` environment variable will be set with the contents of your `OSSRH_USERNAME` secret,
- # and the `OSSRH_TOKEN` environment variable will be set with the contents of your `OSSRH_TOKEN` secret.
+ # Runs the Maven command to publish to the maven central repository.
+ # The `MAVEN_CENTRAL_USERNAME` environment variable will be set with the contents of your `MAVEN_CENTRAL_USERNAME` secret,
+ # and the `MAVEN_CENTRAL_TOKEN` environment variable will be set with the contents of your `MAVEN_CENTRAL_TOKEN` secret.
- name: Publish package
run: ./mvnw --batch-mode deploy -Pmaven-central-publishing
env:
- OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
- OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
+ MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
+ MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cb09e062f..cd0900552 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Deleted
+## [2.0.0] - 2024-12-10
+
+### Changed
+
+- First official release of creedengo-rules-specifications component (renaming ECxx rule ids to GCIxx rule ids, refactoring)
+
## [1.6.5] - 2024-10-18
### Changed
diff --git a/CODE_STYLE.md b/CODE_STYLE.md
index 86b0ab3f8..c46ab38c6 100644
--- a/CODE_STYLE.md
+++ b/CODE_STYLE.md
@@ -1 +1 @@
-Please read common [CODE_STYLE.md](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CODE_STYLE.md) in `ecoCode-common` repository.
+Please read common [CODE_STYLE.md](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/CODE_STYLE.md) in `creedengo-common` repository.
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 77e81dc64..aeeae9161 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -1 +1 @@
-Please read common [CONTRIBUTING.md](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CONTRIBUTING.md) in `ecoCode-common` repository.
+Please read common [CONTRIBUTING.md](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/CONTRIBUTING.md) in `creedengo-common` repository.
diff --git a/INSTALL.md b/INSTALL.md
index 551d8b588..d43635191 100644
--- a/INSTALL.md
+++ b/INSTALL.md
@@ -6,21 +6,6 @@
## Common installation notes / requirements
-Please read common [HOWTO.md](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/HOWTO.md)
-in `ecoCode-common` repository. Please follow the specific guides below for additional information on installing the
+Please read common [HOWTO.md](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/HOWTO.md)
+in `creedengo-common` repository. Please follow the specific guides below for additional information on installing the
desired plugins.
-
-## Special points for Standard plugins
-
-### Project structure
-
-Here is a preview of project tree :
-
-```txt
-ecoCode # Root directory
-|
-+--ecocode-rules-specifications # rules specifications
-
-```
-
-You will find more information about the plugins’ architecture in their folders
diff --git a/README.md b/README.md
index fb83c9b3b..6cbff6321 100644
--- a/README.md
+++ b/README.md
@@ -1,11 +1,11 @@
![Logo](docs/resources/logo-large.png)
======================================
-_ecoCode_ is a collective project aiming to reduce environmental footprint of software at the code level. The goal of
+_creedengo_ is a collective project aiming to reduce environmental footprint of software at the code level. The goal of
the project is to provide a list of static code analyzers to highlight code structures that may have a negative
ecological impact: energy and resources over-consumption, "fatware", shortening terminals' lifespan, etc.
-_ecoCode_ is based on evolving catalogs of [good practices](docs/rules), for various technologies. A SonarQube plugin
+_creedengo_ is based on evolving catalogs of [good practices](docs/rules), for various technologies. A SonarQube plugin
then implements these catalogs as rules for scanning your projects.
**Warning**: this is still a very early stage project. Any feedback or contribution will be highly appreciated. Please
@@ -53,15 +53,62 @@ For example, you’ll be able to access of all your `for` loop, to explore conte
To better understand AST structure, you can use the [AST Explorer](https://astexplorer.net/).
+### ecoCode rules specification repository
+
+This project contains the specifications of all ecoCode rules, for all languages.
+
+#### Structure
+
+Rules are organized by folder based on their ID in the [root rules folder](../src/main/rules).
+Each of these folders contains a file with the metadata of the rule, and description by language.
+
+The metadata file uses the format supported by
+the [SonarSource Analyzers Commons](https://github.com/SonarSource/sonar-analyzer-commons/tree/master/commons) library.
+To find out what values can be put there, we advise you to use the
+official [SonarQube documentation](https://docs.sonarsource.com/sonarqube/latest/user-guide/rules/overview/), and to
+rely on already existing files.
+
+Here is an example:
+
+```text
+src/main/rules
+├── EC104
+│ ├── java
+│ │ ├── EC104.asciidoc
+│ │ ├── EC104.json
+│ ├── php
+│ │ ├── EC104.asciidoc
+│ ├── python
+│ │ ├── EC104.asciidoc
+│ └── EC104.json
+├── ...
+```
+
+To specify metadata for a given language (for example deprecate a rule only for a single language), it is possible to
+create a json file in the language folder, and this will be merged with the common file during build. The keys in the
+specific file have priority and it is possible to add new ones but not to delete them from the global one.
+
+#### Description language
+
+The description of the rules uses the ASCIIDOC format (
+with [Markdown compatibility](https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/#markdown-compatibility))
+in order to allow the inclusion of other pages (this feature is not available in standard with Markdown).
+
+See:
+
+* [AsciiDoc Syntax Quick Reference](https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/)
+* [Compare AsciiDoc to Markdown](https://docs.asciidoctor.org/asciidoc/latest/asciidoc-vs-markdown/)
+
+
🚀 Getting Started
------------------
You can quickly have a look of ecoCode plugins with docker. Plase have a look at "Getting started" section of each plugin :
-- [Java plugin](https://github.com/green-code-initiative/ecoCode-java?tab=readme-ov-file#-getting-started)
-- [PHP plugin](https://github.com/green-code-initiative/ecoCode-php?tab=readme-ov-file#-getting-started)
-- [Python plugin](https://github.com/green-code-initiative/ecoCode-python?tab=readme-ov-file#-getting-started)
-- [C# plugin](https://github.com/green-code-initiative/ecoCode-csharp?tab=readme-ov-file#-getting-started)
+- [Java plugin](https://github.com/green-code-initiative/creedengo-java?tab=readme-ov-file#-getting-started)
+- [PHP plugin](https://github.com/green-code-initiative/creedengo-php?tab=readme-ov-file#-getting-started)
+- [Python plugin](https://github.com/green-code-initiative/creedengo-python?tab=readme-ov-file#-getting-started)
+- [C# plugin](https://github.com/green-code-initiative/creedengo-csharp?tab=readme-ov-file#-getting-started)
🛒 Distribution
------------------
diff --git a/ecocode-rules-specifications/README.md b/ecocode-rules-specifications/README.md
deleted file mode 100644
index b93d93d74..000000000
--- a/ecocode-rules-specifications/README.md
+++ /dev/null
@@ -1,45 +0,0 @@
-# ecoCode rules specification repository
-
-This project contains the specifications of all ecoCode rules, for all languages.
-
-## Structure
-
-Rules are organized by folder based on their ID in the [root rules folder](src/main/rules).
-Each of these folders contains a file with the metadata of the rule, and description by language.
-
-The metadata file uses the format supported by
-the [SonarSource Analyzers Commons](https://github.com/SonarSource/sonar-analyzer-commons/tree/master/commons) library.
-To find out what values can be put there, we advise you to use the
-official [SonarQube documentation](https://docs.sonarsource.com/sonarqube/latest/user-guide/rules/overview/), and to
-rely on already existing files.
-
-Here is an example:
-
-```text
-src/main/rules
-├── EC104
-│ ├── java
-│ │ ├── EC104.asciidoc
-│ │ ├── EC104.json
-│ ├── php
-│ │ ├── EC104.asciidoc
-│ ├── python
-│ │ ├── EC104.asciidoc
-│ └── EC104.json
-├── ...
-```
-
-To specify metadata for a given language (for example deprecate a rule only for a single language), it is possible to
-create a json file in the language folder, and this will be merged with the common file during build. The keys in the
-specific file have priority and it is possible to add new ones but not to delete them from the global one.
-
-## Description language
-
-The description of the rules uses the ASCIIDOC format (
-with [Markdown compatibility](https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/#markdown-compatibility))
-in order to allow the inclusion of other pages (this feature is not available in standard with Markdown).
-
-See:
-
-* [AsciiDoc Syntax Quick Reference](https://docs.asciidoctor.org/asciidoc/latest/syntax-quick-reference/)
-* [Compare AsciiDoc to Markdown](https://docs.asciidoctor.org/asciidoc/latest/asciidoc-vs-markdown/)
diff --git a/ecocode-rules-specifications/pom.xml b/ecocode-rules-specifications/pom.xml
deleted file mode 100644
index 5cd19de83..000000000
--- a/ecocode-rules-specifications/pom.xml
+++ /dev/null
@@ -1,198 +0,0 @@
-
-
- 4.0.0
-
-
- io.ecocode
- ecocode-parent
- ${revision}
- ../pom.xml
-
-
- ecocode-rules-specifications
-
- ecoCode Rules Specifications repository
- Repository that contains the specifications of every static-analysis rules available in ecoCode plugins.
- https://github.com/green-code-initiative/ecoCode/tree/main/ecocode-rules-specifications
-
-
-
-
- org.asciidoctor
- asciidoctor-maven-plugin
-
-
- convert-to-html
- generate-resources
-
- process-asciidoc
-
-
- ${project.basedir}/src/main/rules
- ${project.build.directory}/rules-html
-
- coderay
- style
-
- true
- true
- false
- true
-
-
- ERROR
-
-
-
-
-
-
-
- com.github.johnpoth
- jshell-maven-plugin
-
-
- prepare-rules-resources
- generate-resources
-
- run
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
-
-
- assembly-java
- prepare-package
-
- single
-
-
-
- ${project.basedir}/src/main/assembly/java.xml
-
-
-
-
- assembly-php
- prepare-package
-
- single
-
-
-
- ${project.basedir}/src/main/assembly/php.xml
-
-
-
-
- assembly-python
- prepare-package
-
- single
-
-
-
- ${project.basedir}/src/main/assembly/python.xml
-
-
-
-
- assembly-javascript
- prepare-package
-
- single
-
-
-
- ${project.basedir}/src/main/assembly/javascript.xml
-
-
-
-
- assembly-swift
- prepare-package
-
- single
-
-
-
- ${project.basedir}/src/main/assembly/swift.xml
-
-
-
-
- assembly-xml
- prepare-package
-
- single
-
-
-
- ${project.basedir}/src/main/assembly/xml.xml
-
-
-
-
- assembly-csharp
- prepare-package
-
- single
-
-
-
- ${project.basedir}/src/main/assembly/csharp.xml
-
-
-
-
- assembly-html
- prepare-package
-
- single
-
-
-
- ${project.basedir}/src/main/assembly/html.xml
-
-
-
-
-
- true
-
-
-
-
-
diff --git a/pom.xml b/pom.xml
index a5ad5cafb..fb02e2cd6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,15 +2,15 @@
4.0.0
- io.ecocode
- ecocode-parent
+ org.green-code-initiative
+ creedengo-rules-specifications${revision}
- pom
- ecoCode Sonar Plugins Project
- Provides rules to reduce the environmental footprint of your programs
- https://github.com/green-code-initiative/ecocode
- 2023
+ creedengo Rules Specifications repository
+ Repository that contains the specifications of every static-analysis rules available in creedengo plugins.
+ https://github.com/green-code-initiative/creedengo-rules-specifications
+
+ 2024green-code-initiativehttps://github.com/green-code-initiative
@@ -24,24 +24,20 @@
-
- Gilles Grousset
+ Gilles GROUSSETzippy1978@users.noreply.github.comgreen-code-initiativehttps://github.com/green-code-initiative
- Maxime Malgorn
+ Maxime MALGORNutarwyn@users.noreply.github.comgreen-code-initiativehttps://github.com/green-code-initiative
- Geoffrey Lalloué
+ Geoffrey LALLOUÉglalloue@users.noreply.github.comgreen-code-initiativehttps://github.com/green-code-initiative
@@ -53,44 +49,40 @@
https://github.com/green-code-initiative
- Olivier Le Goaër
+ Olivier LE GOAËRolegoaer@users.noreply.github.comgreen-code-initiativehttps://github.com/green-code-initiative
- Julien Hertout
+ Julien HERTOUTjhertout@users.noreply.github.comgreen-code-initiativehttps://github.com/green-code-initiative
- Jules Delecour
+ Jules DELECOURjules-delecour-dav@users.noreply.github.comgreen-code-initiativehttps://github.com/green-code-initiative
- DUBOIS Maxime
+ Maxime DUBOISmdubois81@users.noreply.github.comgreen-code-initiativehttps://github.com/green-code-initiative
-
- ecocode-rules-specifications
-
-
- scm:git:https://github.com/green-code-initiative/ecocode
- scm:git:https://github.com/green-code-initiative/ecocode
- https://github.com/green-code-initiative/ecocode
+ scm:git:https://github.com/green-code-initiative/creedengo-rules-specifications
+ scm:git:https://github.com/green-code-initiative/creedengo-rules-specifications
+ https://github.com/green-code-initiative/creedengo-rules-specificationsHEADGitHub
- https://github.com/green-code-initiative/ecocode/issues
+ https://github.com/green-code-initiative/creedengo-rules-specifications/issues
@@ -112,65 +104,17 @@
${encoding}${encoding}
+ green-code-initiative
+ https://sonarcloud.io
+
-
-
-
- me.qoomon
- maven-git-versioning-extension
- 9.8.1
-
-
- org.apache.maven.plugins
- maven-enforcer-plugin
- 3.5.0
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- 1.7.0
-
-
- org.apache.maven.plugins
- maven-gpg-plugin
- 3.2.7
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- 3.7.1
-
-
- com.github.johnpoth
- jshell-maven-plugin
- 1.4
-
-
- jakarta.json
- jakarta.json-api
- 2.1.3
-
-
- org.glassfish
- jakarta.json
- 2.0.1
- module
-
-
-
-
- org.asciidoctor
- asciidoctor-maven-plugin
- 3.0.0
-
-
- org.apache.maven.pluginsmaven-enforcer-plugin
+ 3.5.0enforce-maven
@@ -188,36 +132,201 @@
-
+ org.asciidoctor
+ asciidoctor-maven-plugin
+ 3.1.1
- validate
+ convert-to-html
+ generate-resources
- check
+ process-asciidoc
- validate
+
+ ../src/main/rules
+ ${project.build.directory}/rules-html
+
+ coderay
+ style
+
+ true
+ true
+ false
+ true
+
+
+ ERROR
+
+
+
- -->
+
+
+ com.github.johnpoth
+ jshell-maven-plugin
+ 1.4
+
+
+ jakarta.json
+ jakarta.json-api
+ 2.1.3
+
+
+ org.glassfish
+ jakarta.json
+ 2.0.1
+ module
+
+
+
+
+ prepare-rules-resources
+ generate-resources
+
+ run
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-assembly-plugin
+ 3.7.1
+
+
+ assembly-java
+ prepare-package
+
+ single
+
+
+
+ ../src/main/assembly/java.xml
+
+
+
+
+ assembly-php
+ prepare-package
+
+ single
+
+
+
+ ../src/main/assembly/php.xml
+
+
+
+
+ assembly-python
+ prepare-package
+
+ single
+
+
+
+ ../src/main/assembly/python.xml
+
+
+
+
+ assembly-javascript
+ prepare-package
+
+ single
+
+
+
+ ../src/main/assembly/javascript.xml
+
+
+
+
+ assembly-swift
+ prepare-package
+
+ single
+
+
+
+ ../src/main/assembly/swift.xml
+
+
+
+
+ assembly-xml
+ prepare-package
+
+ single
+
+
+
+ ../src/main/assembly/xml.xml
+
+
+
+
+ assembly-csharp
+ prepare-package
+
+ single
+
+
+
+ ../src/main/assembly/csharp.xml
+
+
+
+
+ assembly-html
+ prepare-package
+
+ single
+
+
+
+ ../src/main/assembly/html.xml
+
+
+
+
+
+ true
+
+
@@ -231,31 +340,41 @@
- https://central.sonatype.org/publish/release/#login-into-ossrh
-->
-
-
- ossrh
- https://s01.oss.sonatype.org/content/repositories/snapshots
-
-
-
- org.sonatype.plugins
- nexus-staging-maven-plugin
- true
+
+ org.apache.maven.plugins
+ maven-source-plugin
+ 3.3.1
+
+
+ attach-sources
+ verify
+
+ jar-no-fork
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 3.11.2
+
+
+ attach-javadoc
+
+ jar
+
+
+
- ossrh
- https://s01.oss.sonatype.org/
-
- true
+ java
+ none
-
-```
+----
-## Compliant Solution
+== Compliant Solution
-```xml
+[source,xml]
+----
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC11/EC11.json b/src/main/rules/GCI11/GCI11.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC11/EC11.json
rename to src/main/rules/GCI11/GCI11.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC11/javascript/EC11.asciidoc b/src/main/rules/GCI11/javascript/GCI11.asciidoc
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC11/javascript/EC11.asciidoc
rename to src/main/rules/GCI11/javascript/GCI11.asciidoc
diff --git a/ecocode-rules-specifications/src/main/rules/EC12/EC12.json b/src/main/rules/GCI12/GCI12.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC12/EC12.json
rename to src/main/rules/GCI12/GCI12.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC12/javascript/EC12.asciidoc b/src/main/rules/GCI12/javascript/GCI12.asciidoc
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC12/javascript/EC12.asciidoc
rename to src/main/rules/GCI12/javascript/GCI12.asciidoc
diff --git a/ecocode-rules-specifications/src/main/rules/EC13/EC13.json b/src/main/rules/GCI13/GCI13.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC13/EC13.json
rename to src/main/rules/GCI13/GCI13.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC13/javascript/EC13.asciidoc b/src/main/rules/GCI13/javascript/GCI13.asciidoc
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC13/javascript/EC13.asciidoc
rename to src/main/rules/GCI13/javascript/GCI13.asciidoc
diff --git a/ecocode-rules-specifications/src/main/rules/EC2/EC2.json b/src/main/rules/GCI2/GCI2.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC2/EC2.json
rename to src/main/rules/GCI2/GCI2.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC2/java/EC2.asciidoc b/src/main/rules/GCI2/java/GCI2.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC2/java/EC2.asciidoc
rename to src/main/rules/GCI2/java/GCI2.asciidoc
index df00a5933..bd874ef5b 100644
--- a/ecocode-rules-specifications/src/main/rules/EC2/java/EC2.asciidoc
+++ b/src/main/rules/GCI2/java/GCI2.asciidoc
@@ -3,7 +3,7 @@ We can think of using a switch statement instead of multiple if-else if possible
to reduce number of IF, ELSEIF and ELSE statements. Sometimes called "complexity cyclomatic".
Switch statement has a performance advantage over if – else.
-## Functional rules
+== Functional rules
- one variable must be used maximum twice in IF / ELSEIF / ELSE statements at the same level - WARNINGs :
- IF and ELSEIF statements use explicitly variable names !
- ELSE statements use implicity variable names !
@@ -12,13 +12,14 @@ Switch statement has a performance advantage over if – else.
- use a SWITCH statement instead
- or refactor the code if possible
-## Non-compliant Code Example
+== Non compliant Code Example
NON compliant, because `nb` is used 4 times :
- 2 explicit times in IF statements
- 2 implicit times in ELSE statements
-```java
+[source,java]
+----
int index = 1;
int nb = 2;
...
@@ -32,13 +33,14 @@ if (nb == 0) {
nb = -1;
}
return nb;
-```
+----
-## Compliant Code Example
+== Compliant Code Example
SWITCH statement solution + refactor solution
-```java
+[source,java]
+----
int index = 1;
int nb = 2;
...
@@ -52,4 +54,4 @@ switch (nb) {
nb = -1;
}
return nb;
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC2/php/EC2.asciidoc b/src/main/rules/GCI2/php/GCI2.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC2/php/EC2.asciidoc
rename to src/main/rules/GCI2/php/GCI2.asciidoc
index eae2c2817..56ab360c8 100644
--- a/ecocode-rules-specifications/src/main/rules/EC2/php/EC2.asciidoc
+++ b/src/main/rules/GCI2/php/GCI2.asciidoc
@@ -3,7 +3,7 @@ We can think of using a switch statement instead of multiple if-else if possible
to reduce number of IF, ELSEIF and ELSE statements. Sometimes called "complexity cyclomatic".
Switch statement has a performance advantage over if – else.
-## Functional rules
+== Functional rules
- one variable must be used maximum twice in IF / ELSEIF / ELSE statements at the same level - WARNINGs :
- IF and ELSEIF statements use explicitly variable names !
- ELSE statements use implicity variable names !
@@ -12,13 +12,14 @@ Switch statement has a performance advantage over if – else.
- use a SWITCH statement instead
- or refactor the code if possible
-## Non-compliant Code Example
+== Non compliant Code Example
NON compliant, because `$nb` is used 4 times :
- 2 explicit times in IF statements
- 2 implicit times in ELSE statements
-```php
+[source,php]
+----
$index = 1;
$nb = 2;
...
@@ -32,13 +33,14 @@ if ($nb == 0) {
$nb = -1;
}
return $nb;
-```
+----
-## Compliant Code Example
+== Compliant Code Example
SWITCH statement solution + refactor solution
-```php
+[source,php]
+----
$index = 1;
$nb = 2;
...
@@ -52,4 +54,4 @@ switch ($nb) {
$nb = -1;
}
return $nb;
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC2/python/EC2.asciidoc b/src/main/rules/GCI2/python/GCI2.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC2/python/EC2.asciidoc
rename to src/main/rules/GCI2/python/GCI2.asciidoc
index e2688d834..81cd9fa32 100644
--- a/ecocode-rules-specifications/src/main/rules/EC2/python/EC2.asciidoc
+++ b/src/main/rules/GCI2/python/GCI2.asciidoc
@@ -3,7 +3,7 @@ We can think of using a switch statement instead of multiple if-else if possible
to reduce number of IF, ELSEIF and ELSE statements. Sometimes called "complexity cyclomatic".
MATCH-CASE statement has a performance advantage over if – else.
-## Functional rules
+== Functional rules
- one variable must be used maximum twice in IF / ELSEIF / ELSE statements at the same level - WARNINGs :
- IF and ELSEIF statements use explicitly variable names !
- ELSE statements use implicity variable names !
@@ -12,13 +12,14 @@ MATCH-CASE statement has a performance advantage over if – else.
- use a MATCH-CASE statement instead
- or refactor the code if possible
-## Non-compliant Code Example
+== Non compliant Code Example
Non-compliant, because `nb` is used 4 times :
- 2 explicit times in IF statements
- 2 implicit times in ELSE statements
-```python
+[source,python]
+----
index = 1
nb = 2
...
@@ -31,13 +32,14 @@ elif nb == 2:
else:
nb = -1
return nb
-```
+----
-## Compliant Code Example
+== Compliant Code Example
MATCH-CASE statement solution + refactor solution
-```python
+[source,python]
+----
index = 1
nb = 2
...
@@ -51,4 +53,4 @@ match nb:
case _:
nb = -1
return nb
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC203/EC203.json b/src/main/rules/GCI203/GCI203.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC203/EC203.json
rename to src/main/rules/GCI203/GCI203.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC203/python/EC203.asciidoc b/src/main/rules/GCI203/python/GCI203.asciidoc
similarity index 82%
rename from ecocode-rules-specifications/src/main/rules/EC203/python/EC203.asciidoc
rename to src/main/rules/GCI203/python/GCI203.asciidoc
index 85d38acb6..8c7f1f1fd 100644
--- a/ecocode-rules-specifications/src/main/rules/EC203/python/EC203.asciidoc
+++ b/src/main/rules/GCI203/python/GCI203.asciidoc
@@ -15,64 +15,71 @@ Some advantages of using SVG:
- SVGs can be embedded into the HTML which means they can be cached, edited directly using CSS and indexed for greater accessibility.
- SVGs can be animated directly or by using CSS or JavaScript making it easy for web designers to add interactivity to a site.
-## Noncompliant Code Example
+== Non compliant Code Example
-```
+[source,python]
+----
img_jpg = "image.jpg"
-```
+----
-## Compliant Solution
+== Compliant Solution
-```
+[source,python]
+----
img_svg = "image.svg"
-```
+----
-## Noncompliant Code Example
+== Non compliant Code Example
-```
+[source,python]
+----
public void foo() {
// ...
image_format = testImage("image.jpg")
// ...
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```
+[source,python]
+----
public void foo() {
// ...
image_format = testImage("image.svg")
// ...
}
-```
+----
-## Noncompliant Code Example
+== Non compliant Code Example
-```
+[source,python]
+----
public void foo() {
// ...
return ''
// ...
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```
+[source,python]
+----
public void foo() {
// ...
return ''
// ...
}
-```
+----
Or
-```
+[source,python]
+----
public void foo() {
// ...
return ('')
// ...
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC22/EC22.json b/src/main/rules/GCI22/GCI22.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC22/EC22.json
rename to src/main/rules/GCI22/GCI22.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC22/php/EC22.asciidoc b/src/main/rules/GCI22/php/GCI22.asciidoc
similarity index 51%
rename from ecocode-rules-specifications/src/main/rules/EC22/php/EC22.asciidoc
rename to src/main/rules/GCI22/php/GCI22.asciidoc
index c42338993..b3f586708 100644
--- a/ecocode-rules-specifications/src/main/rules/EC22/php/EC22.asciidoc
+++ b/src/main/rules/GCI22/php/GCI22.asciidoc
@@ -1,13 +1,15 @@
Use of methods for basic operations
-## Noncompliant Code Example
+== Non compliant Code Example
-```php
+[source,php]
+----
$min = min($a, $b); // Noncompliant
-```
+----
-## Compliant Solution
+== Compliant Solution
-```php
+[source,php]
+----
$min = $a < $b ? $a : $b;
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC22/php/EC22.json b/src/main/rules/GCI22/php/GCI22.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC22/php/EC22.json
rename to src/main/rules/GCI22/php/GCI22.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC24/EC24.json b/src/main/rules/GCI24/GCI24.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC24/EC24.json
rename to src/main/rules/GCI24/GCI24.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC24/java/EC24.asciidoc b/src/main/rules/GCI24/java/GCI24.asciidoc
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC24/java/EC24.asciidoc
rename to src/main/rules/GCI24/java/GCI24.asciidoc
diff --git a/ecocode-rules-specifications/src/main/rules/EC24/javascript/EC24.asciidoc b/src/main/rules/GCI24/javascript/GCI24.asciidoc
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC24/javascript/EC24.asciidoc
rename to src/main/rules/GCI24/javascript/GCI24.asciidoc
diff --git a/ecocode-rules-specifications/src/main/rules/EC25/EC25.json b/src/main/rules/GCI25/GCI25.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC25/EC25.json
rename to src/main/rules/GCI25/GCI25.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC25/javascript/EC25.asciidoc b/src/main/rules/GCI25/javascript/GCI25.asciidoc
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC25/javascript/EC25.asciidoc
rename to src/main/rules/GCI25/javascript/GCI25.asciidoc
diff --git a/ecocode-rules-specifications/src/main/rules/EC26/EC26.json b/src/main/rules/GCI26/GCI26.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC26/EC26.json
rename to src/main/rules/GCI26/GCI26.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC26/javascript/EC26.asciidoc b/src/main/rules/GCI26/javascript/GCI26.asciidoc
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC26/javascript/EC26.asciidoc
rename to src/main/rules/GCI26/javascript/GCI26.asciidoc
diff --git a/ecocode-rules-specifications/src/main/rules/EC27/EC27.json b/src/main/rules/GCI27/GCI27.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC27/EC27.json
rename to src/main/rules/GCI27/GCI27.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC27/java/EC27.asciidoc b/src/main/rules/GCI27/java/GCI27.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC27/java/EC27.asciidoc
rename to src/main/rules/GCI27/java/GCI27.asciidoc
index 455e0a137..416f29076 100644
--- a/ecocode-rules-specifications/src/main/rules/EC27/java/EC27.asciidoc
+++ b/src/main/rules/GCI27/java/GCI27.asciidoc
@@ -8,21 +8,23 @@ In the case of table copying (table), use the native `System.arraycopy`.
We can also use `copyOf` or `clone` that are slightly less efficient.
The looping method will be outlawed.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
int len = array.length;
boolean[] copy = new boolean[array.length];
for (int i = 0; i < len; i++) {
copy[i] = array[i]; // Noncompliant
}
return copy;
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
int[] copy = new int[array.length];
System.arraycopy(array, 0, copy, 0, array.length);
return copy;
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC28/EC28.json b/src/main/rules/GCI28/GCI28.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC28/EC28.json
rename to src/main/rules/GCI28/GCI28.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC28/java/EC28.asciidoc b/src/main/rules/GCI28/java/GCI28.asciidoc
similarity index 84%
rename from ecocode-rules-specifications/src/main/rules/EC28/java/EC28.asciidoc
rename to src/main/rules/GCI28/java/GCI28.asciidoc
index 841ee9f8c..b131e2284 100644
--- a/ecocode-rules-specifications/src/main/rules/EC28/java/EC28.asciidoc
+++ b/src/main/rules/GCI28/java/GCI28.asciidoc
@@ -1,8 +1,9 @@
Optimize read file exception
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
public void readPreferences(String filename) {
//...
InputStream in = null;
@@ -14,11 +15,12 @@ public void readPreferences(String filename) {
in.read(...);
//...
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
public void readPreferences(String filename) throws IllegalArgumentException, FileNotFoundException, IOException {
if (filename == null) {
throw new IllegalArgumentException ("filename is null");
@@ -27,4 +29,4 @@ public void readPreferences(String filename) throws IllegalArgumentException, Fi
InputStream in = new FileInputStream(filename);
//...
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC29/EC29.json b/src/main/rules/GCI29/GCI29.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC29/EC29.json
rename to src/main/rules/GCI29/GCI29.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC29/javascript/EC29.asciidoc b/src/main/rules/GCI29/javascript/GCI29.asciidoc
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC29/javascript/EC29.asciidoc
rename to src/main/rules/GCI29/javascript/GCI29.asciidoc
diff --git a/ecocode-rules-specifications/src/main/rules/EC3/EC3.json b/src/main/rules/GCI3/GCI3.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC3/EC3.json
rename to src/main/rules/GCI3/GCI3.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC3/java/EC3.asciidoc b/src/main/rules/GCI3/java/GCI3.asciidoc
similarity index 82%
rename from ecocode-rules-specifications/src/main/rules/EC3/java/EC3.asciidoc
rename to src/main/rules/GCI3/java/GCI3.asciidoc
index 49fcb223e..4789f1ac7 100644
--- a/ecocode-rules-specifications/src/main/rules/EC3/java/EC3.asciidoc
+++ b/src/main/rules/GCI3/java/GCI3.asciidoc
@@ -1,22 +1,24 @@
When iterating over any collection, fetch the size of the collection in advance to avoid fetching it on each iteration, this saves CPU cycles, and therefore consumes less power. The example provided below illustrates what should be avoided.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
List objList = getData();
for (int i = 0; i < objList.size(); i++) { // Noncompliant
// execute code
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
List objList = getData();
int size = objList.size();
for (int i = 0; i < size; i++) {
// execute code
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC3/php/EC3.asciidoc b/src/main/rules/GCI3/php/GCI3.asciidoc
similarity index 94%
rename from ecocode-rules-specifications/src/main/rules/EC3/php/EC3.asciidoc
rename to src/main/rules/GCI3/php/GCI3.asciidoc
index 9c4d5bb81..489686e1b 100644
--- a/ecocode-rules-specifications/src/main/rules/EC3/php/EC3.asciidoc
+++ b/src/main/rules/GCI3/php/GCI3.asciidoc
@@ -2,9 +2,10 @@ When iterating over any collection, fetch the size of the collection in advance
NB : note that we are using the `count()` method to get the size of an array but it would work the same with the `sizeof()` and `iterator_count()` methods.
-## Noncompliant Code Example
+== Non compliant Code Example
-```php
+[source,php]
+----
$array = array('orange', 'banana', 'apple', 'carrot', 'collard', 'pea');
// FOR STATEMENTS / Right operand
@@ -44,11 +45,12 @@ do {
var_dump($array[$i]);
++$i;
} while (count($array) > $i);
-```
+----
-## Compliant Solution
+== Compliant Solution
-```php
+[source,php]
+----
$array = array('orange', 'banana', 'apple', 'carrot', 'collard', 'pea');
// FOR STATEMENTS / Right operand
$size = sizeof($array);
@@ -93,4 +95,4 @@ do {
var_dump($array[$i]);
++$i;
} while ($size > $i);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC30/EC30.json b/src/main/rules/GCI30/GCI30.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC30/EC30.json
rename to src/main/rules/GCI30/GCI30.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC30/javascript/EC30.asciidoc b/src/main/rules/GCI30/javascript/GCI30.asciidoc
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC30/javascript/EC30.asciidoc
rename to src/main/rules/GCI30/javascript/GCI30.asciidoc
diff --git a/ecocode-rules-specifications/src/main/rules/EC31/EC31.json b/src/main/rules/GCI31/GCI31.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC31/EC31.json
rename to src/main/rules/GCI31/GCI31.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC31/javascript/EC31.asciidoc b/src/main/rules/GCI31/javascript/GCI31.asciidoc
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC31/javascript/EC31.asciidoc
rename to src/main/rules/GCI31/javascript/GCI31.asciidoc
diff --git a/ecocode-rules-specifications/src/main/rules/EC32/EC32.json b/src/main/rules/GCI32/GCI32.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC32/EC32.json
rename to src/main/rules/GCI32/GCI32.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC32/java/EC32.asciidoc b/src/main/rules/GCI32/java/GCI32.asciidoc
similarity index 80%
rename from ecocode-rules-specifications/src/main/rules/EC32/java/EC32.asciidoc
rename to src/main/rules/GCI32/java/GCI32.asciidoc
index 00c2ac907..655f96efb 100644
--- a/ecocode-rules-specifications/src/main/rules/EC32/java/EC32.asciidoc
+++ b/src/main/rules/GCI32/java/GCI32.asciidoc
@@ -2,20 +2,22 @@ If you know in advance how many characters would be appended, initialize builder
They will thus never have to be resized.
This saves CPU cycles and therefore consumes less energy.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
StringBuilder sb = new StringBuilder(); // Noncompliant
for (int i = 0; i < 100; i++) {
sb.append(...);
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
StringBuilder sb = new StringBuilder(100);
for (int i = 0; i < 100; i++) {
sb.append(...);
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC34/EC34.json b/src/main/rules/GCI34/GCI34.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC34/EC34.json
rename to src/main/rules/GCI34/GCI34.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC34/php/1GB.etsdiff.csv b/src/main/rules/GCI34/php/1GB.etsdiff.csv
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC34/php/1GB.etsdiff.csv
rename to src/main/rules/GCI34/php/1GB.etsdiff.csv
diff --git a/ecocode-rules-specifications/src/main/rules/EC34/php/EC34.asciidoc b/src/main/rules/GCI34/php/GCI34.asciidoc
similarity index 89%
rename from ecocode-rules-specifications/src/main/rules/EC34/php/EC34.asciidoc
rename to src/main/rules/GCI34/php/GCI34.asciidoc
index 47b8d2e36..3f1aec8af 100644
--- a/ecocode-rules-specifications/src/main/rules/EC34/php/EC34.asciidoc
+++ b/src/main/rules/GCI34/php/GCI34.asciidoc
@@ -2,9 +2,10 @@ Inside complex code parts (for exemple multiple loops, complex data construction
When an exception is thrown, a variable (the exception itself) is created in a catch block and it's destruction consumes unnecessary CPU cycles and RAM. Prefer using logical tests in this cases.
-## Noncompliant Code Example
+== Non compliant Code Example
-```php
+[source,php]
+----
try
{
$picture = PDF_open_image_file($PDF, "jpeg", $imgFile, "", 0); // This is the original statement, this works on PHP4
@@ -14,11 +15,12 @@ catch(Exception $ex)
$msg = "Error opening $imgFile for Product $row['Identifier']";
throw new Exception($msg);
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```php
+[source,php]
+----
//try
if (file_exists($imgFile)) {
$picture = PDF_open_image_file($PDF, "jpeg", $imgFile, "", 0);
@@ -29,11 +31,11 @@ if (!$picture) {
$msg = "Error opening $imgFile for Product $row['Identifier']";
print $msg;
}
-```
+----
include::../../etsdiff-methodology.asciidoc[]
-## Case for a 1GB database:
+== Case for a 1GB database:
image::https://live.staticflickr.com/65535/52622382871_f19da08db4_o.png[ETSdiff percent comparison]
diff --git a/ecocode-rules-specifications/src/main/rules/EC34/php/EC34.json b/src/main/rules/GCI34/php/GCI34.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC34/php/EC34.json
rename to src/main/rules/GCI34/php/GCI34.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC35/EC35.json b/src/main/rules/GCI35/GCI35.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC35/EC35.json
rename to src/main/rules/GCI35/GCI35.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC35/php/1GB.etsdiff.csv b/src/main/rules/GCI35/php/1GB.etsdiff.csv
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC35/php/1GB.etsdiff.csv
rename to src/main/rules/GCI35/php/1GB.etsdiff.csv
diff --git a/ecocode-rules-specifications/src/main/rules/EC35/php/EC35.asciidoc b/src/main/rules/GCI35/php/GCI35.asciidoc
similarity index 89%
rename from ecocode-rules-specifications/src/main/rules/EC35/php/EC35.asciidoc
rename to src/main/rules/GCI35/php/GCI35.asciidoc
index 60f1e8c0b..b9a2c6e35 100644
--- a/ecocode-rules-specifications/src/main/rules/EC35/php/EC35.asciidoc
+++ b/src/main/rules/GCI35/php/GCI35.asciidoc
@@ -3,9 +3,10 @@ For the moment, this rule only deals with "file open" use case in try...catch bl
When an exception is thrown, a variable (the exception itself) is created in a catch block and it's destruction consumes unnecessary CPU cycles and RAM. Prefer using logical tests in this cases.
-## Noncompliant Code Example
+== Non compliant Code Example
-```php
+[source,php]
+----
try
{
$picture = PDF_open_image_file($PDF, "jpeg", $imgFile, "", 0); // This is the original statement, this works on PHP4
@@ -15,11 +16,12 @@ catch(Exception $ex)
$msg = "Error opening $imgFile for Product $row['Identifier']";
throw new Exception($msg);
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```php
+[source,php]
+----
//try
if (file_exists($imgFile)) {
$picture = PDF_open_image_file($PDF, "jpeg", $imgFile, "", 0);
@@ -30,11 +32,11 @@ if (!$picture) {
$msg = "Error opening $imgFile for Product $row['Identifier']";
print $msg;
}
-```
+----
include::../../etsdiff-methodology.asciidoc[]
-## Case for a 1GB database:
+== Case for a 1GB database:
image::https://live.staticflickr.com/65535/52622382871_f19da08db4_o.png[ETSdiff percent comparison]
diff --git a/ecocode-rules-specifications/src/main/rules/EC35/python/EC35.asciidoc b/src/main/rules/GCI35/python/GCI35.asciidoc
similarity index 84%
rename from ecocode-rules-specifications/src/main/rules/EC35/python/EC35.asciidoc
rename to src/main/rules/GCI35/python/GCI35.asciidoc
index 08fc1f95f..28647b8a1 100644
--- a/ecocode-rules-specifications/src/main/rules/EC35/python/EC35.asciidoc
+++ b/src/main/rules/GCI35/python/GCI35.asciidoc
@@ -3,9 +3,10 @@ For the moment, this rule only deals with "file open" use case in try...catch bl
When an exception is thrown, a variable (the exception itself) is created in a catch block, and it's destruction consumes unnecessary CPU cycles and RAM. Prefer using logical tests in this cases.
-## Noncompliant Code Example
+== Non compliant Code Example
-```python
+[source,python]
+----
try:
f = open(path)
print(fh.read())
@@ -13,14 +14,15 @@ except:
print('No such file '+path
finally:
f.close()
-```
+----
-## Compliant Solution
+== Compliant Solution
-```python
+[source,python]
+----
if os.path.isfile(path):
fh = open(path, 'r')
print(fh.read())
fh.close
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC36/EC36.json b/src/main/rules/GCI36/GCI36.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC36/EC36.json
rename to src/main/rules/GCI36/GCI36.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC36/html/EC36.asciidoc b/src/main/rules/GCI36/html/GCI36.asciidoc
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC36/html/EC36.asciidoc
rename to src/main/rules/GCI36/html/GCI36.asciidoc
diff --git a/ecocode-rules-specifications/src/main/rules/EC4/EC4.json b/src/main/rules/GCI4/GCI4.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC4/EC4.json
rename to src/main/rules/GCI4/GCI4.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC4/php/EC4.asciidoc b/src/main/rules/GCI4/php/GCI4.asciidoc
similarity index 85%
rename from ecocode-rules-specifications/src/main/rules/EC4/php/EC4.asciidoc
rename to src/main/rules/GCI4/php/GCI4.asciidoc
index 94021a9e6..94bfbd614 100644
--- a/ecocode-rules-specifications/src/main/rules/EC4/php/EC4.asciidoc
+++ b/src/main/rules/GCI4/php/GCI4.asciidoc
@@ -2,9 +2,10 @@ Prefer local variables as parameters
When calling a global variable, the interpretation engine must check that it exists in all the scopes, that it has a value, etc. Passing global variables as arguments gives them the status of local variables inside the function, thus saving computing time (CPU cycles).
-## Noncompliant Code Example
+== Non compliant Code Example
-```php
+[source,php]
+----
var aGlobal = new String('Hello');
function globalLength(){
@@ -13,11 +14,12 @@ function globalLength(){
}
globalLength();
-```
+----
-## Compliant Solution
+== Compliant Solution
-```php
+[source,php]
+----
var aGlobal = new String('Hello');
function someVarLength(str){
@@ -26,4 +28,4 @@ function someVarLength(str){
}
somVarLength(aGlobal);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC4/python/EC4.asciidoc b/src/main/rules/GCI4/python/GCI4.asciidoc
similarity index 82%
rename from ecocode-rules-specifications/src/main/rules/EC4/python/EC4.asciidoc
rename to src/main/rules/GCI4/python/GCI4.asciidoc
index b777840a9..d76ae8baa 100644
--- a/ecocode-rules-specifications/src/main/rules/EC4/python/EC4.asciidoc
+++ b/src/main/rules/GCI4/python/GCI4.asciidoc
@@ -1,19 +1,21 @@
When function calls global variables, a lot a CPU cycles is consumed.
-## Noncompliant Code Example
+== Non compliant Code Example
-```python
+[source,python]
+----
global_var = 'foo'
def print_global_var_details():
print(len(global_var)) # Noncompliant
print('Global var : ', global_var) # Noncompliant
print('Global var : ' + global_var) # Noncompliant
print_global_var_details()
-```
+----
-## Compliant Solution
+== Compliant Solution
-```python
+[source,python]
+----
global_var = 'foo';
def print_var_details(local_var) {
print(len(local_var));
@@ -21,4 +23,4 @@ def print_var_details(local_var) {
print('Var : ' + local_var)
}
print_length(global_var);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC404/EC404.json b/src/main/rules/GCI404/GCI404.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC404/EC404.json
rename to src/main/rules/GCI404/GCI404.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC404/python/EC404.asciidoc b/src/main/rules/GCI404/python/GCI404.asciidoc
similarity index 88%
rename from ecocode-rules-specifications/src/main/rules/EC404/python/EC404.asciidoc
rename to src/main/rules/GCI404/python/GCI404.asciidoc
index 4a0738f9f..14ac668e4 100644
--- a/ecocode-rules-specifications/src/main/rules/EC404/python/EC404.asciidoc
+++ b/src/main/rules/GCI404/python/GCI404.asciidoc
@@ -4,17 +4,19 @@ Python generators resemble lazy lists from other programming languages: when ite
For more details on list comprehensions vs generator comprehensions, see https://docs.python.org/3/howto/functional.html#generator-expressions-and-list-comprehensions[Python documentation].
-## Noncompliant Code Example
+== Non compliant Code Example
-```python
+[source,python]
+----
for var in [var2 for var2 in range(100)]:
...
-```
+----
-## Compliant Solution
+== Compliant Solution
-```python
+[source,python]
+----
for var in (var2 for var2 in range(100)):
...
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC5/EC5.json b/src/main/rules/GCI5/GCI5.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC5/EC5.json
rename to src/main/rules/GCI5/GCI5.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC5/java/EC5.asciidoc b/src/main/rules/GCI5/java/GCI5.asciidoc
similarity index 87%
rename from ecocode-rules-specifications/src/main/rules/EC5/java/EC5.asciidoc
rename to src/main/rules/GCI5/java/GCI5.asciidoc
index 229a3503d..a9be9fcc9 100644
--- a/ecocode-rules-specifications/src/main/rules/EC5/java/EC5.asciidoc
+++ b/src/main/rules/GCI5/java/GCI5.asciidoc
@@ -1,17 +1,19 @@
Use `PreparedStatement` instead of `Statement`, because SQL will only commit the query once, whereas if you used only one statement, it would commit the query every time and thus induce unnecessary calculations by the CPU and therefore superfluous energy consumption.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
public void select() {
Statement statement = connection.createStatement();
statement.executeUpdate("INSERT INTO persons(id, name) VALUES(2, 'John DOE')"); // Noncompliant
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
public void select() {
PreparedStatement statement = connection.prepareStatement(INSERT INTO persons(id, name) VALUES(?, ?));
@@ -19,4 +21,4 @@ public void select() {
statement.setString(2, "John DOE");
statement.executeQuery();
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC500/EC500.json b/src/main/rules/GCI500/GCI500.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC500/EC500.json
rename to src/main/rules/GCI500/GCI500.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC500/java/EC500.asciidoc b/src/main/rules/GCI500/java/GCI500.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC500/java/EC500.asciidoc
rename to src/main/rules/GCI500/java/GCI500.asciidoc
index 951822492..7e2052d20 100644
--- a/ecocode-rules-specifications/src/main/rules/EC500/java/EC500.asciidoc
+++ b/src/main/rules/GCI500/java/GCI500.asciidoc
@@ -4,22 +4,24 @@ Instead, `SensorManager#registerListener(SensorEventListener, Sensor, int, int m
Once one of the events in the FIFO needs to be reported, all the events in the FIFO are reported sequentially. Setting `maxReportLatencyUs` to a positive value allows to reduce the number of interrupts the AP (Application Processor) receives, hence reducing power consumption, as the AP can switch to a lower power state while the sensor is capturing the data.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
SensorEventListener sensorEventListener;
SensorManager sensorManager;
Sensor sensor;
sensorManager.registerListener(sensorEventListener, sensor, SensorManager.SENSOR_DELAY_NORMAL);
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
SensorEventListener sensorEventListener;
SensorManager sensorManager;
Sensor sensor;
sensorManager.registerListener(sensorEventListener, sensor, SensorManager.SENSOR_DELAY_NORMAL, 200000);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC501/EC501.json b/src/main/rules/GCI501/GCI501.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC501/EC501.json
rename to src/main/rules/GCI501/GCI501.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC501/java/EC501.asciidoc b/src/main/rules/GCI501/java/GCI501.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC501/java/EC501.asciidoc
rename to src/main/rules/GCI501/java/GCI501.asciidoc
index 84062dbab..1f0a464fe 100644
--- a/ecocode-rules-specifications/src/main/rules/EC501/java/EC501.asciidoc
+++ b/src/main/rules/GCI501/java/GCI501.asciidoc
@@ -4,9 +4,10 @@ Compared to a custom Sync Adapter or the alarm manager, the Job Scheduler suppor
The Android system can combine jobs so that battery consumption is reduced.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
void setAlarm(Context context) {
AlarmManager alarmManager = (AlarmManager)context.getSystemService(Context.ALARM_SERVICE);
Intent intent = new Intent(context, Alarm.class);
@@ -16,11 +17,12 @@ void setAlarm(Context context) {
Alarm alarm = new Alarm();
alarm.setAlarm(this);
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
JobInfo info = new JobInfo.Builder(123, COMPONENT_NAME)
.setRequiresCharging(true)
.setRequiredNetworkType(JobInfo.NETWORK_TYPE_UNMETERED)
@@ -29,4 +31,4 @@ JobInfo info = new JobInfo.Builder(123, COMPONENT_NAME)
.build();
JobScheduler scheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);
scheduler.schedule(info);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC502/EC502.json b/src/main/rules/GCI502/GCI502.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC502/EC502.json
rename to src/main/rules/GCI502/GCI502.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC502/java/EC502.asciidoc b/src/main/rules/GCI502/java/GCI502.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC502/java/EC502.asciidoc
rename to src/main/rules/GCI502/java/GCI502.asciidoc
index c645aaf93..388849978 100644
--- a/ecocode-rules-specifications/src/main/rules/EC502/java/EC502.asciidoc
+++ b/src/main/rules/GCI502/java/GCI502.asciidoc
@@ -2,10 +2,11 @@ Opening and closing internet connection continuously is extremely battery-ineffi
Also, this bad practice must be early prevented because it is the root of another evil that consists in polling data at regular intervals, instead of using push notifications to save a lot of battery power.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
for (int val : myArray) {
URL.openConnection();
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC503/EC503.json b/src/main/rules/GCI503/GCI503.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC503/EC503.json
rename to src/main/rules/GCI503/GCI503.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC503/java/EC503.asciidoc b/src/main/rules/GCI503/java/GCI503.asciidoc
similarity index 88%
rename from ecocode-rules-specifications/src/main/rules/EC503/java/EC503.asciidoc
rename to src/main/rules/GCI503/java/GCI503.asciidoc
index 674011019..0407d70c7 100644
--- a/ecocode-rules-specifications/src/main/rules/EC503/java/EC503.asciidoc
+++ b/src/main/rules/GCI503/java/GCI503.asciidoc
@@ -2,19 +2,21 @@ Normally the Wi-Fi stack filters out packets not explicitly addressed to the dev
Processing these extra packets can cause a noticeable battery drain and must be disabled when not needed with to a call to `WifiManager.MulticastLock.release()`.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
WifiManager.MulticastLock lock = wifiManager.createMulticastLock("tag");
lock.acquire();
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
WifiManager wifiManager = (WifiManager) getApplicationContext().getSystemService(Context.WIFI_SERVICE);
WifiManager.MulticastLock lock = wifiManager.createMulticastLock("tag");
lock.acquire();
lock.release()
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC504/EC504.json b/src/main/rules/GCI504/GCI504.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC504/EC504.json
rename to src/main/rules/GCI504/GCI504.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC504/java/EC504.asciidoc b/src/main/rules/GCI504/java/GCI504.asciidoc
similarity index 75%
rename from ecocode-rules-specifications/src/main/rules/EC504/java/EC504.asciidoc
rename to src/main/rules/GCI504/java/GCI504.asciidoc
index 80f67b532..f2730c290 100644
--- a/ecocode-rules-specifications/src/main/rules/EC504/java/EC504.asciidoc
+++ b/src/main/rules/GCI504/java/GCI504.asciidoc
@@ -1,17 +1,19 @@
Transmitting a file over a network infrastructure without compressing it consumes more energy than with compression. More precisely, energy efficiency is improved in case the data is compressed at least by 10%, transmitted and decompressed at the other network node. From the Android client side, it means making a post HTTP request using a `GZIPOutputStream` instead of the classical OutputStream, along with the `HttpURLConnection` object.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
-Url url = new Url("https://www.ecocode.io/");
+[source,java]
+----
+Url url = new Url("https://www.green-code-initiative.io/");
HttpsUrlConnection con = (HttpsURLConnection) url.openConnection();
OutputStream stream = con.getOutputStream();
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
-Url url = new Url("https://www.ecocode.io/");
+[source,java]
+----
+Url url = new Url("https://www.green-code-initiative.io/");
HttpsUrlConnection con = (HttpsURLConnection) url.openConnection();
OutputStream stream = new GZIPOutputStream(con.getOutputStream());
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC505/EC505.json b/src/main/rules/GCI505/GCI505.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC505/EC505.json
rename to src/main/rules/GCI505/GCI505.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC505/java/EC505.asciidoc b/src/main/rules/GCI505/java/GCI505.asciidoc
similarity index 88%
rename from ecocode-rules-specifications/src/main/rules/EC505/java/EC505.asciidoc
rename to src/main/rules/GCI505/java/GCI505.asciidoc
index 8cb61fe1e..d7fe87a9a 100644
--- a/ecocode-rules-specifications/src/main/rules/EC505/java/EC505.asciidoc
+++ b/src/main/rules/GCI505/java/GCI505.asciidoc
@@ -2,8 +2,9 @@ To avoid draining the battery, an Android device that is left idle quickly falls
Hence, keeping the screen on should be avoided, unless it is absolutely necessary. If so, developers typically use the `FLAG_KEEP_SCREEN_ON` in their activity. Another way to implement this is in their application's layout XML file, by using the `android:keepScreenOn` attribute.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
getWindow().addFlags(FLAG_KEEP_SCREEN_ON);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC505/swift/EC505.asciidoc b/src/main/rules/GCI505/swift/GCI505.asciidoc
similarity index 85%
rename from ecocode-rules-specifications/src/main/rules/EC505/swift/EC505.asciidoc
rename to src/main/rules/GCI505/swift/GCI505.asciidoc
index 17999dc22..dd1b579cf 100644
--- a/ecocode-rules-specifications/src/main/rules/EC505/swift/EC505.asciidoc
+++ b/src/main/rules/GCI505/swift/GCI505.asciidoc
@@ -3,9 +3,10 @@ To avoid draining the battery, an iOS device that is left idle quickly falls asl
Hence, keeping the screen on should be avoided, unless it is absolutely necessary. If so, developers typically
disable the idle timer with `UIApplication.shared.isIdleTimerDisabled = true`.
-## Noncompliant Code Example
+== Non compliant Code Example
-```swift
+[source,swift]
+----
UIApplication.shared.isIdleTimerDisabled = true
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC505/xml/EC505.asciidoc b/src/main/rules/GCI505/xml/GCI505.asciidoc
similarity index 85%
rename from ecocode-rules-specifications/src/main/rules/EC505/xml/EC505.asciidoc
rename to src/main/rules/GCI505/xml/GCI505.asciidoc
index ddb1cf0c0..3d79d936e 100644
--- a/ecocode-rules-specifications/src/main/rules/EC505/xml/EC505.asciidoc
+++ b/src/main/rules/GCI505/xml/GCI505.asciidoc
@@ -1,23 +1,25 @@
-Score ecoCode: 2sur5
+Score creedengo: 2sur5
To avoid draining the battery, an Android device that is left idle quickly falls asleep.
Hence, keeping the screen on should be avoided, unless it is absolutely necessary. If so, developers typically use the `FLAG_KEEP_SCREEN_ON` in their activity. Another way to implement this is in their application's layout XML file, by using the `android:keepScreenOn` attribute.
-## Noncompliant Code Example
+== Non compliant Code Example
-```xml
+[source,xml]
+----
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```xml
+[source,xml]
+----
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC506/EC506.json b/src/main/rules/GCI506/GCI506.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC506/EC506.json
rename to src/main/rules/GCI506/GCI506.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC506/java/EC506.asciidoc b/src/main/rules/GCI506/java/GCI506.asciidoc
similarity index 88%
rename from ecocode-rules-specifications/src/main/rules/EC506/java/EC506.asciidoc
rename to src/main/rules/GCI506/java/GCI506.asciidoc
index b047c41cc..9764c6d57 100644
--- a/ecocode-rules-specifications/src/main/rules/EC506/java/EC506.asciidoc
+++ b/src/main/rules/GCI506/java/GCI506.asciidoc
@@ -2,8 +2,9 @@ To avoid draining the battery, an Android device that is left idle quickly falls
Hence, keeping the screen on should be avoided, unless it is absolutely necessary. If so, developers typically use the `FLAG_KEEP_SCREEN_ON` in their activity. Another way to implement this is in their application's layout XML file, by using the `android:keepScreenOn` attribute.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
getWindow().setFlags(FLAG_KEEP_SCREEN_ON, FLAG_KEEP_SCREEN_ON);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC507/EC507.json b/src/main/rules/GCI507/GCI507.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC507/EC507.json
rename to src/main/rules/GCI507/GCI507.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC507/java/EC507.asciidoc b/src/main/rules/GCI507/java/GCI507.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC507/java/EC507.asciidoc
rename to src/main/rules/GCI507/java/GCI507.asciidoc
index a1a8362d5..9270a91fb 100644
--- a/ecocode-rules-specifications/src/main/rules/EC507/java/EC507.asciidoc
+++ b/src/main/rules/GCI507/java/GCI507.asciidoc
@@ -2,9 +2,10 @@ To avoid draining the battery, an Android device that is left idle quickly falls
If so, developers typically use a Power Manager system service feature called wake locks by invoking `PowerManager.WakeLock#newWakeLock(int levelAndFlags, String tag)`, along with the specific permission `WAKE_LOCK` in their manifest.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE);
WakeLock manager = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "TAG");
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC507/xml/EC507.asciidoc b/src/main/rules/GCI507/xml/GCI507.asciidoc
similarity index 86%
rename from ecocode-rules-specifications/src/main/rules/EC507/xml/EC507.asciidoc
rename to src/main/rules/GCI507/xml/GCI507.asciidoc
index b3b66f946..f16aa2d6c 100644
--- a/ecocode-rules-specifications/src/main/rules/EC507/xml/EC507.asciidoc
+++ b/src/main/rules/GCI507/xml/GCI507.asciidoc
@@ -1,4 +1,4 @@
-Score ecoCode: 2sur5
+Score creedengo: 2sur5
To avoid draining the battery, an Android device that is left idle quickly falls asleep.
@@ -8,10 +8,11 @@ If so, developers typically use a Power Manager system service feature called wa
by invoking `PowerManager.WakeLock#newWakeLock(int levelAndFlags, String tag)`,
along with the specific permission `WAKE_LOCK` in their manifest.
-## Noncompliant Code Example
+== Non compliant Code Example
-```xml
+[source,xml]
+----
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC508/EC508.json b/src/main/rules/GCI508/GCI508.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC508/EC508.json
rename to src/main/rules/GCI508/GCI508.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC508/java/EC508.asciidoc b/src/main/rules/GCI508/java/GCI508.asciidoc
similarity index 87%
rename from ecocode-rules-specifications/src/main/rules/EC508/java/EC508.asciidoc
rename to src/main/rules/GCI508/java/GCI508.asciidoc
index 98bf682f7..0e5e22cf5 100644
--- a/ecocode-rules-specifications/src/main/rules/EC508/java/EC508.asciidoc
+++ b/src/main/rules/GCI508/java/GCI508.asciidoc
@@ -4,14 +4,16 @@ Hence, the challenge here is to release the lock as soon as possible to avoid ru
This can be avoided by a call to `PowerManager#acquire(long timeout)` instead of `PowerManager#acquire()`, because the lock will be released for sure after the given timeout expires.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
PowerManager.acquire()
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
PowerManager.acquire(long timeout)
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC509/EC509.json b/src/main/rules/GCI509/GCI509.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC509/EC509.json
rename to src/main/rules/GCI509/GCI509.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC509/java/EC509.asciidoc b/src/main/rules/GCI509/java/GCI509.asciidoc
similarity index 89%
rename from ecocode-rules-specifications/src/main/rules/EC509/java/EC509.asciidoc
rename to src/main/rules/GCI509/java/GCI509.asciidoc
index a477697e7..2321aaf29 100644
--- a/ecocode-rules-specifications/src/main/rules/EC509/java/EC509.asciidoc
+++ b/src/main/rules/GCI509/java/GCI509.asciidoc
@@ -4,28 +4,36 @@ For most apps prior to API 19, `setInexactRepeating()` is preferable over `setRe
Similarly after API 19, `setExact()` and `setExactAndAllowWhileIdle()` can significantly impact the power use of the device when idle, so they should be used with care. High-frequency alarms are also bad for battery life but this is already checked by Android lint (ShortAlarm built-in check).
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
AlarmManager alarmManager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
alarmManager.setRepeating(alarmType, triggerAtMillis, intervalMillis, operation);
-``` or
-```java
+----
+or
+[source,java]
+----
AlarmManager alarmManager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
alarmManager.setExact(type,triggerAtMillis,operation);
-``` or
-```java
+----
+or
+[source,java]
+----
AlarmManager alarmManager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
alarmManager.setExact(type,triggerAtMillis,tag,listener,targetHandler);
-``` or
-```java
+----
+or
+[source,java]
+----
AlarmManager alarmManager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
alarmManager.setExactAndAllowWhileIdle(type,triggerAtMilllis,operation);
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
AlarmManager alarmManager = (AlarmManager) this.getSystemService(Context.ALARM_SERVICE);
alarmManager.setInexactRepeating(alarmType, triggerAtMillis, intervalMillis, operation);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC509/swift/EC509.asciidoc b/src/main/rules/GCI509/swift/GCI509.asciidoc
similarity index 86%
rename from ecocode-rules-specifications/src/main/rules/EC509/swift/EC509.asciidoc
rename to src/main/rules/GCI509/swift/GCI509.asciidoc
index 3663db78d..77e2a9e2f 100644
--- a/ecocode-rules-specifications/src/main/rules/EC509/swift/EC509.asciidoc
+++ b/src/main/rules/GCI509/swift/GCI509.asciidoc
@@ -1,14 +1,16 @@
Setting a tolerance for timers will allow them to fire later than the scheduled fire date. The system will use this flexibility to shift the execution of timers by small amounts of time, within their tolerances, increasing the ability to optimize power savings. Your app can set the `Timer#tolerance` property to specify a tolerance for a timer. Using this approach dramatically increases the amount of time that the processor spends idling while users detect no change in system responsiveness.
-## Noncompliant Code Example
+== Non compliant Code Example
-```swift
+[source,swift]
+----
let timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { _ in }
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```swift
+[source,swift]
+----
let timer = Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { _ in }
timer.tolerance = 0.5
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC510/EC510.json b/src/main/rules/GCI510/GCI510.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC510/EC510.json
rename to src/main/rules/GCI510/GCI510.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC510/java/EC510.asciidoc b/src/main/rules/GCI510/java/GCI510.asciidoc
similarity index 85%
rename from ecocode-rules-specifications/src/main/rules/EC510/java/EC510.asciidoc
rename to src/main/rules/GCI510/java/GCI510.asciidoc
index 9d12df018..288722410 100644
--- a/ecocode-rules-specifications/src/main/rules/EC510/java/EC510.asciidoc
+++ b/src/main/rules/GCI510/java/GCI510.asciidoc
@@ -1,15 +1,17 @@
For developers wishing to display OpenGL rendering, when choosing the rendering mode with `GLSurfaceView#setRenderMode(int renderMode)`, using `RENDERMODE_WHEN_DIRTY` instead of `RENDERMODE_CONTINUOUSLY` (by default) can improve battery life and overall system performance by allowing the GPU and CPU to idle when the view does not need to be updated.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
GLSurfaceView surfaceView = new GLSurfaceView(this);
surfaceView.setRenderMode(GLSurfaceView.RENDERMODE_CONTINUOUSLY)
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
GLSurfaceView surfaceView = new GLSurfaceView(this);
surfaceView.setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY)
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC511/EC511.json b/src/main/rules/GCI511/GCI511.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC511/EC511.json
rename to src/main/rules/GCI511/GCI511.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC511/java/EC511.asciidoc b/src/main/rules/GCI511/java/GCI511.asciidoc
similarity index 85%
rename from ecocode-rules-specifications/src/main/rules/EC511/java/EC511.asciidoc
rename to src/main/rules/GCI511/java/GCI511.asciidoc
index c911421da..af7dae9bd 100644
--- a/ecocode-rules-specifications/src/main/rules/EC511/java/EC511.asciidoc
+++ b/src/main/rules/GCI511/java/GCI511.asciidoc
@@ -2,22 +2,25 @@ During a voice interaction session, `VoiceInteractionSession#setKeepAwake(boolea
By default, the system holds a wake lock for it while in this state, so that it can work even if the screen is off. Setting this to `false` removes that wake lock, allowing the CPU to go to sleep and hence does not let this continue to drain the battery.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
VoiceInteractionSession voiceSession = new VoiceInteractionSession(this);
-```
+----
or
-```java
+[source,java]
+----
VoiceInteractionSession voiceSession = new VoiceInteractionSession(this);
voiceSession.setKeepAwake(true);
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
VoiceInteractionSession voiceSession = new VoiceInteractionSession(this);
voiceSession.setKeepAwake(false);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC512/EC512.json b/src/main/rules/GCI512/GCI512.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC512/EC512.json
rename to src/main/rules/GCI512/GCI512.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC512/java/EC512.asciidoc b/src/main/rules/GCI512/java/GCI512.asciidoc
similarity index 86%
rename from ecocode-rules-specifications/src/main/rules/EC512/java/EC512.asciidoc
rename to src/main/rules/GCI512/java/GCI512.asciidoc
index 782c35274..15695507f 100644
--- a/ecocode-rules-specifications/src/main/rules/EC512/java/EC512.asciidoc
+++ b/src/main/rules/GCI512/java/GCI512.asciidoc
@@ -6,15 +6,17 @@ The common point of all these sensors is that they are expensive while in use. T
Consequently, calls must be carefully pairwised: `Camera.open()/Camera.release()`.
Failing to do so can drain the battery in just a few hours.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
Camera camera = Camera.open();
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
Camera camera = Camera.open();
camera.release();
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC513/EC513.json b/src/main/rules/GCI513/GCI513.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC513/EC513.json
rename to src/main/rules/GCI513/GCI513.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC513/java/EC513.asciidoc b/src/main/rules/GCI513/java/GCI513.asciidoc
similarity index 90%
rename from ecocode-rules-specifications/src/main/rules/EC513/java/EC513.asciidoc
rename to src/main/rules/GCI513/java/GCI513.asciidoc
index cdc8b59a1..7f06765f0 100644
--- a/ecocode-rules-specifications/src/main/rules/EC513/java/EC513.asciidoc
+++ b/src/main/rules/GCI513/java/GCI513.asciidoc
@@ -7,17 +7,19 @@ The common point of all these sensors is that they are expensive while in use. T
Failing to do so can drain the battery in just a few hours.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 1.0f, this);
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
LocationManager locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 1000L, 1.0f, this);
locationManager.removeUpdates(this);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC513/swift/EC513.asciidoc b/src/main/rules/GCI513/swift/GCI513.asciidoc
similarity index 98%
rename from ecocode-rules-specifications/src/main/rules/EC513/swift/EC513.asciidoc
rename to src/main/rules/GCI513/swift/GCI513.asciidoc
index efcb0b784..dd25ac311 100644
--- a/ecocode-rules-specifications/src/main/rules/EC513/swift/EC513.asciidoc
+++ b/src/main/rules/GCI513/swift/GCI513.asciidoc
@@ -6,7 +6,7 @@ The common point of all these sensors is that they are power-intensive while in
Consequently, calls must be carefully paired: `CLLocationManager.startUpdatingLocation()` and `CLLocationManager.stopUpdatingLocation()`.
Failing to do so can drain the battery in just a few hours.
-== Noncompliant Code Example
+== Non compliant Code Example
[source,swift]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC514/EC514.json b/src/main/rules/GCI514/GCI514.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC514/EC514.json
rename to src/main/rules/GCI514/GCI514.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC514/java/EC514.asciidoc b/src/main/rules/GCI514/java/GCI514.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC514/java/EC514.asciidoc
rename to src/main/rules/GCI514/java/GCI514.asciidoc
index 2f06dd287..80d7be74a 100644
--- a/ecocode-rules-specifications/src/main/rules/EC514/java/EC514.asciidoc
+++ b/src/main/rules/GCI514/java/GCI514.asciidoc
@@ -6,19 +6,21 @@ The common point of all these sensors is that they are expensive while in use. T
Consequently, calls must be carefully pairwised: `SensorManager#registerListener()/unregisterListener()`.
Failing to do so can drain the battery in just a few hours.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
SensorManager sManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
Sensor accelerometer = sManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
sManager.registerListener(this,accelerometer,SensorManager.SENSOR_DELAY_NORMAL);
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
SensorManager sManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
Sensor accelerometer = sManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
sManager.registerListener(this,accelerometer,SensorManager.SENSOR_DELAY_NORMAL);
sManager.unregisterListener(this);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC514/swift/EC514.asciidoc b/src/main/rules/GCI514/swift/GCI514.asciidoc
similarity index 97%
rename from ecocode-rules-specifications/src/main/rules/EC514/swift/EC514.asciidoc
rename to src/main/rules/GCI514/swift/GCI514.asciidoc
index 37eb6dcb4..676191a36 100644
--- a/ecocode-rules-specifications/src/main/rules/EC514/swift/EC514.asciidoc
+++ b/src/main/rules/GCI514/swift/GCI514.asciidoc
@@ -5,7 +5,7 @@ The common point of all these sensors is that they consume significant power whi
Consequently, calls to start and stop sensor updates must be carefully managed for motion sensor: CMMotionManager#startAccelerometerUpdates()/CMMotionManager#stopAccelerometerUpdates().
Failing to do so can drain the battery quickly.
-== Noncompliant Code Example
+== Non compliant Code Example
[source,swift]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC515/EC515.json b/src/main/rules/GCI515/GCI515.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC515/EC515.json
rename to src/main/rules/GCI515/GCI515.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC515/java/EC515.asciidoc b/src/main/rules/GCI515/java/GCI515.asciidoc
similarity index 82%
rename from ecocode-rules-specifications/src/main/rules/EC515/java/EC515.asciidoc
rename to src/main/rules/GCI515/java/GCI515.asciidoc
index 2053d051b..ba08b5394 100644
--- a/ecocode-rules-specifications/src/main/rules/EC515/java/EC515.asciidoc
+++ b/src/main/rules/GCI515/java/GCI515.asciidoc
@@ -2,15 +2,17 @@ Creation of a Media Recorder object with `new MediaRecorder()` is used to record
In addition to unnecessary resources (such as memory and instances of codecs) being held, failure to call this method immediately if a media object is no longer needed may also lead to continuous battery consumption for mobile devices.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
MediaRecorder mr = new MediaRecorder();
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
MediaRecorder mr = new MediaRecorder();
mr.release();
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC515/swift/EC515.asciidoc b/src/main/rules/GCI515/swift/GCI515.asciidoc
similarity index 98%
rename from ecocode-rules-specifications/src/main/rules/EC515/swift/EC515.asciidoc
rename to src/main/rules/GCI515/swift/GCI515.asciidoc
index 3770fdedd..c99ca1e68 100644
--- a/ecocode-rules-specifications/src/main/rules/EC515/swift/EC515.asciidoc
+++ b/src/main/rules/GCI515/swift/GCI515.asciidoc
@@ -3,7 +3,7 @@ Creation of an `AVAudioRecorder` object is used to record audio. These class has
In addition to unnecessary resources (such as memory and instances of codecs) being held, failure to properly stop and release these object if it is no longer needed may also lead to continuous battery consumption for mobile devices.
-== Noncompliant Code Example
+== Non compliant Code Example
[source,swift]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC516/EC516.json b/src/main/rules/GCI516/GCI516.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC516/EC516.json
rename to src/main/rules/GCI516/GCI516.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC516/java/EC516.asciidoc b/src/main/rules/GCI516/java/GCI516.asciidoc
similarity index 82%
rename from ecocode-rules-specifications/src/main/rules/EC516/java/EC516.asciidoc
rename to src/main/rules/GCI516/java/GCI516.asciidoc
index e59c5a2ed..c55e5be18 100644
--- a/ecocode-rules-specifications/src/main/rules/EC516/java/EC516.asciidoc
+++ b/src/main/rules/GCI516/java/GCI516.asciidoc
@@ -2,15 +2,17 @@ Creation of a Media Player object with `new MediaPlayer()` can be used to contro
In addition to unnecessary resources (such as memory and instances of codecs) being held, failure to call this method immediately if a media object is no longer needed may also lead to continuous battery consumption for mobile devices.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
MediaPlayer mp = new MediaPlayer();
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
MediaPlayer mp = new MediaPlayer();
mp.release();
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC517/EC517.json b/src/main/rules/GCI517/GCI517.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC517/EC517.json
rename to src/main/rules/GCI517/GCI517.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC517/java/EC517.asciidoc b/src/main/rules/GCI517/java/GCI517.asciidoc
similarity index 85%
rename from ecocode-rules-specifications/src/main/rules/EC517/java/EC517.asciidoc
rename to src/main/rules/GCI517/java/GCI517.asciidoc
index 03a404866..c2864776b 100644
--- a/ecocode-rules-specifications/src/main/rules/EC517/java/EC517.asciidoc
+++ b/src/main/rules/GCI517/java/GCI517.asciidoc
@@ -2,14 +2,16 @@ The fused location provider is one of the location APIs in Google Play services
Thus, developer has to set up Google Play Service in her gradle file with a dependency to `com.google.android.gms:play-services-location:x.y.z`, and then to import from `com.google.android.gms.location` instead of the `android.location` package of the SDK.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
import android.location.*;
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
import com.google.android.gms.location.*;
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC518/EC518.json b/src/main/rules/GCI518/GCI518.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC518/EC518.json
rename to src/main/rules/GCI518/GCI518.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC518/java/EC518.asciidoc b/src/main/rules/GCI518/java/GCI518.asciidoc
similarity index 82%
rename from ecocode-rules-specifications/src/main/rules/EC518/java/EC518.asciidoc
rename to src/main/rules/GCI518/java/GCI518.asciidoc
index 805dd1e46..b9529c227 100644
--- a/ecocode-rules-specifications/src/main/rules/EC518/java/EC518.asciidoc
+++ b/src/main/rules/GCI518/java/GCI518.asciidoc
@@ -2,14 +2,16 @@ In contrast to classic Bluetooth, Bluetooth Low Energy (BLE) is designed to prov
From the Android client side, it means append `android.bluetooth.le.\*` imports to `android.bluetooth.*` imports in order to benefits from low-energy features.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
import android.bluetooth.*
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
import android.bluetooth.le.*
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC519/EC519.json b/src/main/rules/GCI519/GCI519.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC519/EC519.json
rename to src/main/rules/GCI519/GCI519.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC519/java/EC519.asciidoc b/src/main/rules/GCI519/java/GCI519.asciidoc
similarity index 84%
rename from ecocode-rules-specifications/src/main/rules/EC519/java/EC519.asciidoc
rename to src/main/rules/GCI519/java/GCI519.asciidoc
index 1bdc27c6e..e85c11ed3 100644
--- a/ecocode-rules-specifications/src/main/rules/EC519/java/EC519.asciidoc
+++ b/src/main/rules/GCI519/java/GCI519.asciidoc
@@ -2,26 +2,30 @@ It's always good that an app has different behavior when device is connected/dis
One can monitor the changes in charging state with a broadcast receiver registered on the actions `ACTION_POWER_CONNECTED` and `ACTION_POWER_DISCONNECTED`, or monitor significant changes in battery level with a broadcast receiver registered on the actions `BATTERY_LOW` and `BATTERY_OKAY`.
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
new IntentFilter(Intent.ACTION_POWER_CONNECTED)
-```
+----
Or
-```java
+[source,java]
+----
new IntentFilter(Intent.ACTION_POWER_DISCONNECTED)
-```
+----
Or
-```java
+[source,java]
+----
new IntentFilter(Intent.ACTION_POWER_BATTERY_OKAY)
-```
+----
Or
-```java
+[source,java]
+----
new IntentFilter(Intent.ACTION_POWER_BATTERY_LOW)
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC519/swift/EC519.asciidoc b/src/main/rules/GCI519/swift/GCI519.asciidoc
similarity index 86%
rename from ecocode-rules-specifications/src/main/rules/EC519/swift/EC519.asciidoc
rename to src/main/rules/GCI519/swift/GCI519.asciidoc
index 906ee3872..e524cf257 100644
--- a/ecocode-rules-specifications/src/main/rules/EC519/swift/EC519.asciidoc
+++ b/src/main/rules/GCI519/swift/GCI519.asciidoc
@@ -2,26 +2,30 @@ It's always good that an app has different behavior when device is connected/dis
Your app can also register to receive notifications when the battery level or state changes, using `batteryLevelDidChangeNotification` and `batteryStateDidChangeNotification`.
-## Compliant Code Example
+== Compliant Code Example
-```swift
+[source,swift]
+----
let level = UIDevice.current.batteryLevel
-```
+----
or
-```swift
+[source,swift]
+----
let state = UIDevice.current.batteryState
-```
+----
or
-```swift
+[source,swift]
+----
NotificationCenter.default.addObserver(forName: UIDevice.batteryLevelDidChangeNotification, object: nil, queue: nil) { _ in }
-```
+----
or
-```swift
+[source,swift]
+----
NotificationCenter.default.addObserver(forName: UIDevice.batteryStateDidChangeNotification, object: nil, queue: nil) { _ in }
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC519/xml/EC519.asciidoc b/src/main/rules/GCI519/xml/GCI519.asciidoc
similarity index 67%
rename from ecocode-rules-specifications/src/main/rules/EC519/xml/EC519.asciidoc
rename to src/main/rules/GCI519/xml/GCI519.asciidoc
index 9d1ebf6cb..8c3a254bd 100644
--- a/ecocode-rules-specifications/src/main/rules/EC519/xml/EC519.asciidoc
+++ b/src/main/rules/GCI519/xml/GCI519.asciidoc
@@ -1,43 +1,47 @@
-Score ecoCode: 5sur5
+Score creedengo: 5sur5
It's always good that an app has different behavior when device is connected/disconnected to a power station, or has different battery levels. One can monitor the changes in charging state with a broadcast receiver registered on the actions `ACTION_POWER_CONNECTED` and `ACTION_POWER_DISCONNECTED`, or monitor significant changes in battery level with a broadcast receiver registered on the actions `BATTERY_LOW` and `BATTERY_OKAY`.
-## Compliant Code Example
+== Compliant Code Example
-```xml
-
+[source,xml]
+----
+
-```
+----
or
-```xml
-
+[source,xml]
+----
+
-```
+----
or
-```xml
-
+[source,xml]
+----
+
-```
+----
or
-```xml
-
+[source,xml]
+----
+
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC520/EC520.json b/src/main/rules/GCI520/GCI520.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC520/EC520.json
rename to src/main/rules/GCI520/GCI520.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC520/java/EC520.asciidoc b/src/main/rules/GCI520/java/GCI520.asciidoc
similarity index 80%
rename from ecocode-rules-specifications/src/main/rules/EC520/java/EC520.asciidoc
rename to src/main/rules/GCI520/java/GCI520.asciidoc
index d4e3c166c..d752363eb 100644
--- a/ecocode-rules-specifications/src/main/rules/EC520/java/EC520.asciidoc
+++ b/src/main/rules/GCI520/java/GCI520.asciidoc
@@ -2,26 +2,30 @@ Taking into account when the device is entering or exiting the power save mode i
It implies the existence of a broadcast receiver registered on the action `ACTION_POWER_SAVE_MODE_CHANGED`, or programmaticaly with a call to `PowerManager#isPowerSaveMode().`
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
new IntentFilter(Intent.ACTION_POWER_SAVE_MODE_CHANGED)
-```
+----
Or
-```java
+[source,java]
+----
intentFilter.addAction(ACTION_POWER_SAVE_MODE_CHANGED)
-```
+----
Or
-```java
+[source,java]
+----
IntentFilter.create(ACTION_POWER_SAVE_MODE_CHANGED,"")
-```
+----
Or
-```java
+[source,java]
+----
powerManager.isPowerSaveMode()
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC520/swift/EC520.asciidoc b/src/main/rules/GCI520/swift/GCI520.asciidoc
similarity index 88%
rename from ecocode-rules-specifications/src/main/rules/EC520/swift/EC520.asciidoc
rename to src/main/rules/GCI520/swift/GCI520.asciidoc
index ba002a0e1..b37390306 100644
--- a/ecocode-rules-specifications/src/main/rules/EC520/swift/EC520.asciidoc
+++ b/src/main/rules/GCI520/swift/GCI520.asciidoc
@@ -4,20 +4,23 @@ For example, you can reduce frequency of data update if low power mode is enable
Your app can query the `ProcessInfo.processInfo.isLowPowerModeEnabled` property at any time to determine whether Low Power Mode is active. Your app can also register to receive notifications when the Low Power Mode state of a device changes, using `NSProcessInfoPowerStateDidChange`.
-## Compliant Code Example
+== Compliant Code Example
-```swift
+[source,swift]
+----
let isLowPowerModeEnabled = ProcessInfo.processInfo.isLowPowerModeEnabled
-```
+----
or
-```swift
+[source,swift]
+----
NotificationCenter.default.addObserver(forName: .NSProcessInfoPowerStateDidChange, object: nil, queue: nil) { _ in }
-```
+----
or
-```swift
+[source,swift]
+----
NotificationCenter.default.addObserver(forName: Notification.Name.NSProcessInfoPowerStateDidChange, object: nil, queue: nil) { _ in }
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC520/xml/EC520.asciidoc b/src/main/rules/GCI520/xml/GCI520.asciidoc
similarity index 73%
rename from ecocode-rules-specifications/src/main/rules/EC520/xml/EC520.asciidoc
rename to src/main/rules/GCI520/xml/GCI520.asciidoc
index a342353a4..71df4aa4c 100644
--- a/ecocode-rules-specifications/src/main/rules/EC520/xml/EC520.asciidoc
+++ b/src/main/rules/GCI520/xml/GCI520.asciidoc
@@ -1,15 +1,16 @@
-Score ecoCode: 5sur5
+Score creedengo: 5sur5
Taking into account when the device is entering or exiting the power save mode is higly desirable for the battery life.
It implies the existence of a broadcast receiver registered on the action `ACTION_POWER_SAVE_MODE_CHANGED`, or programmatically with a call to `PowerManager#isPowerSaveMode().`
-## Compliant Code Example
+== Compliant Code Example
-```xml
-
+[source,xml]
+----
+
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC521/EC521.json b/src/main/rules/GCI521/GCI521.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC521/EC521.json
rename to src/main/rules/GCI521/GCI521.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC521/java/EC521.asciidoc b/src/main/rules/GCI521/java/GCI521.asciidoc
similarity index 88%
rename from ecocode-rules-specifications/src/main/rules/EC521/java/EC521.asciidoc
rename to src/main/rules/GCI521/java/GCI521.asciidoc
index 4d370f0a4..5d8f67dbd 100644
--- a/ecocode-rules-specifications/src/main/rules/EC521/java/EC521.asciidoc
+++ b/src/main/rules/GCI521/java/GCI521.asciidoc
@@ -1,15 +1,17 @@
The rotation vector sensor is the most frequently used sensor for motion detection and monitoring. When using `SensorManager#getDefaultSensor(int type)`, always prefer the constant `TYPE_GEOMAGNETIC_ROTATION_VECTOR` which is similar to `TYPE_ROTATION_VECTOR`, but using a magnetometer instead of using a gyroscope. This sensor uses lower power than the other rotation vectors, because it doesn't use the gyroscope. However, it is more noisy and will work best outdoors.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
SensorManager sManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
sManager.getDefaultSensor(Sensor.TYPE_ROTATION_VECTOR);
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
SensorManager sManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
sManager.getDefaultSensor(Sensor.TYPE_GEOMAGNETIC_ROTATION_VECTOR);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC522/EC522.json b/src/main/rules/GCI522/GCI522.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC522/EC522.json
rename to src/main/rules/GCI522/GCI522.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC522/java/EC522.asciidoc b/src/main/rules/GCI522/java/GCI522.asciidoc
similarity index 90%
rename from ecocode-rules-specifications/src/main/rules/EC522/java/EC522.asciidoc
rename to src/main/rules/GCI522/java/GCI522.asciidoc
index a7286af84..eadc760ca 100644
--- a/ecocode-rules-specifications/src/main/rules/EC522/java/EC522.asciidoc
+++ b/src/main/rules/GCI522/java/GCI522.asciidoc
@@ -4,8 +4,9 @@ For some reasons, developers may disable this feature programmatically, setting
This feature was introduced to improve battery life, be careful when deactivating it.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
getWindow().getAttributes().screenBrightness = BRIGHTNESS_OVERRIDE_FULL;
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC522/java/EC522.json b/src/main/rules/GCI522/java/GCI522.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC522/java/EC522.json
rename to src/main/rules/GCI522/java/GCI522.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC522/javascript/EC522.asciidoc b/src/main/rules/GCI522/javascript/GCI522.asciidoc
similarity index 99%
rename from ecocode-rules-specifications/src/main/rules/EC522/javascript/EC522.asciidoc
rename to src/main/rules/GCI522/javascript/GCI522.asciidoc
index 94e8c6f5e..629d6cda7 100644
--- a/ecocode-rules-specifications/src/main/rules/EC522/javascript/EC522.asciidoc
+++ b/src/main/rules/GCI522/javascript/GCI522.asciidoc
@@ -12,7 +12,7 @@ Hence, keeping forcing the screen brightness on should be avoided, unless it is
== Example of non compliant code
-```js
+----js
// Example with expo-brightness (Expo framework library)
import React, { useEffect } from 'react';
import { View, Text } from 'react-native';
diff --git a/ecocode-rules-specifications/src/main/rules/EC522/javascript/EC522.json b/src/main/rules/GCI522/javascript/GCI522.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC522/javascript/EC522.json
rename to src/main/rules/GCI522/javascript/GCI522.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC522/swift/EC522.asciidoc b/src/main/rules/GCI522/swift/GCI522.asciidoc
similarity index 85%
rename from ecocode-rules-specifications/src/main/rules/EC522/swift/EC522.asciidoc
rename to src/main/rules/GCI522/swift/GCI522.asciidoc
index 16cee2bbc..91422195d 100644
--- a/ecocode-rules-specifications/src/main/rules/EC522/swift/EC522.asciidoc
+++ b/src/main/rules/GCI522/swift/GCI522.asciidoc
@@ -2,9 +2,10 @@ To avoid draining the battery, an iOS device adapt its brightness to the environ
Hence, keeping forcing the screen brightness on should be avoided, unless it is absolutely necessary. If so, developers typically force the Brightness to 1 with `UIScreen.main.brightness = a float`.
-## Noncompliant Code Example
+== Non compliant Code Example
-```swift
+[source,swift]
+----
UIScreen.main.brightness = CGFloat(0.3)
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC522/swift/EC522.json b/src/main/rules/GCI522/swift/GCI522.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC522/swift/EC522.json
rename to src/main/rules/GCI522/swift/GCI522.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC523/EC523.json b/src/main/rules/GCI523/GCI523.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC523/EC523.json
rename to src/main/rules/GCI523/GCI523.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC527/java/EC527.asciidoc b/src/main/rules/GCI523/java/GCI523.asciidoc
similarity index 87%
rename from ecocode-rules-specifications/src/main/rules/EC527/java/EC527.asciidoc
rename to src/main/rules/GCI523/java/GCI523.asciidoc
index 2fb54ab84..de19e643b 100644
--- a/ecocode-rules-specifications/src/main/rules/EC527/java/EC527.asciidoc
+++ b/src/main/rules/GCI523/java/GCI523.asciidoc
@@ -2,20 +2,22 @@ With a call to `LocationManager#requestLocationUpdates(String provider, long min
These two must imperatively be greater than 0.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
0,
0,
this);
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
60000L, // refresh location at least each 60000ms
10.0f, // refresh location at least each 10 meters
this);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC523/java/EC523.json b/src/main/rules/GCI523/java/GCI523.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC523/java/EC523.json
rename to src/main/rules/GCI523/java/GCI523.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC523/javascript/EC523.asciidoc b/src/main/rules/GCI523/javascript/GCI523.asciidoc
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC523/javascript/EC523.asciidoc
rename to src/main/rules/GCI523/javascript/GCI523.asciidoc
diff --git a/ecocode-rules-specifications/src/main/rules/EC523/javascript/EC523.json b/src/main/rules/GCI523/javascript/GCI523.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC523/javascript/EC523.json
rename to src/main/rules/GCI523/javascript/GCI523.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC524/EC524.json b/src/main/rules/GCI524/GCI524.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC524/EC524.json
rename to src/main/rules/GCI524/GCI524.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC524/java/EC524.asciidoc b/src/main/rules/GCI524/java/GCI524.asciidoc
similarity index 85%
rename from ecocode-rules-specifications/src/main/rules/EC524/java/EC524.asciidoc
rename to src/main/rules/GCI524/java/GCI524.asciidoc
index 356629524..1cff90f3c 100644
--- a/ecocode-rules-specifications/src/main/rules/EC524/java/EC524.asciidoc
+++ b/src/main/rules/GCI524/java/GCI524.asciidoc
@@ -2,22 +2,24 @@ Location awareness is one of the most popular features used by apps.
An important point is to try to get the best possible provider (`LocationManager#getBestProvider()`) based on an energy criteria thanks to `Criteria#setPowerRequirement(int level)`, using constant `POWER_LOW` instead of `POWER_HIGH` or `POWER_MEDIUM`.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
1000L,
1.0f,
this);
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
Criteria criteria = new Criteria();
criteria.setPowerRequirement(Criteria.POWER_LOW);
locationManager.requestLocationUpdates(locationManager.getBestProvider(criteria,true),
1000L,
1.0f,
this);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC524/swift/EC524.asciidoc b/src/main/rules/GCI524/swift/GCI524.asciidoc
similarity index 94%
rename from ecocode-rules-specifications/src/main/rules/EC524/swift/EC524.asciidoc
rename to src/main/rules/GCI524/swift/GCI524.asciidoc
index 75a998f71..6d754862a 100644
--- a/ecocode-rules-specifications/src/main/rules/EC524/swift/EC524.asciidoc
+++ b/src/main/rules/GCI524/swift/GCI524.asciidoc
@@ -6,10 +6,11 @@ Requesting higher accuracy than you need causes the system to power up additiona
Also, setting the `CLLocationManager#activityType` property will let the system knows what type of location activity your app is performing and helps it determine the most appropriate time to perform location updates. Finally, if your app just needs a quick fix on the user’s location, it’s best to call the `CLLocationManager#requestLocation` method, that will deliver a single location update.
-## Compliant Code Example
+== Compliant Code Example
-```swift
+[source,swift]
+----
let manager = CLLocationManager()
manager.desiredAccuracy = 2
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC525/EC525.json b/src/main/rules/GCI525/GCI525.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC525/EC525.json
rename to src/main/rules/GCI525/GCI525.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC525/java/EC525.asciidoc b/src/main/rules/GCI525/java/GCI525.asciidoc
similarity index 87%
rename from ecocode-rules-specifications/src/main/rules/EC525/java/EC525.asciidoc
rename to src/main/rules/GCI525/java/GCI525.asciidoc
index a1e2af352..44fd03f3f 100644
--- a/ecocode-rules-specifications/src/main/rules/EC525/java/EC525.asciidoc
+++ b/src/main/rules/GCI525/java/GCI525.asciidoc
@@ -2,16 +2,18 @@ With Bluetooth Low Energy technology, a Bluetooth Smart Ready device (the master
The default and preferred advertising mode is `ADVERTISE_MODE_LOW_POWER` when calling `AdvertiseSettings.Builder#setAdvertiseMode(int advertiseMode).`
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
AdvertiseSettings.Builder builder = new AdvertiseSettings.Builder();
builder.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_LATENCY);
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
AdvertiseSettings.Builder builder = new AdvertiseSettings.Builder();
builder.setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_LOW_POWER);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC526/EC526.json b/src/main/rules/GCI526/GCI526.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC526/EC526.json
rename to src/main/rules/GCI526/GCI526.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC526/java/EC526.asciidoc b/src/main/rules/GCI526/java/GCI526.asciidoc
similarity index 86%
rename from ecocode-rules-specifications/src/main/rules/EC526/java/EC526.asciidoc
rename to src/main/rules/GCI526/java/GCI526.asciidoc
index 36b25cef1..06ac09e25 100644
--- a/ecocode-rules-specifications/src/main/rules/EC526/java/EC526.asciidoc
+++ b/src/main/rules/GCI526/java/GCI526.asciidoc
@@ -4,16 +4,18 @@ Most often, the slave is a GATT server and the master is a GATT client. GATT cap
Invoking `BluetoothGatt#requestConnectionPriority(int connectionPriority)` with the value `CONNECTION_PRIORITY_LOW_POWER`, is recommended to reduce power consumption.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
BluetoothGatt gatt = new BluetoothGatt();
gatt.requestConnectionPriority(CONNECTION_PRIORITY_HIGH);
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
BluetoothGatt gatt = new BluetoothGatt();
gatt.requestConnectionPriority(CONNECTION_PRIORITY_LOW_POWER);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC527/EC527.json b/src/main/rules/GCI527/GCI527.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC527/EC527.json
rename to src/main/rules/GCI527/GCI527.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC523/java/EC523.asciidoc b/src/main/rules/GCI527/java/GCI527.asciidoc
similarity index 87%
rename from ecocode-rules-specifications/src/main/rules/EC523/java/EC523.asciidoc
rename to src/main/rules/GCI527/java/GCI527.asciidoc
index 2fb54ab84..de19e643b 100644
--- a/ecocode-rules-specifications/src/main/rules/EC523/java/EC523.asciidoc
+++ b/src/main/rules/GCI527/java/GCI527.asciidoc
@@ -2,20 +2,22 @@ With a call to `LocationManager#requestLocationUpdates(String provider, long min
These two must imperatively be greater than 0.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
0,
0,
this);
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,
60000L, // refresh location at least each 60000ms
10.0f, // refresh location at least each 10 meters
this);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC528/EC528.json b/src/main/rules/GCI528/GCI528.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC528/EC528.json
rename to src/main/rules/GCI528/GCI528.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC528/java/EC528.asciidoc b/src/main/rules/GCI528/java/GCI528.asciidoc
similarity index 90%
rename from ecocode-rules-specifications/src/main/rules/EC528/java/EC528.asciidoc
rename to src/main/rules/GCI528/java/GCI528.asciidoc
index 5698168e1..df93afbdb 100644
--- a/ecocode-rules-specifications/src/main/rules/EC528/java/EC528.asciidoc
+++ b/src/main/rules/GCI528/java/GCI528.asciidoc
@@ -2,16 +2,18 @@ Shaking of an Android device is possible in all circumstances with a call to `ge
Behind this effect stands a specific miniature hardware component, motor or actuator, that consumes power.
As a consequence, its usage must be discouraged, especially since its added value is not clear.
-## Noncompliant Code Example
+== Non compliant Code Example
API 26:
-```java
+[source,java]
+----
Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
v.vibrate(400);
-```
+----
API 31:
-```java
+[source,java]
+----
VibratorManager vm = (VibratorManager) getSystemService(Context.VIBRATOR_MANAGER_SERVICE);
vm.getDefaultVibrator().vibrate(VibrationEffect.createOneShot(500, VibrationEffect.DEFAULT_AMPLITUDE));
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC529/EC529.json b/src/main/rules/GCI529/GCI529.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC529/EC529.json
rename to src/main/rules/GCI529/GCI529.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC529/java/EC529.asciidoc b/src/main/rules/GCI529/java/GCI529.asciidoc
similarity index 93%
rename from ecocode-rules-specifications/src/main/rules/EC529/java/EC529.asciidoc
rename to src/main/rules/GCI529/java/GCI529.asciidoc
index 9dcff316a..9d64cd7bf 100644
--- a/ecocode-rules-specifications/src/main/rules/EC529/java/EC529.asciidoc
+++ b/src/main/rules/GCI529/java/GCI529.asciidoc
@@ -2,22 +2,24 @@ Giving information to the end-user through notifications is an important aspect
However, a notification does not necessarily need to be loud and vibrant to achieve its purpose. Default mode is enough. That is why when building a notification with `NotificationManager` there should be no extra calls to the methods `setSound()` nor `setVibrate()` (API26) nor `setVibrationPattern()` (API31) on the builder object.
-## Noncompliant Code Example
+== Non compliant Code Example
API 26:
-```java
+[source,java]
+----
Notification.Builder notificationBuilder = new Notification.Builder(getApplicationContext(), "42");
notificationBuilder.setVibrate(new long[] {1000, 1000, 1000, 1000, 1000});
notificationBuilder.setSound(
RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION),
Notification.AUDIO_ATTRIBUTES_DEFAULT
);
-```
+----
API 31:
-```java
+[source,java]
+----
NotificationChannel notification = new NotificationChannel("42",
"test",
NotificationManager.IMPORTANCE_DEFAULT
@@ -27,4 +29,4 @@ notification.setSound(
RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION),
Notification.AUDIO_ATTRIBUTES_DEFAULT
);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC530/EC530.json b/src/main/rules/GCI530/GCI530.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC530/EC530.json
rename to src/main/rules/GCI530/GCI530.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC530/java/EC530.asciidoc b/src/main/rules/GCI530/java/GCI530.asciidoc
similarity index 89%
rename from ecocode-rules-specifications/src/main/rules/EC530/java/EC530.asciidoc
rename to src/main/rules/GCI530/java/GCI530.asciidoc
index 9357810a6..55b701d0c 100644
--- a/ecocode-rules-specifications/src/main/rules/EC530/java/EC530.asciidoc
+++ b/src/main/rules/GCI530/java/GCI530.asciidoc
@@ -1,8 +1,9 @@
Turning on the torch mode programmatically with `CameraManager#setTorchMode(..., true)` must absolutely be avoided because the flashlight is one of the most energy-intensive component.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
CameraManager camManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
String cameraId = null;
try {
@@ -11,4 +12,4 @@ try {
} catch (CameraAccessException e) {
e.printStackTrace();
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC530/java/EC530.json b/src/main/rules/GCI530/java/GCI530.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC530/java/EC530.json
rename to src/main/rules/GCI530/java/GCI530.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC530/javascript/EC530.asciidoc b/src/main/rules/GCI530/javascript/GCI530.asciidoc
similarity index 94%
rename from ecocode-rules-specifications/src/main/rules/EC530/javascript/EC530.asciidoc
rename to src/main/rules/GCI530/javascript/GCI530.asciidoc
index 830784d73..1e80152aa 100644
--- a/ecocode-rules-specifications/src/main/rules/EC530/javascript/EC530.asciidoc
+++ b/src/main/rules/GCI530/javascript/GCI530.asciidoc
@@ -2,7 +2,7 @@
Turning on the torch mode programmatically with `react-native-torch` must absolutely be avoided because the flashlight is one of the most energy-intensive component.
-## Non compliant Code Example
+== Non compliant Code Example
[source,js,data-diff-id="2",data-diff-type="noncompliant"]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC530/javascript/EC530.json b/src/main/rules/GCI530/javascript/GCI530.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC530/javascript/EC530.json
rename to src/main/rules/GCI530/javascript/GCI530.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC530/swift/EC530.asciidoc b/src/main/rules/GCI530/swift/GCI530.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC530/swift/EC530.asciidoc
rename to src/main/rules/GCI530/swift/GCI530.asciidoc
index 0cc3c0778..559e85bce 100644
--- a/ecocode-rules-specifications/src/main/rules/EC530/swift/EC530.asciidoc
+++ b/src/main/rules/GCI530/swift/GCI530.asciidoc
@@ -1,9 +1,10 @@
Turning on the torch mode programmatically using `AVCaptureDevice#torchMode` or `AVCaptureDevice#setTorchModeOn(level:)`
methods must absolutely be avoided because the flashlight is one of the most energy-intensive component.
-## Non-Compliant Code Example
+== Non compliant Code Example
-```swift
+[source,swift]
+----
guard let videoDevice = AVCaptureDevice.default(.builtInWideAngleCamera, for: .video, position: .back) else { return }
guard videoDevice.hasTorch else { return }
@@ -11,4 +12,4 @@ videoDevice.lockForConfiguration()
videoDevice.torchMode = .on // non-compliant
videoDevice.setTorchModeOn(level: 1.0) // non-compliant
videoDevice.unlockForConfiguration()
-```
\ No newline at end of file
+----
\ No newline at end of file
diff --git a/ecocode-rules-specifications/src/main/rules/EC530/swift/EC530.json b/src/main/rules/GCI530/swift/GCI530.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC530/swift/EC530.json
rename to src/main/rules/GCI530/swift/GCI530.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC531/EC531.json b/src/main/rules/GCI531/GCI531.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC531/EC531.json
rename to src/main/rules/GCI531/GCI531.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC531/java/EC531.asciidoc b/src/main/rules/GCI531/java/GCI531.asciidoc
similarity index 83%
rename from ecocode-rules-specifications/src/main/rules/EC531/java/EC531.asciidoc
rename to src/main/rules/GCI531/java/GCI531.asciidoc
index a12e6a75f..df2d3beb5 100644
--- a/ecocode-rules-specifications/src/main/rules/EC531/java/EC531.asciidoc
+++ b/src/main/rules/GCI531/java/GCI531.asciidoc
@@ -1,13 +1,15 @@
In Android 11 (API level 30) or higher, a call to `Surface#setFrameRate(float frameRate, int compatibility)` results in a change to the display refresh rate. However, a regular app displays 60 frames per second (60Hz). In order to optimize content refreshes and hence saving energy, this frequency should not be raised to 90Hz or 120Hz, despite this is now supported by many devices.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
surface.setFrameRate(120f, FRAME_RATE_COMPATIBILITY_DEFAULT);
-```
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
+[source,java]
+----
surface.setFrameRate(60f, FRAME_RATE_COMPATIBILITY_DEFAULT);
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC532/EC532.json b/src/main/rules/GCI532/GCI532.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC532/EC532.json
rename to src/main/rules/GCI532/GCI532.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC532/java/EC532.asciidoc b/src/main/rules/GCI532/java/GCI532.asciidoc
similarity index 85%
rename from ecocode-rules-specifications/src/main/rules/EC532/java/EC532.asciidoc
rename to src/main/rules/GCI532/java/GCI532.asciidoc
index 8cec4d695..f8234022d 100644
--- a/ecocode-rules-specifications/src/main/rules/EC532/java/EC532.asciidoc
+++ b/src/main/rules/GCI532/java/GCI532.asciidoc
@@ -1,15 +1,17 @@
Importing the `com.google.android.gms.analytics.Tracker` or `com.google.firebase.analytics.FirebaseAnalytics` classes means that the app sends hits to Google Analytics. It is not necessarily sensitive information, but it is a first step towards Google Ads and hence this practice should be discouraged at early stage.
-## Noncompliant Code Example
+== Non compliant Code Example
Import of Google Analytics :
-```java
+[source,java]
+----
import com.google.android.gms.analytics.Tracker
-```
+----
Import of Firebase Analytics :
-```java
+[source,java]
+----
import com.google.firebase.analytics
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC533/EC533.json b/src/main/rules/GCI533/GCI533.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC533/EC533.json
rename to src/main/rules/GCI533/GCI533.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC533/swift/EC533.asciidoc b/src/main/rules/GCI533/swift/GCI533.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC533/swift/EC533.asciidoc
rename to src/main/rules/GCI533/swift/GCI533.asciidoc
index fd19cdcfe..7942a874d 100644
--- a/ecocode-rules-specifications/src/main/rules/EC533/swift/EC533.asciidoc
+++ b/src/main/rules/GCI533/swift/GCI533.asciidoc
@@ -1,9 +1,10 @@
Allowing the system to pause location updates, at times when the location data is unlikely to change, can improve battery life without sacrificing location data. This is the default behavior. For example, if the user stops for food while using a navigation app, the location manager might pause updates for a period of time. It is possible to disable this behavior, by setting the `CLLocationManager#pausesLocationUpdatesAutomatically` property to `false`, but applications are strongly discouraged of doing it.
-## Noncompliant Code Example
+== Non compliant Code Example
-```swift
+[source,swift]
+----
let manager = CLLocationManager()
manager.pausesLocationUpdatesAutomatically = false
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC534/EC534.json b/src/main/rules/GCI534/GCI534.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC534/EC534.json
rename to src/main/rules/GCI534/GCI534.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC534/swift/EC534.asciidoc b/src/main/rules/GCI534/swift/GCI534.asciidoc
similarity index 95%
rename from ecocode-rules-specifications/src/main/rules/EC534/swift/EC534.asciidoc
rename to src/main/rules/GCI534/swift/GCI534.asciidoc
index 06310b54c..283e100a8 100644
--- a/ecocode-rules-specifications/src/main/rules/EC534/swift/EC534.asciidoc
+++ b/src/main/rules/GCI534/swift/GCI534.asciidoc
@@ -1,10 +1,11 @@
Using the Core Motion API, your app can receive continuous motion updates in the form of accelerometer, gyroscope, and device motion (rotation, acceleration, and more) events. Yet you don't often need these updates as soon as they are generated. Before registering to receive these recurring motion updates, you can specify an interval that meets your app’s needs, using `CMMotionManager#accelerometerUpdateInterval`, `CMMotionManager#gyroUpdateInterval`, `CMMotionManager#deviceMotionUpdateInterval` and `CMMotionManager#magnetometerUpdateInterval` properties. The larger the interval, the fewer events are delivered to your app, improving battery life.
-## Compliant Code
+== Compliant Code
-```swift
+[source,swift]
+----
CMMotionManager.accelerometerUpdateInterval = 1000
CMMotionManager.gyroUpdateInterval = 1000
CMMotionManager.deviceMotionUpdateInterval = 1000
CMMotionManager.magnetometerUpdateInterval = 1000
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC540/EC540.json b/src/main/rules/GCI540/GCI540.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC540/EC540.json
rename to src/main/rules/GCI540/GCI540.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC540/xml/EC540.asciidoc b/src/main/rules/GCI540/xml/GCI540.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC540/xml/EC540.asciidoc
rename to src/main/rules/GCI540/xml/GCI540.asciidoc
index 722d5d683..77de0a9ab 100644
--- a/ecocode-rules-specifications/src/main/rules/EC540/xml/EC540.asciidoc
+++ b/src/main/rules/GCI540/xml/GCI540.asciidoc
@@ -1,4 +1,4 @@
-Score ecoCode: 2sur5
+Score creedengo: 2sur5
Services are long-living operations, as components of the apps. However, they can be started in isolation each time the device is next started, without the user's acknowledgement.
@@ -8,12 +8,13 @@ In addition, end-users know how to kill applications, but more rarely how to kil
Thus, any developer should avoid having a call to `Context#startService()` from a Broadcast Receiver component that has specified an intent-filter for the `BOOT_COMPLETED` action in the manifest.
-## Noncompliant Code Example
+== Non compliant Code Example
-```xml
+[source,xml]
+----
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC543/EC543.json b/src/main/rules/GCI543/GCI543.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC543/EC543.json
rename to src/main/rules/GCI543/GCI543.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC543/xml/EC543.asciidoc b/src/main/rules/GCI543/xml/GCI543.asciidoc
similarity index 84%
rename from ecocode-rules-specifications/src/main/rules/EC543/xml/EC543.asciidoc
rename to src/main/rules/GCI543/xml/GCI543.asciidoc
index 5eec80ead..953530926 100644
--- a/ecocode-rules-specifications/src/main/rules/EC543/xml/EC543.asciidoc
+++ b/src/main/rules/GCI543/xml/GCI543.asciidoc
@@ -1,11 +1,12 @@
-Score ecoCode: 2sur5
+Score creedengo: 2sur5
A negative effect on the device s battery is when an app is paired with a companion device (over Bluetooth, BLE, or Wi-Fi) and that it has been excluded from battery optimizations (run in the background) using the declaration `Manifest.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND`.
-## Noncompliant Code Example
+== Non compliant Code Example
-```xml
+[source,xml]
+----
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC544/EC544.json b/src/main/rules/GCI544/GCI544.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC544/EC544.json
rename to src/main/rules/GCI544/GCI544.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC544/xml/EC544.asciidoc b/src/main/rules/GCI544/xml/GCI544.asciidoc
similarity index 85%
rename from ecocode-rules-specifications/src/main/rules/EC544/xml/EC544.asciidoc
rename to src/main/rules/GCI544/xml/GCI544.asciidoc
index 3abdafaf2..1be56c9a3 100644
--- a/ecocode-rules-specifications/src/main/rules/EC544/xml/EC544.asciidoc
+++ b/src/main/rules/GCI544/xml/GCI544.asciidoc
@@ -1,13 +1,14 @@
-Score ecoCode: 2sur5
+Score creedengo: 2sur5
An app holding the permission `REQUEST_IGNORE_BATTERY_OPTIMIZATIONS` asks the user to allow it to ignore battery optimizations (that is, put them on the whitelist of apps).
Most applications should not use this; there are many facilities provided by the platform for applications to operate correctly in the various power saving modes.
-## Noncompliant Code Example
+== Non compliant Code Example
-```xml
+[source,xml]
+----
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC547/EC547.json b/src/main/rules/GCI547/GCI547.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC547/EC547.json
rename to src/main/rules/GCI547/GCI547.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC547/xml/EC547.asciidoc b/src/main/rules/GCI547/xml/GCI547.asciidoc
similarity index 83%
rename from ecocode-rules-specifications/src/main/rules/EC547/xml/EC547.asciidoc
rename to src/main/rules/GCI547/xml/GCI547.asciidoc
index 4b8bcc02e..6ec7831d0 100644
--- a/ecocode-rules-specifications/src/main/rules/EC547/xml/EC547.asciidoc
+++ b/src/main/rules/GCI547/xml/GCI547.asciidoc
@@ -1,16 +1,17 @@
-Score ecoCode: 2sur5
+Score creedengo: 2sur5
Displaying dark colors is particularly beneficial for mobile devices with (AM)OLED screens.
Consequently, custom resources like bright colors values and bitmap images with too high luminance should be avoided.
-## Noncompliant Code Example
+== Non compliant Code Example
-```xml
+[source,xml]
+----
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC548/EC548.json b/src/main/rules/GCI548/GCI548.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC548/EC548.json
rename to src/main/rules/GCI548/GCI548.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC548/xml/EC548.asciidoc b/src/main/rules/GCI548/xml/GCI548.asciidoc
similarity index 82%
rename from ecocode-rules-specifications/src/main/rules/EC548/xml/EC548.asciidoc
rename to src/main/rules/GCI548/xml/GCI548.asciidoc
index 5ea8017df..4dcb0ecc0 100644
--- a/ecocode-rules-specifications/src/main/rules/EC548/xml/EC548.asciidoc
+++ b/src/main/rules/GCI548/xml/GCI548.asciidoc
@@ -1,29 +1,33 @@
-Score ecoCode: 2sur5
+Score creedengo: 2sur5
Developers are allowed to apply native themes for their app, or derive new ones through inheritance. This decision has a significant impact on energy consumption since displaying dark colors is particularly beneficial for mobile devices with (AM)OLED screens.
By default, Android will set Holo to the Dark theme (parent style `Theme.Holo`) and hence switching to the light theme (parent style `Theme.Holo.Light`) within the manifest or in xml themes should be avoided.
-## Noncompliant Code Example
+== Non compliant Code Example
-```xml
+[source,xml]
+----
-```
+----
or
-```xml
+[source,xml]
+----
-```
+----
-## Compliant Solution
+== Compliant Solution
-```xml
+[source,xml]
+----
-```
+----
or
-```xml
+[source,xml]
+----
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC602/EC602.json b/src/main/rules/GCI602/GCI602.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC602/EC602.json
rename to src/main/rules/GCI602/GCI602.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC603/EC603.json b/src/main/rules/GCI603/GCI603.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC603/EC603.json
rename to src/main/rules/GCI603/GCI603.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC603/swift/EC603.asciidoc b/src/main/rules/GCI603/swift/GCI603.asciidoc
similarity index 90%
rename from ecocode-rules-specifications/src/main/rules/EC603/swift/EC603.asciidoc
rename to src/main/rules/GCI603/swift/GCI603.asciidoc
index 216df5c4b..7cf8ee01a 100644
--- a/ecocode-rules-specifications/src/main/rules/EC603/swift/EC603.asciidoc
+++ b/src/main/rules/GCI603/swift/GCI603.asciidoc
@@ -2,9 +2,10 @@ Animations play a crucial role in creating a dynamic and engaging user interface
To ensure animations are used effectively without draining the device's battery, it's important to check for unnecessary animations and optimize them. This can be done by reviewing the use of functions like `withAnimation(::)`, the `animation(_:value:)` view modifier, and the binding’s `animation(_:)` method in SwiftUI, as well as checking the use of UIKit's animation methods.
-## Noncompliant Code Example UIKit
+== Non compliant Code Example UIKit
-```swift
+[source,swift]
+----
UIView.animate(withDuration:animations:)
UIView.animate(withDuration:animations:completion:)
UIView.animate(withDuration:delay:options:animations:completion:)
@@ -13,11 +14,12 @@ UIView.transition(with:duration:options:animations:completion:)
CABasicAnimation
CAKeyframeAnimation
CATransition
-```
+----
-## Noncompliant Code Example SwiftUI
+== Non compliant Code Example SwiftUI
-```swift
+[source,swift]
+----
withAnimation
Animation
AnyTransition
@@ -25,4 +27,4 @@ AnyTransition
.transition(AnyTransition)
.onAppear(perform:)
.onDisappear(perform:)
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC66/EC66.json b/src/main/rules/GCI66/GCI66.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC66/EC66.json
rename to src/main/rules/GCI66/GCI66.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC66/php/1GB.etsdiff.csv b/src/main/rules/GCI66/php/1GB.etsdiff.csv
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC66/php/1GB.etsdiff.csv
rename to src/main/rules/GCI66/php/1GB.etsdiff.csv
diff --git a/ecocode-rules-specifications/src/main/rules/EC66/php/EC66.asciidoc b/src/main/rules/GCI66/php/GCI66.asciidoc
similarity index 86%
rename from ecocode-rules-specifications/src/main/rules/EC66/php/EC66.asciidoc
rename to src/main/rules/GCI66/php/GCI66.asciidoc
index 8af551481..07c9d6793 100644
--- a/ecocode-rules-specifications/src/main/rules/EC66/php/EC66.asciidoc
+++ b/src/main/rules/GCI66/php/GCI66.asciidoc
@@ -1,24 +1,26 @@
PHP allows declaring a string with simple or double quotes. Using double quotes allows developers to insert variables which will be substituted during execution. When the string has no variables, using single quotes prevents PHP from searching for non-existent variables. It will save CPU cycles consumption and RAM usage.
-## Noncompliant Code Example
+== Non compliant Code Example
-```php
+[source,php]
+----
myFunction("name", "age", "IsStudent");
$lastName = "Hugo";
$concatenatedString = "$lastName is a student";
-```
+----
-## Compliant Solution
+== Compliant Solution
-```php
+[source,php]
+----
myFunction('name', 'age', 'IsStudent');
$lastName = 'Hugo';
$concatenatedString = $lastName . 'is a student';
-```
+----
include::../../etsdiff-methodology.asciidoc[]
-## Case for a 1GB database:
+== Case for a 1GB database:
image::https://live.staticflickr.com/65535/52621866212_de15608a41_o.png[ETSdiff percent comparison]
diff --git a/ecocode-rules-specifications/src/main/rules/EC67/EC67.json b/src/main/rules/GCI67/GCI67.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC67/EC67.json
rename to src/main/rules/GCI67/GCI67.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC67/java/EC67.asciidoc b/src/main/rules/GCI67/java/GCI67.asciidoc
similarity index 54%
rename from ecocode-rules-specifications/src/main/rules/EC67/java/EC67.asciidoc
rename to src/main/rules/GCI67/java/GCI67.asciidoc
index a0c7b961a..6c86cced2 100644
--- a/ecocode-rules-specifications/src/main/rules/EC67/java/EC67.asciidoc
+++ b/src/main/rules/GCI67/java/GCI67.asciidoc
@@ -1,13 +1,15 @@
The form `$i++` creates a temporary variable whereas `++$i` does not. It save CPU cycles.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
i++ // Noncompliant
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
++i
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC67/php/1GB.etsdiff.csv b/src/main/rules/GCI67/php/1GB.etsdiff.csv
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC67/php/1GB.etsdiff.csv
rename to src/main/rules/GCI67/php/1GB.etsdiff.csv
diff --git a/ecocode-rules-specifications/src/main/rules/EC67/php/EC67.asciidoc b/src/main/rules/GCI67/php/GCI67.asciidoc
similarity index 74%
rename from ecocode-rules-specifications/src/main/rules/EC67/php/EC67.asciidoc
rename to src/main/rules/GCI67/php/GCI67.asciidoc
index 9a025ea99..7abbe40ab 100644
--- a/ecocode-rules-specifications/src/main/rules/EC67/php/EC67.asciidoc
+++ b/src/main/rules/GCI67/php/GCI67.asciidoc
@@ -1,20 +1,22 @@
The form `$i++` creates a temporary variable whereas `++$i` does not. It save CPU cycles.
-## Noncompliant Code Example
+== Non compliant Code Example
-```php
+[source,php]
+----
$i++
-```
+----
-## Compliant Solution
+== Compliant Solution
-```php
+[source,php]
+----
++$i
-```
+----
include::../../etsdiff-methodology.asciidoc[]
-## Case for a 1GB database:
+== Case for a 1GB database:
image::https://live.staticflickr.com/65535/52622379586_f84c767111_o.png[ETSdiff percent comparison]
diff --git a/ecocode-rules-specifications/src/main/rules/EC69/EC69.json b/src/main/rules/GCI69/GCI69.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC69/EC69.json
rename to src/main/rules/GCI69/GCI69.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC69/csharp/EC69.asciidoc b/src/main/rules/GCI69/csharp/GCI69.asciidoc
similarity index 93%
rename from ecocode-rules-specifications/src/main/rules/EC69/csharp/EC69.asciidoc
rename to src/main/rules/GCI69/csharp/GCI69.asciidoc
index d642bbb3d..9f24f1929 100644
--- a/ecocode-rules-specifications/src/main/rules/EC69/csharp/EC69.asciidoc
+++ b/src/main/rules/GCI69/csharp/GCI69.asciidoc
@@ -2,7 +2,7 @@
Don't call loop invariant functions in loop conditions.
-## Why is this an issue ?
+== Why is this an issue ?
Loop invariant functions do not depend on the current loop iteration, yet they are still evaluated each time.
This can lead to performance issues, especially when the loop is executed a large number of times, and/or if the function requires a lot of processing.
@@ -10,11 +10,11 @@ Instead, consider calling the function once before the loop and caching the resu
Note that property getters are not included in this rule, as they are expected to be fast and side-effect free.
-### When can it be ignored ?
+=== When can it be ignored ?
The analyzer may return false positives when the function call actually has a side effect, despite being syntactically loop invariant. In which case this warning should be ignored.
-## Non-compliant examples
+== Non compliant examples
[source, cs]
----
@@ -33,7 +33,7 @@ for (int i = 0; i < getValue(j); i++) // Noncompliant: getValue(j) is loop invar
Console.WriteLine(i);
----
-## Compliant examples
+== Compliant examples
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC69/java/EC69.asciidoc b/src/main/rules/GCI69/java/GCI69.asciidoc
similarity index 82%
rename from ecocode-rules-specifications/src/main/rules/EC69/java/EC69.asciidoc
rename to src/main/rules/GCI69/java/GCI69.asciidoc
index e32cd94db..7f4705143 100644
--- a/ecocode-rules-specifications/src/main/rules/EC69/java/EC69.asciidoc
+++ b/src/main/rules/GCI69/java/GCI69.asciidoc
@@ -1,19 +1,21 @@
Do not call a function when declaring a for-type loop in order to avoid function calls each iterations. It saves CPU cycles.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
public void foo() {
for (int i = 0; i < getMyValue(); i++) { // Noncompliant
System.out.println(i);
boolean b = getMyValue() > 6;
}
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
public void foo() {
int myValue = getMyValue();
for (int i = 0; i < myValue; i++) {
@@ -21,4 +23,4 @@ public void foo() {
boolean b = getMyValue() > 6;
}
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC69/php/1GB.etsdiff.csv b/src/main/rules/GCI69/php/1GB.etsdiff.csv
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC69/php/1GB.etsdiff.csv
rename to src/main/rules/GCI69/php/1GB.etsdiff.csv
diff --git a/ecocode-rules-specifications/src/main/rules/EC69/php/EC69.asciidoc b/src/main/rules/GCI69/php/GCI69.asciidoc
similarity index 82%
rename from ecocode-rules-specifications/src/main/rules/EC69/php/EC69.asciidoc
rename to src/main/rules/GCI69/php/GCI69.asciidoc
index 0da3cde83..846be3d64 100644
--- a/ecocode-rules-specifications/src/main/rules/EC69/php/EC69.asciidoc
+++ b/src/main/rules/GCI69/php/GCI69.asciidoc
@@ -1,16 +1,18 @@
Do not call a function when declaring a for-type loop in order to avoid function calls each iteration. It saves CPU cycles.
-## Noncompliant Code Example
+== Non compliant Code Example
-```php
+[source,php]
+----
for ($i = 0; $i <= foo(); $i++) { // Noncompliant
// ......
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```php
+[source,php]
+----
$maxI = foo();
for ($i = 0; $i <= $maxI; $i++) {
.....
@@ -22,11 +24,11 @@ for ($i = 0, $maxI = foo(); $i <= $maxI; $i++) {
.....
}
}
-```
+----
include::../../etsdiff-methodology.asciidoc[]
-## Case for a 1GB database:
+== Case for a 1GB database:
image::https://live.staticflickr.com/65535/52622634654_bf3c3d9ba8_o.png[ETSdiff percent comparison]
diff --git a/ecocode-rules-specifications/src/main/rules/EC7/EC7.json b/src/main/rules/GCI7/GCI7.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC7/EC7.json
rename to src/main/rules/GCI7/GCI7.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC7/python/EC7.asciidoc b/src/main/rules/GCI7/python/GCI7.asciidoc
similarity index 83%
rename from ecocode-rules-specifications/src/main/rules/EC7/python/EC7.asciidoc
rename to src/main/rules/GCI7/python/GCI7.asciidoc
index 8b2970bf7..a7f2053c9 100644
--- a/ecocode-rules-specifications/src/main/rules/EC7/python/EC7.asciidoc
+++ b/src/main/rules/GCI7/python/GCI7.asciidoc
@@ -1,8 +1,9 @@
Avoid using getters and setters in a class, as they increase unnecessary RAM memory usage.
-## Noncompliant Code Example
+== Non compliant Code Example
-```python
+[source,python]
+----
class Client():
def __init__(self, age):
@@ -17,11 +18,12 @@ class Client():
client = Client(25)
client.get_age() # Getter inutile
client.set_age(25) # Setter inutile
-```
+----
-## Compliant Solution
+== Compliant Solution
-```python
+[source,python]
+----
class Client():
def __init__(self, age):
@@ -30,5 +32,5 @@ class Client():
client = Client(25)
client.age # Récupérer l'attribut age
client.age = 26 # Modifier l'attribut age
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC72/EC72.json b/src/main/rules/GCI72/GCI72.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC72/EC72.json
rename to src/main/rules/GCI72/GCI72.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC72/csharp/EC72.asciidoc b/src/main/rules/GCI72/csharp/GCI72.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC72/csharp/EC72.asciidoc
rename to src/main/rules/GCI72/csharp/GCI72.asciidoc
index e1ec7a734..def27fbea 100644
--- a/ecocode-rules-specifications/src/main/rules/EC72/csharp/EC72.asciidoc
+++ b/src/main/rules/GCI72/csharp/GCI72.asciidoc
@@ -2,17 +2,17 @@
Don't execute SQL queries in loops.
-## Why is this an issue ?
+== Why is this an issue ?
Executing SQL queries in loops induces unnecessary calculation by the CPU, RAM usage and network transfer.
This can potentially lead to severe performance issues, especially when the loop is executed a large number of times.
Instead, consider using a single bulk query to massify the call.
-### When can it be ignored ?
+=== When can it be ignored ?
This warning shouldn't be ignored.
-## Non-compliant example
+== Non compliant example
[source, cs]
----
@@ -29,7 +29,7 @@ for (int i = 0; i < 20; i++) {
}
----
-## Compliant example
+== Compliant example
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC72/java/EC72.asciidoc b/src/main/rules/GCI72/java/GCI72.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC72/java/EC72.asciidoc
rename to src/main/rules/GCI72/java/GCI72.asciidoc
index 7032eb960..25b50b5a5 100644
--- a/ecocode-rules-specifications/src/main/rules/EC72/java/EC72.asciidoc
+++ b/src/main/rules/GCI72/java/GCI72.asciidoc
@@ -1,8 +1,9 @@
Executing SQL queries in loop induced unnecessary calculation by the CPU, RAM usage and network transfer.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
public void foo() {
// ...
String baseQuery = "SELECT name FROM users where id = ";
@@ -22,11 +23,12 @@ public void foo() {
}
// ...
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
public void foo() {
// ...
String query = "SELECT name FROM users where id in (0 ";
@@ -47,4 +49,4 @@ public void foo() {
st.close();
// ...
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC72/php/1GB.etsdiff.csv b/src/main/rules/GCI72/php/1GB.etsdiff.csv
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC72/php/1GB.etsdiff.csv
rename to src/main/rules/GCI72/php/1GB.etsdiff.csv
diff --git a/ecocode-rules-specifications/src/main/rules/EC72/php/2GB.etsdiff.csv b/src/main/rules/GCI72/php/2GB.etsdiff.csv
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC72/php/2GB.etsdiff.csv
rename to src/main/rules/GCI72/php/2GB.etsdiff.csv
diff --git a/ecocode-rules-specifications/src/main/rules/EC72/php/4GB.etsdiff.csv b/src/main/rules/GCI72/php/4GB.etsdiff.csv
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC72/php/4GB.etsdiff.csv
rename to src/main/rules/GCI72/php/4GB.etsdiff.csv
diff --git a/ecocode-rules-specifications/src/main/rules/EC72/php/8GB.etsdiff.csv b/src/main/rules/GCI72/php/8GB.etsdiff.csv
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC72/php/8GB.etsdiff.csv
rename to src/main/rules/GCI72/php/8GB.etsdiff.csv
diff --git a/ecocode-rules-specifications/src/main/rules/EC72/php/EC72.asciidoc b/src/main/rules/GCI72/php/GCI72.asciidoc
similarity index 90%
rename from ecocode-rules-specifications/src/main/rules/EC72/php/EC72.asciidoc
rename to src/main/rules/GCI72/php/GCI72.asciidoc
index 12fe0d7b7..28b1962ba 100644
--- a/ecocode-rules-specifications/src/main/rules/EC72/php/EC72.asciidoc
+++ b/src/main/rules/GCI72/php/GCI72.asciidoc
@@ -1,8 +1,9 @@
Executing SQL queries in loop induced unnecessary network transfert, calculation by the cpu and RAM usage.
-## Noncompliant Code Example
+== Non compliant Code Example
-```php
+[source,php]
+----
public function foo() {
...
$baseQuery = "SELECT name FROM users where id = ";
@@ -20,11 +21,12 @@ public function foo() {
}
...
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```php
+[source,php]
+----
public function foo() {
...
$query = "SELECT name FROM users where id in (";
@@ -42,11 +44,11 @@ public function foo() {
...
mysql_close($connection);
}
-```
+----
include::../../etsdiff-methodology.asciidoc[]
-## Case for a 1GB database:
+== Case for a 1GB database:
image::https://live.staticflickr.com/65535/52622813465_9c453a43b1_w.jpg[ETSdiff percent comparison" style="padding: 1rem;]
@@ -57,7 +59,7 @@ Source of impacts,Compliant,Non-compliant
include::1GB.etsdiff.csv[]
|===
-## Case for a 2GB database:
+== Case for a 2GB database:
image::https://live.staticflickr.com/65535/52622862388_720fd219ba_o.png[ETSdiff percent comparison" style="padding: 1rem;]
@@ -68,7 +70,7 @@ Source of impacts,Compliant,Non-compliant
include::2GB.etsdiff.csv[]
|===
-## Case for a 4GB database:
+== Case for a 4GB database:
image::https://live.staticflickr.com/65535/52622814395_f8aab7a5c0_o.png[ETSdiff percent comparison" style="padding: 1rem;]
@@ -79,7 +81,7 @@ Source of impacts,Compliant,Non-compliant
include::4GB.etsdiff.csv[]
|===
-## Case for a 8GB database:
+== Case for a 8GB database:
image::https://live.staticflickr.com/65535/52622635779_f1c5d9660e_o.png[ETSdiff percent comparison" style="padding: 1rem;]
diff --git a/ecocode-rules-specifications/src/main/rules/EC72/python/EC72.asciidoc b/src/main/rules/GCI72/python/GCI72.asciidoc
similarity index 83%
rename from ecocode-rules-specifications/src/main/rules/EC72/python/EC72.asciidoc
rename to src/main/rules/GCI72/python/GCI72.asciidoc
index ae85dfe3e..a50fe6837 100644
--- a/ecocode-rules-specifications/src/main/rules/EC72/python/EC72.asciidoc
+++ b/src/main/rules/GCI72/python/GCI72.asciidoc
@@ -1,23 +1,25 @@
Executing SQL queries in loop induced unnecessary calculation by the CPU, RAM usage and network transfer.
-## Noncompliant Code Example
+== Non compliant Code Example
-```python
+[source,python]
+----
def foo():
...
results = []
for id in range(20):
results.append(cursor.execute("SELECT name FROM users where id = ?", (id)).fetchone()) # Noncompliant {{Avoid performing SQL queries within a loop}}
...
-```
+----
-## Compliant Solution
+== Compliant Solution
-```python
+[source,python]
+----
def foo():
...
ids = range(20)
results = cursor.execute("SELECT name FROM users where id IN ({0})".format(', '.join("?" * len(ids))), ids).fetchmany() # Compliant
...
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC74/EC74.json b/src/main/rules/GCI74/GCI74.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC74/EC74.json
rename to src/main/rules/GCI74/GCI74.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC74/java/EC74.asciidoc b/src/main/rules/GCI74/java/GCI74.asciidoc
similarity index 78%
rename from ecocode-rules-specifications/src/main/rules/EC74/java/EC74.asciidoc
rename to src/main/rules/GCI74/java/GCI74.asciidoc
index 4f1299b18..0e4206fa4 100644
--- a/ecocode-rules-specifications/src/main/rules/EC74/java/EC74.asciidoc
+++ b/src/main/rules/GCI74/java/GCI74.asciidoc
@@ -1,21 +1,23 @@
Database servers have to resolve schema fields when using asterisk symbol (`*`). Knowing and using the schema saves CPU cycles and network transfer.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
public void foo() {
// ...
String baseQuery = "SELECT * FROM users"; // Noncompliant
// ...
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
public void foo() {
// ...
String query = "SELECT id, name, address FROM users";
// ...
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC74/php/1GB.etsdiff.csv b/src/main/rules/GCI74/php/1GB.etsdiff.csv
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC74/php/1GB.etsdiff.csv
rename to src/main/rules/GCI74/php/1GB.etsdiff.csv
diff --git a/ecocode-rules-specifications/src/main/rules/EC74/php/EC74.asciidoc b/src/main/rules/GCI74/php/GCI74.asciidoc
similarity index 82%
rename from ecocode-rules-specifications/src/main/rules/EC74/php/EC74.asciidoc
rename to src/main/rules/GCI74/php/GCI74.asciidoc
index ffb380dd5..c81c3de2b 100644
--- a/ecocode-rules-specifications/src/main/rules/EC74/php/EC74.asciidoc
+++ b/src/main/rules/GCI74/php/GCI74.asciidoc
@@ -1,28 +1,30 @@
Database servers have to resolve schema fields when using asterisk symbol (`*`). Knowing and using the schema saves CPU cycles and network transfer.
-## Noncompliant Code Example
+== Non compliant Code Example
-```php
+[source,php]
+----
public function foo() {
...
$baseQuery = "SELECT * FROM users"; // Noncompliant
...
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```php
+[source,php]
+----
public function foo() {
...
$baseQuery = "SELECT id,name, address FROM users ";
...
}
-```
+----
include::../../etsdiff-methodology.asciidoc[]
-## Case for a 1GB database:
+== Case for a 1GB database:
image::https://live.staticflickr.com/65535/52622636584_52938fcf7e_o.png[ETSdiff percent comparison]
diff --git a/ecocode-rules-specifications/src/main/rules/EC74/python/EC74.asciidoc b/src/main/rules/GCI74/python/GCI74.asciidoc
similarity index 77%
rename from ecocode-rules-specifications/src/main/rules/EC74/python/EC74.asciidoc
rename to src/main/rules/GCI74/python/GCI74.asciidoc
index 3b9b41c0f..c722ebbec 100644
--- a/ecocode-rules-specifications/src/main/rules/EC74/python/EC74.asciidoc
+++ b/src/main/rules/GCI74/python/GCI74.asciidoc
@@ -1,21 +1,23 @@
Database servers have to resolve schema fields when using asterisk symbol (`*`). Knowing and using the schema saves CPU cycles and network transfer.
-## Noncompliant Code Example
+== Non compliant Code Example
-```python
+[source,python]
+----
public void foo() {
...
String baseQuery = "SELECT * FROM users"; // Noncompliant
...
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```python
+[source,python]
+----
public void foo() {
...
String query = "SELECT id, name, address FROM users ";
...
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC75/EC75.json b/src/main/rules/GCI75/GCI75.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC75/EC75.json
rename to src/main/rules/GCI75/GCI75.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC75/csharp/EC75.asciidoc b/src/main/rules/GCI75/csharp/GCI75.asciidoc
similarity index 90%
rename from ecocode-rules-specifications/src/main/rules/EC75/csharp/EC75.asciidoc
rename to src/main/rules/GCI75/csharp/GCI75.asciidoc
index 4da9ecb90..b746c4231 100644
--- a/ecocode-rules-specifications/src/main/rules/EC75/csharp/EC75.asciidoc
+++ b/src/main/rules/GCI75/csharp/GCI75.asciidoc
@@ -2,17 +2,17 @@
Don't concatenate `strings` in loops, use a `StringBuilder` instead.
-## Why is this an issue ?
+== Why is this an issue ?
`strings` are immutable so each time they are concatenated, a new one is created. When in a loop, this can lead to a waste of memory and CPU time.
In comparison, a `StringBuilder` works with a single mutable buffer, from which a resulting `string` can be allocated when needed.
-### When can it be ignored ?
+=== When can it be ignored ?
If the number of concatenations is very small, typically 5 or less, then the overhead cost is either marginal or non-existent, and can be ignored.
-## Non-compliant example
+== Non compliant example
[source, cs]
----
@@ -21,7 +21,7 @@ for (int i = 0; i < 100; i++)
myString += i; // Non compliant : this requires a new string allocation on each iteration
----
-## Compliant example
+== Compliant example
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC76/EC76.json b/src/main/rules/GCI76/GCI76.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC76/EC76.json
rename to src/main/rules/GCI76/GCI76.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC76/java/EC76.asciidoc b/src/main/rules/GCI76/java/GCI76.asciidoc
similarity index 89%
rename from ecocode-rules-specifications/src/main/rules/EC76/java/EC76.asciidoc
rename to src/main/rules/GCI76/java/GCI76.asciidoc
index f21e5298c..7d97730d3 100644
--- a/ecocode-rules-specifications/src/main/rules/EC76/java/EC76.asciidoc
+++ b/src/main/rules/GCI76/java/GCI76.asciidoc
@@ -4,9 +4,10 @@ If you want to use static collections make them final and create for example a s
The static fields are more complicated for the Garbage Collector to manage and can lead to memory leaks.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
/**
* Not compliant
*/
@@ -15,11 +16,12 @@ public class AvoidUsageOfStaticCollections {
public static final Set<> SET = new HashSet<>();
public static final Map<> MAP = new HashMap<>();
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
/**
* Compliant
*/
@@ -33,4 +35,4 @@ public class GoodUsageOfStaticCollections {
private GoodUsageOfStaticCollections() {
}
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC77/EC77.json b/src/main/rules/GCI77/GCI77.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC77/EC77.json
rename to src/main/rules/GCI77/GCI77.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC77/java/EC77.asciidoc b/src/main/rules/GCI77/java/GCI77.asciidoc
similarity index 83%
rename from ecocode-rules-specifications/src/main/rules/EC77/java/EC77.asciidoc
rename to src/main/rules/GCI77/java/GCI77.asciidoc
index 188b8f648..01281f8b8 100644
--- a/ecocode-rules-specifications/src/main/rules/EC77/java/EC77.asciidoc
+++ b/src/main/rules/GCI77/java/GCI77.asciidoc
@@ -1,20 +1,22 @@
Avoid using `Pattern.compile()` in a non-static context.
This operation requires a significant amount of computational power, Using a single match saves CPU cycles and RAM consumption.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
public class AvoidRegexPatternNotStatic {
public boolean foo() {
final Pattern pattern = Pattern.compile("foo"); // Noncompliant
return pattern.matcher("foo").find();
}
}
-```
+----
-## Compliant Solution N°1
+== Compliant Solution N°1
-```java
+[source,java]
+----
public class ValidRegexPattern {
private static final Pattern pattern = Pattern.compile("foo"); // Compliant
@@ -22,11 +24,12 @@ public class ValidRegexPattern {
return pattern.matcher("foo").find();
}
}
-```
+----
-## Compliant Solution N°2
+== Compliant Solution N°2
-```java
+[source,java]
+----
public class ValidRegexPattern2 {
private final Pattern pattern = Pattern.compile("foo"); // Compliant
@@ -34,11 +37,12 @@ public class ValidRegexPattern2 {
return pattern.matcher("foo").find();
}
}
-```
+----
-## Compliant Solution N°3
+== Compliant Solution N°3
-```java
+[source,java]
+----
public class ValidRegexPattern3 {
private final Pattern pattern;
@@ -50,4 +54,4 @@ public class ValidRegexPattern3 {
return pattern.matcher("foo").find();
}
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC78/EC78.json b/src/main/rules/GCI78/GCI78.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC78/EC78.json
rename to src/main/rules/GCI78/GCI78.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC78/java/EC78.asciidoc b/src/main/rules/GCI78/java/GCI78.asciidoc
similarity index 87%
rename from ecocode-rules-specifications/src/main/rules/EC78/java/EC78.asciidoc
rename to src/main/rules/GCI78/java/GCI78.asciidoc
index 3153a8742..7cd3d0f86 100644
--- a/ecocode-rules-specifications/src/main/rules/EC78/java/EC78.asciidoc
+++ b/src/main/rules/GCI78/java/GCI78.asciidoc
@@ -1,8 +1,9 @@
Don't set a constant parameter in batch update. Instead, put it in query. Creating this parameter and destroying it consumes CPU cycles and RAM unnecessarily.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
public void foo() {
// ...
String query = "insert into mytable values(?,?,?)";
@@ -15,11 +16,12 @@ public void foo() {
}
// ...
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
public void foo() {
// ...
String query = "insert into mytable values(123,?,?)";
@@ -31,4 +33,4 @@ public void foo() {
}
// ...
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC79/EC79.json b/src/main/rules/GCI79/GCI79.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC79/EC79.json
rename to src/main/rules/GCI79/GCI79.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC79/java/EC79.asciidoc b/src/main/rules/GCI79/java/GCI79.asciidoc
similarity index 86%
rename from ecocode-rules-specifications/src/main/rules/EC79/java/EC79.asciidoc
rename to src/main/rules/GCI79/java/GCI79.asciidoc
index ef8bc2156..1b99770ca 100644
--- a/ecocode-rules-specifications/src/main/rules/EC79/java/EC79.asciidoc
+++ b/src/main/rules/GCI79/java/GCI79.asciidoc
@@ -1,8 +1,9 @@
Use `try-with-resources` statement for any object that implements the `AutoCloseable` interface, it save computer resources.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
+[source,java]
+----
private static void printFileJava7() throws IOException {
FileInputStream input = new FileInputStream("file.txt");
int data = input.read();
@@ -11,11 +12,12 @@ private static void printFileJava7() throws IOException {
data = input.read();
}
}
-```
+----
-## Compliant Solution
+== Compliant Solution
-```java
+[source,java]
+----
private static void printFileJava7() throws IOException {
try(FileInputStream input = new FileInputStream("file.txt")) {
int data = input.read();
@@ -25,4 +27,4 @@ private static void printFileJava7() throws IOException {
}
}
}
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC81/EC81.json b/src/main/rules/GCI81/GCI81.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC81/EC81.json
rename to src/main/rules/GCI81/GCI81.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC81/csharp/EC81.asciidoc b/src/main/rules/GCI81/csharp/GCI81.asciidoc
similarity index 92%
rename from ecocode-rules-specifications/src/main/rules/EC81/csharp/EC81.asciidoc
rename to src/main/rules/GCI81/csharp/GCI81.asciidoc
index 877aca180..519ac2aed 100644
--- a/ecocode-rules-specifications/src/main/rules/EC81/csharp/EC81.asciidoc
+++ b/src/main/rules/GCI81/csharp/GCI81.asciidoc
@@ -2,7 +2,7 @@
Specify struct layout.
-## Why is this an issue ?
+== Why is this an issue ?
Structs that don't contain reference types (directly nor indirectly) have the `Sequential` layout by default.
This is to prevent breaking any project that uses interop code and requires that the fields stay ordered.
@@ -10,11 +10,11 @@ In other cases however, field reordering is usually fine and there are little re
You can read a much more in-depth analysis of struct packing here : http://www.catb.org/esr/structure-packing/
-### When can it be ignored ?
+=== When can it be ignored ?
It can be ignored if you know you require the `Sequential` layout for all of your structs, most likely for interop purposes.
-## Non-compliant examples
+== Non compliant examples
[source, cs]
----
@@ -26,7 +26,7 @@ public struct MyStruct // Non compliant, specify the layout. Will take 24 bytes
}
----
-## Compliant examples
+== Compliant examples
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC82/EC82.json b/src/main/rules/GCI82/GCI82.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC82/EC82.json
rename to src/main/rules/GCI82/GCI82.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC82/csharp/EC82.asciidoc b/src/main/rules/GCI82/csharp/GCI82.asciidoc
similarity index 89%
rename from ecocode-rules-specifications/src/main/rules/EC82/csharp/EC82.asciidoc
rename to src/main/rules/GCI82/csharp/GCI82.asciidoc
index ff6e98f9f..b70737880 100644
--- a/ecocode-rules-specifications/src/main/rules/EC82/csharp/EC82.asciidoc
+++ b/src/main/rules/GCI82/csharp/GCI82.asciidoc
@@ -2,16 +2,16 @@
Variable can be made constant.
-## Why is this an issue ?
+== Why is this an issue ?
Unlike variables, constant values are known at compile time and are injected as is in the code, requiring no runtime processing and therefore reducing the environmental footprint.
Although good compilers will const eligible variables by themselves, it is still good practice to declare them constant, as it makes the code intent clearer.
-### When can it be ignored ?
+=== When can it be ignored ?
This rule should not be ignored.
-## Non-compliant examples
+== Non compliant examples
[source, cs]
----
@@ -22,7 +22,7 @@ public void Main()
}
----
-## Compliant examples
+== Compliant examples
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC83/EC83.json b/src/main/rules/GCI83/GCI83.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC83/EC83.json
rename to src/main/rules/GCI83/GCI83.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC83/csharp/EC83.asciidoc b/src/main/rules/GCI83/csharp/GCI83.asciidoc
similarity index 88%
rename from ecocode-rules-specifications/src/main/rules/EC83/csharp/EC83.asciidoc
rename to src/main/rules/GCI83/csharp/GCI83.asciidoc
index 397b28b44..75c22c97c 100644
--- a/ecocode-rules-specifications/src/main/rules/EC83/csharp/EC83.asciidoc
+++ b/src/main/rules/GCI83/csharp/GCI83.asciidoc
@@ -2,16 +2,16 @@
Replace Enum ToString() with nameof.
-## Why is this an issue ?
+== Why is this an issue ?
When using the Enum ToString() syntax to convert an enum value to a string, without any specific format, the result will be the same as using the nameof(value) syntax.
While the first one is resolved at runtime and requires some work, the latter is resolved at compile time and is much more efficient.
-### When can it be ignored ?
+=== When can it be ignored ?
This rule should not be ignored.
-## Non-compliant example
+== Non compliant example
[source, cs]
----
@@ -23,7 +23,7 @@ public void Main()
}
----
-## Compliant examples
+== Compliant examples
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC84/EC84.json b/src/main/rules/GCI84/GCI84.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC84/EC84.json
rename to src/main/rules/GCI84/GCI84.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC84/csharp/EC84.asciidoc b/src/main/rules/GCI84/csharp/GCI84.asciidoc
similarity index 94%
rename from ecocode-rules-specifications/src/main/rules/EC84/csharp/EC84.asciidoc
rename to src/main/rules/GCI84/csharp/GCI84.asciidoc
index b3d45d40c..8ae052ccd 100644
--- a/ecocode-rules-specifications/src/main/rules/EC84/csharp/EC84.asciidoc
+++ b/src/main/rules/GCI84/csharp/GCI84.asciidoc
@@ -2,7 +2,7 @@
Avoid `async void` methods.
-## Why is this an issue ?
+== Why is this an issue ?
Using `async void` methods is strongly discouraged due to the significant drawbacks that affect both performance and environmental impact:
@@ -12,11 +12,11 @@ Using `async void` methods is strongly discouraged due to the significant drawba
Overall, `async void` methods are considered poor practice, especially since the recommended alternative `async Task` is readily usable and provides an efficient solution for managing asynchronous operations without these downsides.
-### When can it be ignored ?
+=== When can it be ignored ?
In some edge cases, using an `async void` method can be beneficial, but you should **really know** what you're doing.
-## Non-compliant example
+== Non compliant example
[source, cs]
----
@@ -36,7 +36,7 @@ public class Test
}
----
-## Compliant example
+== Compliant example
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC85/EC85.json b/src/main/rules/GCI85/GCI85.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC85/EC85.json
rename to src/main/rules/GCI85/GCI85.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC85/csharp/EC85.asciidoc b/src/main/rules/GCI85/csharp/GCI85.asciidoc
similarity index 93%
rename from ecocode-rules-specifications/src/main/rules/EC85/csharp/EC85.asciidoc
rename to src/main/rules/GCI85/csharp/GCI85.asciidoc
index 725b46d34..c136a7185 100644
--- a/ecocode-rules-specifications/src/main/rules/EC85/csharp/EC85.asciidoc
+++ b/src/main/rules/GCI85/csharp/GCI85.asciidoc
@@ -2,13 +2,13 @@
Make type sealed.
-## Why is this an issue ?
+== Why is this an issue ?
A non-sealed type prevents the JIT compiler from applying strong optimizations such as devirtualization and inlining. If that type is intended to be inheritable then this is expected ; however if it doesn't, then it should be sealed explictly to bring the benefits from those optimizations.
For a more in-depth explanation, see https://devblogs.microsoft.com/dotnet/performance_improvements_in_net_7/#analyzers
-### How does the analyzer identify sealable classes ?
+=== How does the analyzer identify sealable classes ?
The analyzer will consider a type for sealing when the following conditions are met :
@@ -16,11 +16,11 @@ The analyzer will consider a type for sealing when the following conditions are
* The type is currently not inherited from in the solution
* The type is not public, or it is public and has no overridable member (except for the default ones like GetHashcode, Equals, etc)
-### When can it be ignored ?
+=== When can it be ignored ?
This rule can be ignored if you want a public type with no overridable member to still be inheritable from other assemblies.
-## Non-compliant examples
+== Non compliant examples
[source, cs]
----
@@ -55,7 +55,7 @@ public class Class6 : Class4 // Compliant, Method() is still overridable
}
----
-## Compliant examples
+== Compliant examples
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC86/EC86.json b/src/main/rules/GCI86/GCI86.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC86/EC86.json
rename to src/main/rules/GCI86/GCI86.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC86/csharp/EC86.asciidoc b/src/main/rules/GCI86/csharp/GCI86.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC86/csharp/EC86.asciidoc
rename to src/main/rules/GCI86/csharp/GCI86.asciidoc
index 51a9f113e..3fbefca7d 100644
--- a/ecocode-rules-specifications/src/main/rules/EC86/csharp/EC86.asciidoc
+++ b/src/main/rules/GCI86/csharp/GCI86.asciidoc
@@ -2,19 +2,19 @@
`GC.Collect` should not be called.
-## Why is this an issue ?
+== Why is this an issue ?
Calling `GC.Collect` forces a garbage collection to occur. This can be a very expensive operation, as it is fully blocking and can take a significant amount of time to complete.
In most cases, the garbage collector is able to determine when it is appropriate to run a collection, and calling `GC.Collect` is not only unnecessary but also not advisable.
Calling `GC.Collect` on generation 0 (ephemeral objects) is excluded from this rule, as it is very lightweight in comparison to the other generations.
-### When can it be ignored ?
+=== When can it be ignored ?
In general, it is not recommended to call GC.Collect as the cost far outweighs the benefits.
In some cases however, typically if you know you have a lot of long-lived objects whose memory you need reclaimed immediately, calling `GC.Collect` can make sense.
-## Non-compliant examples
+== Non compliant examples
[source, cs]
----
@@ -25,7 +25,7 @@ public void Method();
}
----
-## Compliant examples
+== Compliant examples
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC87/EC87.json b/src/main/rules/GCI87/GCI87.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC87/EC87.json
rename to src/main/rules/GCI87/GCI87.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC87/csharp/EC87.asciidoc b/src/main/rules/GCI87/csharp/GCI87.asciidoc
similarity index 88%
rename from ecocode-rules-specifications/src/main/rules/EC87/csharp/EC87.asciidoc
rename to src/main/rules/GCI87/csharp/GCI87.asciidoc
index e977592c1..e2a8870b3 100644
--- a/ecocode-rules-specifications/src/main/rules/EC87/csharp/EC87.asciidoc
+++ b/src/main/rules/GCI87/csharp/GCI87.asciidoc
@@ -2,16 +2,16 @@
Use collection indexer.
-## Why is this an issue ?
+== Why is this an issue ?
Linq methods like `First()`, `Last()` and `ElementAt()` can be necessary on enumerable types that don't have an indexer.
But for those that implement `IReadOnlyList`, `IList` or `IList`, direct index access is cheaper at runtime and should be used instead.
-### When can it be ignored ?
+=== When can it be ignored ?
This rule shouldn't be ignored.
-## Non-compliant examples
+== Non compliant examples
[source, cs]
----
@@ -23,7 +23,7 @@ public static void Test(int[] arr)
}
----
-## Compliant examples
+== Compliant examples
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC88/EC88.json b/src/main/rules/GCI88/GCI88.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC88/EC88.json
rename to src/main/rules/GCI88/GCI88.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC88/csharp/EC88.asciidoc b/src/main/rules/GCI88/csharp/GCI88.asciidoc
similarity index 90%
rename from ecocode-rules-specifications/src/main/rules/EC88/csharp/EC88.asciidoc
rename to src/main/rules/GCI88/csharp/GCI88.asciidoc
index 59a2a9832..d4fc21bd5 100644
--- a/ecocode-rules-specifications/src/main/rules/EC88/csharp/EC88.asciidoc
+++ b/src/main/rules/GCI88/csharp/GCI88.asciidoc
@@ -2,17 +2,17 @@
Dispose resources asynchronously.
-## Why is this an issue ?
+== Why is this an issue ?
Asynchronous operations free up the main thread, allowing it to handle other tasks or enter an idle state, which can lead to lower CPU usage and power consumption. Efficient resource utilization minimizes the overall environmental footprint of applications by reducing the time resources are held, lowering server load, and improving scalability.
Therefore, resources that implement `IAsyncDisposable` should be disposed asynchronously whenever possible.
-### When can it be ignored ?
+=== When can it be ignored ?
This rule shouldn't be ignored.
-## Non-compliant examples
+== Non compliant examples
[source, cs]
----
@@ -22,7 +22,7 @@ public static async Task Test()
}
----
-## Compliant examples
+== Compliant examples
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC89/EC89.json b/src/main/rules/GCI89/GCI89.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC89/EC89.json
rename to src/main/rules/GCI89/GCI89.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC89/python/EC89.asciidoc b/src/main/rules/GCI89/python/GCI89.asciidoc
similarity index 82%
rename from ecocode-rules-specifications/src/main/rules/EC89/python/EC89.asciidoc
rename to src/main/rules/GCI89/python/GCI89.asciidoc
index dd4ebc3f3..141fabc84 100644
--- a/ecocode-rules-specifications/src/main/rules/EC89/python/EC89.asciidoc
+++ b/src/main/rules/GCI89/python/GCI89.asciidoc
@@ -7,30 +7,34 @@ By default, lru_cache set the size of cache to 128 entries.
In this case, the cache is unlimited which is suspect.
-## Noncompliant Code Examples
+== Non compliant Code Examples
-```python
+[source,python]
+----
@cache # Noncompliant
def cached_function():
...
-```
+----
-```python
+[source,python]
+----
@lru_cache(maxsize=None) # Noncompliant
def cached_function():
...
-```
+----
-## Compliant Solution
+== Compliant Solution
-```python
+[source,python]
+----
@lru_cache() # By default, the max size of the cache is 128
def cached_function():
...
-```
+----
-```python
+[source,python]
+----
@lru_cache(maxsize=16) # Define a max size to the cache
def cached_function():
...
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/EC9/EC9.json b/src/main/rules/GCI9/GCI9.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC9/EC9.json
rename to src/main/rules/GCI9/GCI9.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC9/javascript/EC9.asciidoc b/src/main/rules/GCI9/javascript/GCI9.asciidoc
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC9/javascript/EC9.asciidoc
rename to src/main/rules/GCI9/javascript/GCI9.asciidoc
diff --git a/ecocode-rules-specifications/src/main/rules/EC91/EC91.json b/src/main/rules/GCI91/GCI91.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC91/EC91.json
rename to src/main/rules/GCI91/GCI91.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC91/csharp/EC91.asciidoc b/src/main/rules/GCI91/csharp/GCI91.asciidoc
similarity index 94%
rename from ecocode-rules-specifications/src/main/rules/EC91/csharp/EC91.asciidoc
rename to src/main/rules/GCI91/csharp/GCI91.asciidoc
index cc6053d55..001bf7edb 100644
--- a/ecocode-rules-specifications/src/main/rules/EC91/csharp/EC91.asciidoc
+++ b/src/main/rules/GCI91/csharp/GCI91.asciidoc
@@ -2,15 +2,15 @@
Use Where before OrderBy.
-## Why is this an issue ?
+== Why is this an issue ?
When `Orderby` is called right before `Where`, LINQ sorts all the elements before filtering them. Doing the opposite is more efficient, first filter the items then sort the remaining ones only.
-### When can it be ignored ?
+=== When can it be ignored ?
This rule shouldn't be ignored.
-## Non-compliant examples
+== Non compliant examples
[source, cs]
----
@@ -55,7 +55,7 @@ public static async Task Test()
}
----
-## Compliant examples
+== Compliant examples
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC92/EC92.json b/src/main/rules/GCI92/GCI92.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC92/EC92.json
rename to src/main/rules/GCI92/GCI92.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC92/csharp/EC92.asciidoc b/src/main/rules/GCI92/csharp/GCI92.asciidoc
similarity index 83%
rename from ecocode-rules-specifications/src/main/rules/EC92/csharp/EC92.asciidoc
rename to src/main/rules/GCI92/csharp/GCI92.asciidoc
index ec024f922..16deaa801 100644
--- a/ecocode-rules-specifications/src/main/rules/EC92/csharp/EC92.asciidoc
+++ b/src/main/rules/GCI92/csharp/GCI92.asciidoc
@@ -2,15 +2,15 @@
Use string.Length instead of comparison with empty string
-## Why is this an issue ?
+== Why is this an issue ?
Comparing a string to an empty string is unnecessary and can be replaced by a call to `string.Length`, which is more performant and more readable.
-### When can it be ignored ?
+=== When can it be ignored ?
This rule should not be ignored.
-## Non-compliant examples
+== Non compliant examples
[source, cs]
----
@@ -24,7 +24,7 @@ public void Main()
}
----
-## Compliant examples
+== Compliant examples
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC93/EC93.json b/src/main/rules/GCI93/GCI93.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC93/EC93.json
rename to src/main/rules/GCI93/GCI93.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC93/csharp/EC93.asciidoc b/src/main/rules/GCI93/csharp/GCI93.asciidoc
similarity index 91%
rename from ecocode-rules-specifications/src/main/rules/EC93/csharp/EC93.asciidoc
rename to src/main/rules/GCI93/csharp/GCI93.asciidoc
index 07237306c..d1da5ccf5 100644
--- a/ecocode-rules-specifications/src/main/rules/EC93/csharp/EC93.asciidoc
+++ b/src/main/rules/GCI93/csharp/GCI93.asciidoc
@@ -2,15 +2,15 @@
Return Task directly.
-## Why is this an issue ?
+== Why is this an issue ?
Asynchronous methods that contain a single awaited statement can be optimized by removing the `async` modifier and returning the awaited `Task` directly. Doing so reduces the overhead of the state machine generated for the asynchronous method, leading to more efficient code and improving the resource efficiency of the application.
-### When can it be ignored ?
+=== When can it be ignored ?
When this rule is applied, exception handling is deferred to the main caller instead, which may or may not be desirable. The decision should be done with consideration to the context in which the method is used.
-## Non-compliant examples
+== Non compliant examples
[source, cs]
----
@@ -25,7 +25,7 @@ public static async Task Test2()
}
----
-## Compliant examples
+== Compliant examples
[source, cs]
----
diff --git a/ecocode-rules-specifications/src/main/rules/EC94/EC94.json b/src/main/rules/GCI94/GCI94.json
similarity index 100%
rename from ecocode-rules-specifications/src/main/rules/EC94/EC94.json
rename to src/main/rules/GCI94/GCI94.json
diff --git a/ecocode-rules-specifications/src/main/rules/EC94/java/EC94.asciidoc b/src/main/rules/GCI94/java/GCI94.asciidoc
similarity index 53%
rename from ecocode-rules-specifications/src/main/rules/EC94/java/EC94.asciidoc
rename to src/main/rules/GCI94/java/GCI94.asciidoc
index 77dfc09fb..e3532c829 100644
--- a/ecocode-rules-specifications/src/main/rules/EC94/java/EC94.asciidoc
+++ b/src/main/rules/GCI94/java/GCI94.asciidoc
@@ -4,18 +4,21 @@ Supplier method of orElseGet passed as an argument is only executed when an Opti
Therefore, using orElseGet() will save computing time.
-## Noncompliant Code Example
+== Non compliant Code Example
-```java
-Optional.of("ecoCode").orElse(getUnpredictedMethod());
-```
+[source,java]
+----
+Optional.of("creedengo").orElse(getUnpredictedMethod());
+----
-## Compliant Code Example
+== Compliant Code Example
-```java
-Optional.of("ecoCode").orElseGet(() -> getUnpredictedMethod());
-```
+[source,java]
+----
+Optional.of("creedengo").orElseGet(() -> getUnpredictedMethod());
+----
-```java
+[source,java]
+----
randomClass.orElse(getUnpredictedMethod());
-```
+----
diff --git a/ecocode-rules-specifications/src/main/rules/etsdiff-methodology.asciidoc b/src/main/rules/etsdiff-methodology.asciidoc
similarity index 89%
rename from ecocode-rules-specifications/src/main/rules/etsdiff-methodology.asciidoc
rename to src/main/rules/etsdiff-methodology.asciidoc
index 3239fa7d4..fd70bed2e 100644
--- a/ecocode-rules-specifications/src/main/rules/etsdiff-methodology.asciidoc
+++ b/src/main/rules/etsdiff-methodology.asciidoc
@@ -1,4 +1,4 @@
-## The three sources of impacts of a code identified are:
+== The three sources of impacts of a code identified are:
- Energy: measured in joules (J)
- Transfer: measured in Bytes (B)
diff --git a/ecocode-rules-specifications/src/main/script/PrepareResources.jsh b/src/main/script/PrepareResources.jsh
similarity index 98%
rename from ecocode-rules-specifications/src/main/script/PrepareResources.jsh
rename to src/main/script/PrepareResources.jsh
index 0ef77ddc7..1d3d09f9d 100644
--- a/ecocode-rules-specifications/src/main/script/PrepareResources.jsh
+++ b/src/main/script/PrepareResources.jsh
@@ -112,7 +112,7 @@ import static java.util.Optional.of;
/**
* Resources to include
*/
- private static final Pattern TARGET_RESOURCES = Pattern.compile("^.*/(?EC\\d+)/(?[^/]*)/.*\\.html$");
+ private static final Pattern TARGET_RESOURCES = Pattern.compile("^.*/(?GCI\\d+)/(?[^/]*)/.*\\.html$");
static Optional createFromHtmlDescription(Path htmlDescription) {
final Matcher matcher = TARGET_RESOURCES.matcher(htmlDescription.toString().replace('\\', '/'));