Archive
Product
-
Avoid ‘if … else if’ constructs with missing final ‘else’ clauses
This rule applies whenever an if statement is followed by one or more else if statements; the final else if should be followed by…
-
Increment (++) and decrement (–) operators should not be used in a method call or mixed with other operators in an expression
The use of increment and decrement operators in method calls or in combination with other arithmetic operators is not recommended
-
‘switch’ statements should not be nested
Nested switch structures are difficult to understand because you can easily confuse the cases of an inner switch as belonging to an outer statement.…
-
Avoid collapsible nested ‘if’
Merging collapsible if statements increases the code’s readability.
-
The code contains one or more “with” instructions
The with statement in javascript inserts an object at the front scope chain, so any property/variable references will first try to be resolved against…
-
The code contains inner functions
While most script engines support Function Declarations within blocks it is not part of ECMAScript (see ECMA-262, clause 13 and 14). Worse implementations are…
-
The code contains at least one class defining a destructor
For several reasons detailed in references, using finalizers is not recommended.
-
The code contains too many switch cases with missing ending breaks
Ending switch branches with ‘breaks’ helps the code be more consistent, functional, and easier to debug. This allows developers in different teams navigate the…
-
The code contains modifications of buildtins objects : Object, Array or Function
Modifying builtins like Object.prototype and Array.prototype are strictly forbidden. Modifying other builtins like Function.prototype is less dangerous but still leads to hard to debug…
-
Avoid using ellipsis in functions
Functions should not be defined with a variable number of arguments. Varargs methods are a convenient way to define methods that require a variable…