rspec/rules/S2681/description.adoc

8 lines
612 B
Plaintext
Raw Normal View History

2021-01-27 13:42:22 +01:00
Curly braces can be omitted from a one-line block, such as with an ``++if++`` statement or ``++for++`` loop, but doing so can be misleading and induce bugs.
2020-06-30 12:48:07 +02:00
2021-02-02 15:02:10 +01:00
2020-06-30 12:48:07 +02:00
This rule raises an issue when the whitespacing of the lines after a one line block indicates an intent to include those lines in the block, but the omission of curly braces means the lines will be unconditionally executed once.
2021-02-02 15:02:10 +01:00
Note that this rule considers tab characters to be equivalent to 1 space. If you mix spaces and tabs you will sometimes see issues in code which look fine in your editor but are confusing when you change the size of tabs.