[ruby-core:86526] [Ruby trunk Bug#14674] New mismatched indentations warnings?

From: zverok.offline@...
Date: 2018-04-12 07:23:31 UTC
List: ruby-core #86526
Issue #14674 has been updated by zverok (Victor Shepelev).


I agree with @marcandre. I used to prefer "indented when" style once, and still think it is pretty acceptable. 

When Ruby has introduced interpreter warnings about mismatched indentation, I thought it is a good thing, allowing to catch obvious typos like this:

```ruby
def foo
  bar.each do 
end # forgot to close do/end of "each", hard to spot after a large methods

#...

# Without that warning, the interpreter error about missing "end" at the very end of the file,
# far from the actual point of error
```

But for being useful this way, the interpreter should report _only_ absolutely obvious and unambiguous typos, not "non-preferred style". Ruby is too mature to introduce hardcoded style preferences, I believe.

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

* 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>

In This Thread

Prev Next