Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove deprecated rules for EC4/EC53/EC63/EC75 for JAVA #272

Merged
merged 10 commits into from
Feb 2, 2024
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Refuse rule proposition [Avoid returning a JPA Entity in a RestController](https://github.com/green-code-initiative/ecoCode/pull/138) for Java because of lack of arguments and measures
- Refuse rule proposition [Avoid use of static in interface](https://github.com/green-code-initiative/ecoCode/pull/7) for Java because of lack of arguments and measures
- [Remove deprecated rules EC4, EC53, EC63 and EC75 for JAVA](https://github.com/green-code-initiative/ecoCode/pull/272)
alograg marked this conversation as resolved.
Show resolved Hide resolved

### Deleted

Expand Down
17 changes: 9 additions & 8 deletions RULES.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,26 @@ This table lists rules proposed by the community but they have to be reworked /
| EC22 | Java | The use of methods for basic operations | We have to measure this rule for Java before accepting the implementation | [Github discussion - issue](https://github.com/green-code-initiative/ecoCode/issues/131)<br/>[Github discussion - PR](https://github.com/green-code-initiative/ecoCode/pull/148) |
| CRJVM204 | Java | Detect unoptimized file formats | We have to clarify and rework this rule for Java before accepting the implementation | [Github discussion - issue](https://github.com/green-code-initiative/ecoCode/issues/105)<br/>[Github discussion - PR](https://github.com/green-code-initiative/ecoCode/pull/153) |
| | Java | Avoid returning a JPA Entity in a RestController | We have to clarify and measure this rule for Java before accepting the implementation | [Github discussion - issue](https://github.com/green-code-initiative/ecoCode-challenge/issues/58)<br/>[Github discussion - PR](https://github.com/green-code-initiative/ecoCode/pull/138) |
| EC53 | Java | Using arrays in foreach loops | No good arguments and not enough green measures. | [Github discussion with sources](https://github.com/green-code-initiative/ecoCode/issues/240) |

## Deprecated rules

This table lists rules proposed by the community but deprecated in ecoCode plugins with the justification. These rules will be completely deleted in next releases and moved to bottom deleted rules array.

| Rule key | Language | Name | Description | Invalidation |
|----------|---------------------|----------------------------------------------------|----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| EC4 | Java | Avoid using global variables | Global variables do not exist in Java. | [Github discussion with sources](https://github.com/green-code-initiative/ecoCode/issues/233) |
| EC34 | Java / Python / PHP | Using try...catch...finally calls | Implementation is too simple (only detection of presence of "try" statement) AND replaced by `EC35` rule | Github discussion with measures : [general/java](https://github.com/green-code-initiative/ecoCode/pull/128) / [python](https://github.com/green-code-initiative/ecoCode-python/pull/6) / [php](https://github.com/green-code-initiative/ecoCode-php/pull/10) |
| EC53 | Java | Using arrays in foreach loops | No good arguments and not enough green measures. | [Github discussion with sources](https://github.com/green-code-initiative/ecoCode/issues/240) |
| EC63 | Java | Unnecessarily assigning values to variables | There are already 3 native SonarQube rules for Java. | [Github discussion with sources](https://github.com/green-code-initiative/ecoCode/pull/258) |
| EC66 | Python | Use single quote (') instead of quotation mark (") | Finally, not applicable for Python | [Github discussion with sources](https://github.com/green-code-initiative/ecoCode-python/issues/4) |
| EC75 | Java | Concatenate Strings in loop | Optimizations on Java concatenation Strings are useless since JDK8 | [Github discussion with sources](https://github.com/green-code-initiative/ecoCode/issues/246) |

## Refused / Deleted rules

This table lists rules proposed by the community but refused or/and deleted in ecoCode plugins with the justification.

| Rule key | Language | Name | Description | Invalidation |
|----------|----------|------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CRDOM203 | HTML | HTML page must contain a doctype tag | The difference in performance is negligible, this rule is more related to the user experience. | [Github discussion with sources](https://github.com/green-code-initiative/ecoCode/issues/103) |
| CRPYT | Python | Use numpy array instead of standard list | The use of numpy library to perform array manipulation is more energy efficient than the use of the standard list functions. | [Github discussion with measures](https://github.com/green-code-initiative/ecoCode/issues/132) |
| Rule key | Language | Name | Description | Invalidation |
|----------|----------|---------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| CRDOM203 | HTML | HTML page must contain a doctype tag | The difference in performance is negligible, this rule is more related to the user experience. | [Github discussion with sources](https://github.com/green-code-initiative/ecoCode/issues/103) |
| CRPYT | Python | Use numpy array instead of standard list | The use of numpy library to perform array manipulation is more energy efficient than the use of the standard list functions. | [Github discussion with measures](https://github.com/green-code-initiative/ecoCode/issues/132) |
| EC4 | Java | Avoid using global variables | Global variables do not exist in Java. | [Github discussion with sources](https://github.com/green-code-initiative/ecoCode/issues/233) |
| EC63 | Java | Unnecessarily assigning values to variables | There are already 3 native SonarQube rules for Java. | [Github discussion with sources](https://github.com/green-code-initiative/ecoCode/pull/258) |
| EC75 | Java | Concatenate Strings in loop | Optimizations on Java concatenation Strings are useless since JDK8 | [Github discussion with sources](https://github.com/green-code-initiative/ecoCode/issues/246) |

2 changes: 1 addition & 1 deletion ecocode-rules-specifications/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.ecocode</groupId>
<artifactId>ecocode-parent</artifactId>
<version>1.4.8-SNAPSHOT</version>
<version>1.5.0-SNAPSHOT</version>
</parent>

<artifactId>ecocode-rules-specifications</artifactId>
Expand Down
41 changes: 0 additions & 41 deletions ecocode-rules-specifications/src/main/rules/EC4/java/EC4.asciidoc

This file was deleted.

3 changes: 0 additions & 3 deletions ecocode-rules-specifications/src/main/rules/EC4/java/EC4.json

This file was deleted.

15 changes: 0 additions & 15 deletions ecocode-rules-specifications/src/main/rules/EC63/EC63.json

This file was deleted.

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions ecocode-rules-specifications/src/main/rules/EC75/EC75.json

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>io.ecocode</groupId>
<artifactId>ecocode-parent</artifactId>
<version>1.4.8-SNAPSHOT</version>
<version>1.5.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>ecoCode Sonar Plugins Project</name>
Expand Down