32 lines
418 B
Plaintext
32 lines
418 B
Plaintext
== Why is this an issue?
|
|
|
|
include::../description.adoc[]
|
|
|
|
=== Noncompliant code example
|
|
|
|
[source,ruby]
|
|
----
|
|
x = (y / 2 + 1) # Compliant even if the parenthesis are ignored by the compiler
|
|
|
|
if a && ((x+y > 0)) # Noncompliant
|
|
# ...
|
|
end
|
|
|
|
return ((x + 1)) # Noncompliant
|
|
----
|
|
|
|
=== Compliant solution
|
|
|
|
[source,ruby]
|
|
----
|
|
x = (y / 2 + 1)
|
|
|
|
if a && (x+y > 0)
|
|
# ...
|
|
end
|
|
|
|
return (x + 1)
|
|
----
|
|
|
|
include::../rspecator.adoc[]
|