rspec/rules/S4524/description.adoc

6 lines
506 B
Plaintext
Raw Normal View History

``++switch++`` can contain a ``++default++`` clause for various reasons: to handle unexpected values, to show that all the cases were properly considered, etc.
2021-02-02 15:02:10 +01:00
For readability purposes, to help a developer quickly spot the default behavior of a ``++switch++`` statement, it is recommended to put the ``++default++`` clause at the beginning or the end of the ``++switch++`` statement.
This rule raises an issue if the ``++default++`` clause is not the first or the last one of the ``++switch++``'s cases.