I strongly believe that it is not Ruby's parser job to warn us about styling, especially if there's no strong reason to suspect that it's a programmer error.
I realize rubocop is not official or part of MRI, but it has the required qualities to do this:
- requires opt-in (i.e. users wanting to enforce a particular style can use rubocop; others don't need to)
- configurable (i.e. rules can be turned off or tweaked)
- exception can be dealt with with comments in the code (e.g. # rubocop:disable Some/Rule)
- warning/errors are generated when desired, not all the time (e.g. during tests/manually, but not when actually running the code)
rubocop can even autocorrect according to these desired specs. Ruby MRI has none of these features!
Note that rubocop already supports Layout/CaseIndentation
, can issue warning, error, or ignore it. It supports two different alignment styles, and supports any desired indent.
In short: warnings should be kept to a strict minimum in MRI, and enforcing a style for case/when
is a terrible use of a warning.
Would you consider reverting this, or asking Matz?