rspec/rules/S3972/why.adoc
2023-06-09 16:37:07 +02:00

16 lines
653 B
Plaintext

== Why is this an issue?
Placing an `{if}` statement on the same line as the closing `{closing}` from a preceding `{if}`, `{else}`, or `{elseif}` block can lead to confusion and potential errors.
It may indicate a missing `{else}` statement or create ambiguity for maintainers who might fail to understand that the two statements are unconnected.
The following code snippet is confusing:
include::{noncompliantCode}[]
Either the two conditions are unrelated and they should be visually separated:
include::{compliantCodeUnrelated}[]
Or they were supposed to be exclusive and you should use `{elseif}` instead:
include::{compliantCodeExclusive}[]