Issue #14674 has been updated by marcandre (Marc-Andre Lafortune).


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:
1) requires opt-in (i.e. users wanting to enforce a particular style can use rubocop; others don't need to)
2) configurable (i.e. rules can be turned off or tweaked)
3) exception can be dealt with with comments in the code (e.g. # rubocop:disable Some/Rule)
4) 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?

----------------------------------------
Bug #14674: New mismatched indentations warnings?
https://bugs.ruby-lang.org/issues/14674#change-71467

* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: nobu (Nobuyoshi Nakada)
* Target version: 2.6
* ruby -v: ruby 2.6.0dev (2018-04-11 trunk 63132) [x86_64-darwin15]
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN, 2.5: UNKNOWN
----------------------------------------
I recently got a failure in my test suite because ruby head warns of indentation it considers mismatched:

```
$ ruby -w -e "
case
   when :foo
end
"
-e:3: warning: mismatched indentations at 'when' with 'case' at 2
```

I hope this is not intentional and will be fixed.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>