Whitelist lambda parameters
This commit is contained in:
@ -1436,6 +1436,8 @@ Fields, local variables, or parameter names that are very short are not helpful
|
||||
[not(../../..[self::ForStatement])]
|
||||
(: Catch statement parameter :)
|
||||
[not(../..[self::CatchStatement])]
|
||||
(: Lambda expression parameter :)
|
||||
[not(parent::LambdaExpression or ../../..[self::LambdaExpression])]
|
||||
]]>
|
||||
</value>
|
||||
</property>
|
||||
|
@ -130,6 +130,21 @@ public class ShortVariable {
|
||||
String thisIsOk = "";
|
||||
String foo = ""; // that's ok, too, now
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
||||
<test-code>
|
||||
<description>#720 Whitelist lambda parameters</description>
|
||||
<rule-property name="minimum">1</rule-property>
|
||||
<expected-problems>0</expected-problems>
|
||||
<code><![CDATA[
|
||||
public class ShortVariable {
|
||||
public void bar() {
|
||||
String thisIsOk = a -> foo();
|
||||
String foo = (a, b) -> foo();
|
||||
String bar = (String a, Boolean b) -> foo();
|
||||
}
|
||||
}
|
||||
]]></code>
|
||||
</test-code>
|
||||
|
Reference in New Issue
Block a user