aibolit
aibolit copied to clipboard
P20_7 Var declaration distance: count statemtnts instead of lines
I think P20_7
pattern may be more useful if it counts statements instead of lines, e.g. this code:
final CompletableFuture<Boolean> exists = new CompletableFuture<>();
object.asyncCall(() -> {
// few lines of code here
exists.complete(result);
});
return exists;
Has only one statement between returning the variable and declaration, but it has multiple lines, so it's a candidate for P20_7
. I think amount of lines doesn't really make readability worse, but amount of statements does.
@acheshkov/z please, pay attention to this issue
seems we count ncss, not lines of code. But idea is good.
@acheshkov @aravij Is it worth implementing it?