The Unnecessary Ruleset contains a collection of rules for unnecessary code.
Since: PMD 5.0
Priority: 4
Unnecessary parentheses should be removed.
//ParenthesizedExpression/ParenthesizedExpression
Example(s):
var x = 1; // Ok var y = (1 + 1); // Ok var z = ((1 + 1)); // Bad
Since: PMD 5.0
Priority: 3
An unnecessary Block is present. Such Blocks are often used in other languages to introduce a new variable scope. Blocks do not behave like this in ECMAScipt, and using them can be misleading. Considering removing this unnecessary Block.
//Block[not(parent::FunctionNode or parent::IfStatement or parent::ForLoop or parent::ForInLoop or parent::WhileLoop or parent::DoLoop or parent::TryStatement or parent::CatchClause)] | //Scope[not(parent::FunctionNode or parent::IfStatement or parent::ForLoop or parent::ForInLoop or parent::WhileLoop or parent::DoLoop or parent::TryStatement or parent::CatchClause)]
Example(s):
if (foo) { // Ok } if (bar) { { // Bad } }