You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: RULES.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ Some are applicable for different technologies.
47
47
| GCI32 | Initialize builder/buffer with the appropriate size | If you know in advance how many characters would be appended, initialize builder/buffer with the appropriate size. They will thus never have to be resized. This saves CPU cycles and therefore consumes less energy. || ✅ | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 |[documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI32)|
48
48
| GCI35 | Using try...catch calls (on File Not Found error) | When an exception is thrown, a variable (the exception itself) is created in the catch block and destroyed at the end of the block. Creating this variable and destroying it consumes CPU cycles and RAM unnecessarily. That is why it is important not to use this construction and to prefer, as much as possible, a logical test. This new rule replace old GCI34 only for a particular use case (FileNotFoundException) |[cnumr best practices (3rd edition) BP_047 (no longer exists in edition 4)](https://www.greenit.fr/2019/05/07/ecoconception-web-les-115-bonnes-pratiques-3eme-edition/)| 🚫 | ✅ | 🚀 | ✅ | 🚀 | 🚫 | 🚫 | 🚫 | 🚫 |[documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI35)|
49
49
| GCI36 | Autoplay should be avoided for video and audio content | Autoplaying media consumes unnecessary energy, especially when users might not be actively engaging with the content. |[cnumr best practices BP_4003](https://github.com/cnumr/best-practices/blob/main/chapters/BP_4003_en.md)| 🚫 | 🚫 | ✅ | 🚫 | 🚫 | 🚫 | 🚧 | 🚫 | 🚫 |[documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI36)|
50
-
| GCI66 | Use single quote (') instead of quotation mark (") | The shape using the quotation marks allows the developer to insert variables that will be substituted at run time. But if the string does not have a variable, use quotes instead. Thus, language will not look for variables to subtituture, which will reduce the consumption of CPU cycles. |[cnumr best practices (3rd edition) BP_066 (no longer exists in edition 4)](https://www.greenit.fr/2019/05/07/ecoconception-web-les-115-bonnes-pratiques-3eme-edition/)|🚀| 🚫 |🚀| 🚫 | 🚀 | 🚫 | 🚫 | 🚫 | 🚫 |[documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI66)|
50
+
| GCI66 | Use single quote (') instead of quotation mark (") | The shape using the quotation marks allows the developer to insert variables that will be substituted at run time. But if the string does not have a variable, use quotes instead. Thus, language will not look for variables to subtituture, which will reduce the consumption of CPU cycles. |[cnumr best practices (3rd edition) BP_066 (no longer exists in edition 4)](https://www.greenit.fr/2019/05/07/ecoconception-web-les-115-bonnes-pratiques-3eme-edition/)|🚫| 🚫 |🚫| 🚫 | 🚀 | 🚫 | 🚫 | 🚫 | 🚫 |[documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI66)|
51
51
| GCI67 | Use the $i++ variable during an iteration | The $i++ form has the disadvantage of generating a tem-porary variable during incrementation, which is not the case with the ++$i form. |[cnumr best practices (3rd edition) BP_067 (no longer exists in edition 4)](https://www.greenit.fr/2019/05/07/ecoconception-web-les-115-bonnes-pratiques-3eme-edition/)| ✅ | ✅ | 🚀 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 | 🚫 |[documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI67)|
52
52
| GCI69 | Calling a loop invariant function in a loop condition | Avoid calling loop invariant functions in loop conditions. |[cnumr best practices (3rd edition) BP_069 (no longer exists in edition 4)](https://www.greenit.fr/2019/05/07/ecoconception-web-les-115-bonnes-pratiques-3eme-edition/)| ✅ | ✅ | 🚀 | 🚫 | 🚀 | ✅ | 🚫 | 🚫 | 🚫 |[documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI69)|
53
53
| GCI72 | Perform an SQL query inside a loop | Servers are optimized to process multiple selections, insertions, or changes in a single query or transaction. consume CPU cycles, RAM, and bandwidth unnecessarily. |[cnumr best practices (3rd edition) BP_072](https://github.com/cnumr/best-practices/blob/main/chapters/BP_072_fr.md)| ✅ | ✅ | 🚀 | ✅ | 🚀 | ✅ | 🚫 | 🚫 | 🚫 |[documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/tree/main/src/main/rules/GCI72)|
@@ -185,6 +185,8 @@ This table lists rules proposed by the community but refused or/and deleted in c
185
185
| GCI34 | Python | Using try...catch...finally calls | Implementation is too simple (only detection of presence of "try" statement) AND replaced by `GCI35` rule | Github discussion with measures : [general/java](https://github.com/green-code-initiative/creedengo-rules-specifications/pull/128) / [python](https://github.com/green-code-initiative/creedengo-python/pull/6)|
186
186
| GCI34 | PHP | Using try...catch...finally calls | Implementation is too simple (only detection of presence of "try" statement) AND replaced by `GCI35` rule | Github discussion with measures : [general/java](https://github.com/green-code-initiative/creedengo-rules-specifications/pull/128) / [php](https://github.com/green-code-initiative/creedengo-php/pull/10)|
187
187
| GCI63 | 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/creedengo-rules-specifications/pull/258)|
188
+
| GCI66 | Java | Use single quote (') instead of quotation mark (") | Finally, not applicable for Java | Discussed with core team |
189
+
| GCI66 | JS | Use single quote (') instead of quotation mark (") | No difference in performance | Discussed with core team |
188
190
| GCI66 | Python | Use single quote (') instead of quotation mark (") | Finally, not applicable for Python |[Github discussion with sources](https://github.com/green-code-initiative/creedengo-python/issues/4)|
189
191
| GCI66 | PHP | Use single quote (') instead of quotation mark (") | Finally, not applicable for PHP |[Github discussion with sources](https://github.com/green-code-initiative/creedengo-php/issues/58)|
190
192
| GCI69 | Python | Calling a loop invariant function in a loop condition | Finally, not applicable for Python |[Github discussion with sources](https://github.com/green-code-initiative/creedengo-python/issues/21)|
0 commit comments