// rule category
Refactor for clarity; extract functions; simplify control flow.
141 rules · 7 critical · 31 high · 103 low
Check if loops use equality operators (== or !=) in termination conditions. These can lead to infinite loops if the condition is never met exactly. Instead, use relational operators like < or > for safer loop termination.
Detect occurrences of the comma operator in expressions. The comma operator can make code harder to read and debug, as it executes two expressions but only returns the last one. Suggest alternative structures for better readability.
Always specify access levels (public, private, protected) when declaring class properties and methods. Don’t use the old `var` keyword for properties. Explicit visibility clarifies intent and prevents unintended access.
Check if the code imports individual classes or functions instead of the entire module. Directly importing specific classes or functions can clutter the titlespace and increase naming conflicts. Recommend importing the module and referencing items explicitly.