44 lines
1006 B
Plaintext
44 lines
1006 B
Plaintext
![]() |
=== Related: RSPEC-3516
|
||
|
|
||
|
=== On 2015-12-01T11:08:13Z Michael Gumowski Wrote:
|
||
|
LGTM!
|
||
|
|
||
|
=== On 2016-01-05T10:07:18Z Nicolas Peru Wrote:
|
||
|
\[~ann.campbell.2] I kinda lack the definition of what is a constant and limitation of cases to be 100% sure of the scope of this rule.
|
||
|
|
||
|
What about the following for instance :
|
||
|
|
||
|
----
|
||
|
int foo(boolean a) {
|
||
|
if(a) {
|
||
|
return 12;
|
||
|
}
|
||
|
return 12;
|
||
|
}
|
||
|
----
|
||
|
this is actually detected by intellij idea but the following is not :
|
||
|
|
||
|
----
|
||
|
int foo(boolean a) {
|
||
|
int b = 12;
|
||
|
if(a) {
|
||
|
return b;
|
||
|
}
|
||
|
return b;
|
||
|
}
|
||
|
----
|
||
|
|
||
|
IMO first implementation should be limited to method with only one return statement and a constant with the following definition:
|
||
|
|
||
|
A constant is a literal or a static final primitive variable.
|
||
|
|
||
|
|
||
|
Then we might want to improve this using SE engine to detect cases like I described.
|
||
|
|
||
|
|
||
|
WDYT ?
|
||
|
|
||
|
=== On 2016-01-05T16:21:17Z Ann Campbell Wrote:
|
||
|
Uhm... I thought it was evident from the examples [~nicolas.peru] that that's all that was expected.
|
||
|
|