rspec/rules/S1965/java/rule.adoc

31 lines
802 B
Plaintext
Raw Normal View History

== Why is this an issue?
A conditional operator is sometimes cluttering readability, if one of the operand is a boolean literal it can be simplified in a boolean expression :
=== Compliant solution
2022-02-04 17:28:24 +01:00
[source,java]
----
boolean a = condition || exp;
boolean a = !condition && exp;
boolean a = !condition || exp;
boolean a = condition && exp;
----
ifdef::env-github,rspecator-view[]
'''
== Comments And Links
(visible only on this page)
=== duplicates: S1125
=== on 22 Aug 2014, 08:37:01 Nicolas Peru wrote:
As discussed yesterday, feel free to challenge it.
=== on 22 Aug 2014, 19:46:19 Ann Campbell wrote:
\[~nicolas.peru] I can't think of a way to word this that's not a pure duplicate of RSPEC-1125. I think we should just roll this into that rule. WDYT?
endif::env-github,rspecator-view[]