A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/720 below:

[java] ShortVariable should whitelist lambdas · Issue #720 · pmd/pmd · GitHub

Rule Set:
java-naming

Description:
Lambdas can be short snippets using short variable names for known parameter types (such as calling a String s, or an int i. The rule currently ignores for-loops, but doesn't consider lambdas in the same way.

Code Sample demonstrating the issue:

aListFullOfStrings.forEach(s -> s.replaceAll(" ", ""));

Possible fix (to be thoroughly tested):

[not(ancestor::ForInit)]
**[not(ancestor::LambdaExpression)]** [not(../../VariableDeclarator and ../../../LocalVariableDeclaration and ../../../../ForStatement)]
[not((ancestor::FormalParameter) and (ancestor::TryStatement))]

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4