문제

RuboCop integrates nicely with emacs and tells me when a line is not indented as RuboCop would like. The Emacs ruby modes I've tried do not indent exactly as RuboCop would like, so I just accept that there will be a few squiggly lines letting me know something isn't indented per that style.

Since RuboCop knows how each line should be indented can it emit something that enumerates how each line should be indented? For example given code like this:

class Foo
  def bar
    puts 'hi'
 ...

Could RuboCop output something like below?

0:0
1:2
2:4

It could be used as input to an Emacs ruby mode to automatically indent lines.

도움이 되었습니까?

해결책

I'm one of RuboCop's developers and an Emacs user/contributor as well. While RuboCop can't show you the correct indentation levels, so you can feed it to ruby-mode (for instance), upgrading to the unreleased Emacs 24.4 will probably solve your problems. There were a ton of ruby-mode indentation (and many other) bugs in Emacs 24.3 that were fixed in 24.4. All Ruby developers that use Emacs will do themselves a huge favour by updating their Emacs.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top