Also wondering if UnnecessaryBlock should be ported from JS to Java
Originally posted by @zbynek in #6523 (comment)
Proposed Rule Name: UnnecessaryBlock
Proposed Category: Code Style.
Description: A block is unnecessary, if it is
a) not a class body/method body/body of a control statement/initializer block/... AND
b) not used to restrict the scope of a variable.
Code Sample:
public class Foo {
public boolean bad(Object o) {
{
if(obj == null) return false;
}
return true;
}
public boolean good(Object o) {
if(obj == null) return false;
return true;
}
}
Originally posted by @zbynek in #6523 (comment)
Proposed Rule Name: UnnecessaryBlock
Proposed Category: Code Style.
Description: A block is unnecessary, if it is
a) not a class body/method body/body of a control statement/initializer block/... AND
b) not used to restrict the scope of a variable.
Code Sample: