Since: PMD 5.0
Unnecessary parentheses should be removed.
//ParenthesizedExpression/ParenthesizedExpression
var x = 1; // Ok
var y = (1 + 1); // Ok
var z = ((1 + 1)); // Bad
Since: PMD 5.0
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)]
if (foo) {
// Ok
}
if (bar) {
{
// Bad
}
}