rspec/rules/S1145/description.adoc

11 lines
559 B
Plaintext
Raw Normal View History

2021-01-27 13:42:22 +01:00
``++if++`` statements with conditions that are always false have the effect of making blocks of code non-functional. ``++if++`` statements with conditions that are always true are completely redundant, and make the code less readable.
2020-06-30 12:47:33 +02:00
2021-02-02 15:02:10 +01:00
2020-06-30 12:47:33 +02:00
There are three possible causes for the presence of such code:
2020-06-30 12:47:33 +02:00
* An if statement was changed during debugging and that debug code has been committed.
* Some value was left unset.
* Some logic is not doing what the programmer thought it did.
2021-01-27 13:42:22 +01:00
In any of these cases, unconditional ``++if++`` statements should be removed.