Skip to content

Latest commit

 

History

History
198 lines (183 loc) · 136 KB

RULES.md

File metadata and controls

198 lines (183 loc) · 136 KB

Rules

Rules support matrix by techno

This matrix lists all the rules identified as implementable within the standard creedengo plugin.

Some are applicable for different technologies.

  • ✅ Rule included in current version of creedengo
  • 🚧 Rule implementation in progress
  • 🚀 Rule to implement
  • ❓ Rule to analyze for applicability
  • 🚫 Non applicable rule
Rule key Name Description Reference/Validation Java Php JS Python Rust C# HTML Mobile Android Mobile iOS Source reference
CRJVM206 Avoid N+1 selects problem 🚧 ❓ ❓ ❓ ❓ ❓ 🚫 🚫 🚫
CRJVM207 Customer data must have end-of-life information 🚧 ❓ ❓ ❓ ❓ ❓ ❓ 🚫 🚫
CRJVM??? Persistence Java : Avoid Joints on non indexed columns 🚧 ❓ ❓ ❓ ❓ ❓ 🚫 🚫 🚫
GCI1 Calling a Spring repository inside a loop or a stream The use of Spring repository in a loop or a stream induces unnecessary calculations by the CPU and therefore superfluous energy consumption. ✅ 🚫 🚫 🚫 🚫 🚫 🚫 🚫 🚫 documentation
GCI2 Multiple if-else statements Using too many conditional if-else statements will impact performance since JVM will have to compare the conditions. Prefer using a switch statement instead of multiple if-else if possible, or refactor your code to reduce conditonnal statements on the same variable. Switch statement has a performance advantage over if – else. ✅ ✅ 🚀 🚫 🚀 🚀 🚫 🚫 🚫 documentation
GCI3 Getting the size of the collection in the loop 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. ✅ ✅ 🚀 🚫 🚀 🚫 🚫 🚫 🚫 documentation
GCI4 Use global variables When using a global variable, the interpretation engine must check: 1) that it exists in the current scope, in the one above, etc. ; 2) the variable has a value; 3) ... To avoid all these checks, it is often possible to pass the useful variables as arguments of routines, making them local. This process saves computational time (CPU cycles). cnumr best practices (3rd edition) BP_050 (no longer exists in edition 4) 🚫 ✅ 🚀 ✅ 🚀 🚫 🚫 🚫 🚫 documentation
GCI5 Usage of preparedStatement instead of Statement 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. ✅ 🚫 🚫 🚫 🚫 🚫 🚫 🚫 🚫 documentation
GCI7 Rewrite native getter/setters Overloading them lengthens the compilation and execution times of these methods, which are usually much better optimized by the language than by the developer. cnumr best practices (3rd edition) BP_062 (no longer exists in edition 4) 🚫 🚫 🚀 ✅ 🚀 🚫 🚫 🚫 🚫 documentation
GCI9 Importing everything from library should be avoided ESLint key : @creedengo/no-import-all-from-library /// type : Common ❓ ❓ ✅ ❓ ❓ ❓ 🚫 🚫 🚫 documentation
GCI10 Use unoptimized vector images Less heavy SVG images using less bandwidth cnumr best practices (3rd edition) BP_036 🚀 🚀 🚀 ✅ 🚀 🚫 ❓ 🚫 🚫 documentation
GCI11 Multiple access of same DOM element should be limited ESLint key : @creedengo/no-multiple-access-dom-element /// type : Front-end 🚫 ❓ ✅ 🚫 🚫 ❓ 🚫 🚫 🚫 documentation
GCI12 Multiple style changes should be batched ESLint key : @creedengo/no-multiple-style-changes /// type : Front-end 🚫 ❓ ✅ 🚫 🚫 ❓ 🚫 🚫 🚫 documentation
GCI13 API collections should be preferred with pagination ESLint key : @creedengo/prefer-collections-with-pagination /// type : Back-end ❓ ❓ ✅ ❓ ❓ ❓ 🚫 🚫 🚫 documentation
GCI22 The use of methods for basic operations Using methods for basic operations consumes additional system resources. The interpreter must in effect and solve the objects and then the methods, just to carry out these simple operations of the language. cnumr best practices (3rd edition) BP_048 (no longer exists in edition 4) 🚫 🚫 🚀 ❓ 🚀 🚫 🚫 🚫 🚫 documentation
GCI24 Returned SQL results should be limited ESLint key : @creedengo/limit-db-query-results /// type : Back-end 🚧 🚀 ✅ ✅ 🚀 🚀 🚫 🚫 🚫 documentation
GCI25 Images should not have an empty source attribute ESLint key : @creedengo/no-empty-image-src-attribute /// type : Front-end ❓ ❓ ✅ ❓ ❓ ❓ 🚀 🚫 🚫 documentation
GCI26 Shorthand CSS notations should be used to reduce stylesheets size ESLint key : @creedengo/prefer-shorthand-css-notations /// type : Front-end ❓ ❓ ✅ ❓ ❓ ❓ 🚫 🚫 🚫 documentation
GCI27 Usage of system.arraycopy to copy arrays Programs spend most of the time in loops. These can be resource consuming, especially when they integrate heavy processing (IO access). Moreover, the size of the data and processing inside the loops will not allow full use of hardware mechanisms such as the cache or compiler optimization mechanisms. ✅ 🚫 🚫 🚫 🚫 🚫 🚫 🚫 🚫 documentation
GCI28 Optimize read file exceptions ✅ 🚫 🚫 🚫 🚫 🚫 🚫 🚫 🚫 documentation
GCI29 CSS animations should be avoided ESLint key : @creedengo/avoid-css-animations /// type : Front-end ❓ ❓ ✅ ❓ ❓ ❓ 🚫 🚫 🚫 documentation
GCI30 Print stylesheet should be provided ESLint key : @creedengo/provide-print-css /// type : Front-end ❓ ❓ ✅ ❓ ❓ ❓ 🚫 🚫 🚫 documentation
GCI31 Lighter formats should be used for image files ESLint key : ... /// type : ... 🚧 ❓ ✅ ❓ ❓ ❓ 🚀 🚫 🚫 documentation
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
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) 🚫 ✅ 🚀 ✅ 🚀 🚫 🚫 🚫 🚫 documentation
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 🚫 🚫 ✅ 🚫 🚫 🚫 🚧 🚫 🚫 documentation
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) 🚫 🚫 🚫 🚫 🚀 🚫 🚫 🚫 🚫 documentation
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) 🚫 ✅ 🚀 🚫 🚫 🚫 🚫 🚫 🚫 documentation
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) ✅ ✅ 🚀 🚫 🚀 ✅ 🚫 🚫 🚫 documentation
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 ✅ ✅ 🚀 ✅ 🚀 ✅ 🚫 🚫 🚫 documentation
GCI74 Write SELECT * FROM The database server must resolve the fields based on the schema. If you are familiar with the diagram, it is strongly recommended to name the fields. cnumr best practices (3rd edition) BP_074 (no longer exists in edition 4) ✅ ✅ 🚀 ✅ 🚀 🚀 🚫 🚫 🚫 documentation
GCI75 Don't concatenate strings in loops Avoid repeated string allocations and consider using a StringBuilder instead. 🚫 ❓ ❓ ❓ ❓ ✅ 🚫 🚫 🚫 documentation
GCI76 Usage of static collections Avoid usage of static collections. If you want to use static collections make them final and create for example a singleton if needed containing the collections. The static fields are more complicated for the Garbage Collector to manage and can lead to memory leaks. ✅ 🚫 🚫 🚫 🚫 🚫 🚫 🚫 🚫 documentation
GCI77 Usage Pattern.compile() in a non-static context Avoid using Pattern.compile() in a non-static context. This operation requires a non negligible amount of computational power, Using a single match saves CPU cycles and RAM consumption. ✅ 🚫 🚫 🚫 🚫 🚫 🚫 🚫 🚫 documentation
GCI78 Const parameter in batch update Don't set const parameter in batch update => Put its in query. Creating this parameter and destroying it consumes CPU cycles and RAM unnecessarily. ✅ 🚫 🚫 🚫 🚫 🚫 🚫 🚫 🚫 documentation
GCI79 Free resources try-with-resources Statement needs to be implemented for any object that implements the AutoCloseable interface, it save computer resources. ✅ 🚫 🚫 🚫 🚫 🚫 🚫 🚫 🚫 documentation
GCI81 Specify struct layouts When possible, specify struct layouts to optimize their memory footprint 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 documentation
GCI82 Make variable constant A variable is never reassigned and can be made constant ✅ 🚀 🚀 🚫 🚀 ✅ 🚫 🚫 🚫 documentation
GCI83 Replace Enum ToString() with nameof When no string format is applied, use nameof instead of ToString() for performance 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 documentation
GCI84 Avoid async void methods Use async Task methods instead, for performance, stability and testability 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 documentation
GCI85 Make type sealed Seal types that don't need inheritance for performance reasons 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 documentation
GCI86 GC.Collect should not be called In most cases, the cost of calling GC.Collect far outweighs the benefits 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 documentation
GCI87 Use collection indexer Collection indexers should be used instead of Linq, when available 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 documentation
GCI88 Dispose resource asynchronously Resources that implement IAsyncDisposable should be disposed asynchronously 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 documentation
GCI89 Avoid using function cache without limit If a function has decorators without max size cache, the program will store unlimited data ❓ ❓ ❓ ✅ ❓ ❓ ❓ 🚫 🚫 documentation
GCI90 Use Cast instead of Select to cast Cast is optimized for this scenario and should be used ❓ ❓ ❓ ❓ ❓ ✅ ❓ 🚫 🚫 documentation
GCI91 Use filter feature before sort elements Filter elements before sorting them for improved efficiency 🚧 ❓ ❓ 🚀 ❓ ✅ ❓ 🚫 🚫 documentation
GCI92 Use string.Length instead of comparison with empty string 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. 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 documentation
GCI93 Return Task directly Consider returning a Task directly instead of a single await ❓ ❓ ❓ ❓ ❓ ✅ ❓ 🚫 🚫 documentation
GCI94 Use orElseGet instead of orElse Parameter of orElse() is evaluated, even when having a non-empty Optional. Supplier method of orElseGet passed as an argument is only executed when an Optional value isn’t present. Therefore, using orElseGet() will save computing time. Optimized use of Java Optional Else ✅ 🚫 🚫 🚫 🚫 🚫 🚫 🚫 🚫 documentation
GCI95 Avoid querying SQL columns that are not used When a database is queried without an ORM, every column that is queried should be used afterward somewhere in the function. cnumr best practices (3rd edition) BP_075 🚧 ❓ ❓ ❓ ❓ ❓ ❓ 🚫 🚫 documentation
GCI96 Data / AI : Pandas - Avoid Reading Unnecessary Columns in CSV Files Reading CSV files without explicitly specifying which columns to load leads to unnecessary data loading and increases memory and energy consumption. 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 🚫 🚫 documentation
GCI97 Optimize square computation (scalar vs vectorized method) In Python, if you want to square x, you can do x*x or x**2. ❓ ❓ ❓ ✅ ❓ ❓ ❓ 🚫 🚫 documentation
GCI98 Avoid raising Runtime Exceptions when a check is possible You should not catch RuntimeException. They produce large objects and represent a problem in the program that should be fixed, not handled. Unchecked Exceptions The Controversy (9.3. Les classes Exception, RunTimeException et Error)[https://www.jmdoudoux.fr/java/dej/chap-exceptions.htm#exceptions-3] 🚧 🚫 🚫 🚫 🚫 🚫 🚫 🚫 🚫 documentation
GCI99 Data : Avoid CSV Format The Parquet format is faster to write to, lighter in weight and faster to read data from. It is suitable for use cases where there would be a lot of data I/O, especially with Cloud storage. 🚀 🚀 🚀 ✅ 🚀 🚀 🚀 🚫 🚫 documentation
GCI100 AI : Wrap PyTorch Inference in torch.no_grad() Using a PyTorch model in evaluation mode without wrapping inference in torch.no_grad() leads to unnecessary gradient tracking 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 🚫 🚫 documentation
GCI101 AI : Avoid Bias in Conv Layers Before Batch Norm Disable bias in convolutional layers when it's followed by a batch norm layer 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 🚫 🚫 documentation
GCI102 AI : Use pinned memory on DataLoader when using GPU This rule applies to PyTorch data loading, where the use of pinned memory can significantly optimize data transfer between CPU and GPU. 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 🚫 🚫 documentation
GCI103 Don't use .items() to iterate over a dictionary when only keys or values are needed Avoid using .items() if you only use the key or the value, as this creates an unnecessary tuple, leading to increased memory allocation and slower execution. ❓ ❓ ❓ ✅ ❓ ❓ ❓ 🚫 🚫 documentation
GCI104 Data / AI : PyTorch - Create tensors directly from Torch In PyTorch, prefer creating tensors directly using torch.rand, torch.tensor, or other Torch methods instead of converting from NumPy arrays. Avoid using torch.tensor(np.random.rand(...)) or similar patterns when the same result can be achieved directly with PyTorch. 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 🚫 🚫 documentation
GCI105 Python String Concatenation Python String Concatenation - Use Join Instead or f-Strings instead of += 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 🚫 🚫 documentation
GCI106 Avoid Square Root Operations In Loop Using scalar math.sqrt (or numpy.sqrt on individual values) inside loops leads to inefficient code 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 🚫 🚫 documentation
GCI107 Data : Avoid Iterative Matrix Operations Use vectorization by the usage of the built-in functions of TensorFlow, NumPy or Pandas 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 🚫 🚫 documentation
GCI108 Prefer Append Left When you want to insert an element at the beginning of a list, it's better to use a deques or a double linkedlist. ❓ ❓ ❓ ✅ ❓ ❓ ❓ 🚫 🚫 documentation
GCI109 Avoid Using Exceptions for Control Flow Using exceptions for control flow (loops, defaults, branching) is expensive in Python. Prefer idiomatic alternatives like dict.get(), enumerate(), getattr() with defaults, or proper iteration patterns. 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 🚫 🚫 documentation
GCI110 Python: Avoid wildcard imports (from module import *) Wildcard imports bind many names and run module top‑level init, slightly increasing import time and memory. Prefer explicit named imports 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 🚫 🚫 documentation
GCI111 Logging format interpolation When logging with formatted string, prefer using %s with kwargs, which will be deferred until it cannot be avoided, instead of immediate formatter .format() or f"". 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 🚫 🚫 documentation
GCI112 Reduce memory footprint of dataclasses Using slots can be an effective way to optimize memory usage in Python classes and improve the performance of memory-intensive applications. It is a minor remediation cost to add slots in class definitions and can have significant benefits in terms of memory efficiency. 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 🚫 🚫 documentation
GCI113 Prefer XGBoost to RandomForest Using XGBoost offers a more optimized and eco-friendly alternative with competitive accuracy than RandomForest. 🚫 🚫 🚫 🚀 🚫 🚫 🚫 🚫 🚫 documentation
GCI114 Avoid range(len()) pattern Avoid the range(len()) pattern. Prefer direct iteration or enumerate() which avoids costly index-based access. 🚫 🚫 🚫 🚀 🚫 🚫 🚫 🚫 🚫 documentation
GCI115 To use list comprehension instead for loop in simple iterations Use list comprehension instead for loop in simple iterations 🚫 ❓ ❓ 🚀 ❓ ❓ ❓ 🚫 🚫 documentation
GCI203 Detect unoptimized file formats When it is possible, to use svg format image over other image format 🚧 🚀 🚀 ✅ 🚀 🚀 🚫 🚫 🚫 documentation
GCI404 Avoid list comprehension in iterations Use generator comprehension instead of list comprehension in for loop declaration 🚫 🚫 🚫 ✅ 🚫 🚫 🚫 🚫 🚫 documentation
GCI500 Batch: Sensor Coalesce Use maxReportLatencyUs to batch sensor events and reduce CPU wake-ups. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI501 Batch: Job Coalesce Use JobScheduler to batch network operations and reduce radio wake-ups. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI502 Bottleneck: Internet In The Loop Avoid network calls inside loops to reduce radio usage. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI503 Bottleneck: Wifi Multicast Lock Release Wifi multicast locks to allow the radio to sleep. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI504 Bottleneck: Uncompressed Data Transmission Compress data before transmission to save bandwidth and energy. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI505 Idleness: Keep Screen On (addFlags) Avoid keeping the screen on via addFlags to save battery. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ ✅ documentation
GCI506 Idleness: Keep Screen On (setFlags) Avoid keeping the screen on via setFlags to save battery. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI507 Idleness: Keep Cpu On Avoid keeping the CPU on with PARTIAL_WAKE_LOCK. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI508 Idleness: Durable Wake Lock Release wake locks promptly to allow the device to sleep. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI509 Idleness: Rigid Alarm Use inexact alarms to allow the system to batch wake-ups. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ ✅ documentation
GCI510 Idleness: Continuous Rendering Avoid RENDERMODE_CONTINUOUSLY for OpenGL surfaces. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI511 Idleness: Keep Voice Awake Release voice recognition resources when not needed. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI512 Leakage: Camera Leak Release camera resources when no longer needed. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI513 Leakage: Location Leak Stop location updates when no longer needed. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ ✅ documentation
GCI514 Leakage: SensorManager Leak Unregister sensor listeners when no longer needed. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ ✅ documentation
GCI515 Leakage: Media Leak (MediaRecorder) Release MediaRecorder when no longer needed. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ ✅ documentation
GCI516 Leakage: Media Leak (MediaPlayer) Release MediaPlayer when no longer needed. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI517 Optimized API: Fused Location Use FusedLocationProviderClient instead of raw GPS. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI518 Optimized API: Bluetooth Low-Energy Use BLE APIs instead of classic Bluetooth. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI519 Power: Charge Awareness Monitor battery level and adapt behavior accordingly. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ ✅ documentation
GCI520 Power: Save Mode Awareness Detect power save mode and reduce activity. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ ✅ documentation
GCI521 Sobriety: Thrifty Motion Sensor Use appropriate sensor delay for motion sensors. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI522 Sobriety: Brightness Override To avoid draining the battery, iOS and Android devices adapt the brightness of the screen depending on the environment light. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ ✅ documentation
GCI523 Sobriety: Thrifty Geolocation (minTime) High-precision geolocation typically requires more power from the device's GPS hardware. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI524 Sobriety: Thrifty Geolocation Criteria Use appropriate accuracy criteria for geolocation. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ ✅ documentation
GCI525 Sobriety: Thrifty BLE (setAdvertiseMode) Use low-power BLE advertising mode. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI526 Sobriety: Thrifty BLE (requestConnectionPriority) Use balanced BLE connection priority. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI527 Sobriety: Thrifty Geolocation (minDistance) Set minDistance > 0 for location updates. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI528 Sobriety: Vibration Free Avoid using the device vibrator. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI529 Sobriety: Thrifty Notification Avoid vibration/sound in notifications. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI530 Sobriety: Torch Free Turning on the torch mode programmatically must absolutely be avoided because the flashlight is one of the most energy-intensive component. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ ✅ documentation
GCI531 Sobriety: High Frame Rate Avoid requesting high frame rates. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI532 Privacy: Google Tracker Avoid using Google tracking services. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI533 GDPR: Google Ads Consent Ensure Google Ads consent is properly implemented for GDPR compliance. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ ✅ documentation
GCI534 Privacy: Tracking Id Avoid tracking users via TelephonyManager#getDeviceId(). 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ ✅ documentation
GCI540 Batch: Service Boot Time (XML) Avoid starting services at device boot to reduce startup energy. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI541 Idleness: Keep Screen On (XML) Avoid android:keepScreenOn="true" in layouts. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI542 Idleness: Keep Cpu On (XML) Avoid WAKE_LOCK permission when not needed. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI543 Power: Companion In Background (XML) Avoid requesting BIND_COMPANION_DEVICE_SERVICE. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI544 Power: Ignore Battery Optimizations (XML) Avoid REQUEST_IGNORE_BATTERY_OPTIMIZATIONS. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI545 Power: Charge Awareness (XML) Declare battery-related broadcast receivers. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI546 Power: Save Mode Awareness (XML) Declare power save mode broadcast receivers. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI547 Sobriety: Dark UI (Bright Colors) Avoid bright colors in dark theme layouts. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI548 Sobriety: Dark UI (Theme) Provide a dark theme for the app. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
GCI549 Sobriety: Hardware Acceleration (XML) Disable hardware acceleration when not needed to reduce RAM usage. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ 🚫 documentation
Use official social media sharing buttons These JavaScript plugins are very resource-intensive: to work, they require a large number of requests and download heavy files. It is better to prefer direct links. cnumr best practices (3rd edition) BP_019 🚫 🚫 🚀 🚫 🚫 🚫 🚀 🚫 🚫
Non-grouped similar CSS declarations When multiple Document Object Model (DOM) elements have common CSS properties, declare them together in the same style sheet. This method reduces the weight of CSS. cnumr best practices (3rd edition) BP_025 🚫 🚫 🚧 🚫 🚫 🚫 🚫 🚫 🚫
Non-standard fonts used Prefer standard fonts, as they are already present on the user's computer, so they do not need to download them. This saves bandwidth, while speeding up the display of the site. cnumr best practices (3rd edition) BP_029 🚫 🚫 🚫 🚫 🚫 🚫 🚫 🚫 🚫
Non-outsourced CSS and Javascript If you include CSS or JavaScript code in the body of the HTML file, while the HTML file is used by several pages (or even the entire site), this code must be transferred for each page requested by the user, which increases the volume of data transmitted. cnumr best practices (3rd edition) BP_032 🚫 🚫 🚀 🚫 🚫 🚫 🚀 🚫 🚫
Resize images browser-side Do not resize images using the HEIGHT and WIDTH attributes of the HTML code. This approach requires transferring these images to their original size, wasting bandwidth and CPU cycles. cnumr best practices (3rd edition) BP_034 🚫 🚫 🚧 🚫 🚫 🚫 🚀 🚫 🚫
Modify the DOM when traversing it Modifying the DOM (Document Object Model) as you traverse it can lead to situations where the loop becomes very resource-intensive, especially CPU cycles. cnumr best practices (3rd edition) BP_041 🚫 🚫 🚧 🚫 🚫 🚫 🚫 🚫 🚫
Edit DOM elements to make it invisible When an element of the Document Object Model (DOM) needs to be modified by several properties, each change in style or content will generate a repaint or reflow. cnumr best practices (3rd edition) BP_042 🚫 🚫 🚀 🚫 🚫 🚫 🚫 🚫 🚫
GCI535 Use native Intl.NumberFormat to format numbers There's no need to use a library to display formatted numbers in a recent browser. Use Intl.NumberFormat for that use case. 🚫 🚫 🚧 🚫 🚫 🚫 🚫 🚫 🚫 documentation
GCI536 Avoid polling without checking page visibility Polling loops that run regardless of the page visibility state waste energy continuously 🚫 🚫 🚀 🚫 🚫 🚫 🚫 🚫 🚫 documentation
GCI603 Animation Free Animations play a crucial role in creating a dynamic UI but should be checked for unnecessary usage to avoid draining the battery. 🚫 🚫 🚫 🚫 🚫 🚫 🚫 🚫 ✅ documentation

Rules to be reworked / measured / clarified

This table lists rules proposed by the community but they have to be reworked / measured / clarified before being implemented in creedengo plugins. (Issues and PR are closed, but they can be reopen once rework launched)

Rule key Language Name Description Invalidation
CRJVM204 Java Detect unoptimized file formats We have to clarify and rework this rule for Java before accepting the implementation Github discussion - issue
Github discussion - PR
GCI22 Java The use of methods for basic operations We have to measure this rule for Java before accepting the implementation Github discussion - issue
Github discussion - PR
GCI22 PHP The use of methods for basic operations We have to measure this rule for PHP before accepting the implementation Github discussion - issue
GCI53 Java Using arrays in foreach loops No good arguments and not enough green measures. Github discussion with sources
GRSP0007 PHP Prefer using foreach We have to clarify and measure this rule for PHP before accepting the implementation Github discussion - PR
GRSP0008 PHP Avoid using relative path We have to clarify and measure this rule for PHP before accepting the implementation Github discussion - PR
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
Github discussion - PR

Deprecated rules

This table lists rules proposed by the community but deprecated in creedengo 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
GCI2 Python Avoid multiple if else statements This optimization is not valid for Python Github discussion with sources
GCI67 Java Use the $i++ variable during an iteration After checking the generated code by the JVM for both ++i and I++, it reveals that the JVM bytcode is exactly the same Github discussion with sources 2nd Github discussion

Refused / Deleted rules

This table lists rules proposed by the community but refused or/and deleted in creedengo 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
CRJVM205 Java Force usage of FetchType LAZY for collections on JPA entities The rule already exists inside SonarQube : built-in rule "java:S6904" Github discussion with analysis
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
GCI4 Java Avoid using global variables Global variables do not exist in Java. Github discussion with sources
GCI8 JavaScript Avoid using high accuracy geolocation The rule has been merged with the rule GCI523 Github discussion with sources
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 / python
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 / php
GCI63 Java Unnecessarily assigning values to variables There are already 3 native SonarQube rules for Java. Github discussion with sources
GCI66 Java Use single quote (') instead of quotation mark (") Finally, not applicable for Java Discussed with core team
GCI66 JS Use single quote (') instead of quotation mark (") No difference in performance Discussed with core team
GCI66 Python Use single quote (') instead of quotation mark (") Finally, not applicable for Python Github discussion with sources
GCI66 PHP Use single quote (') instead of quotation mark (") Finally, not applicable for PHP Github discussion with sources
GCI69 Python Calling a loop invariant function in a loop condition Finally, not applicable for Python Github discussion with sources
GCI75 Java Don't concatenate strings in loops Optimizations on Java concatenation Strings are useless since JDK8 Github discussion with sources
GCI82 Java Make variable constant Constant notion doesn't exist in Python Github discussion with sources