Search code examples
rubymine

RubyMine with Rubocop - How to Reformat?


I have RuboCop installed with Rubymine and the inspection errors for rubocop are showing up properly.

Running +Alt+L converts the code to rubymine style that conflicts with rubocop style.

For example:

some_array = 10.times.map {|index| index * 3}   # rubymine
some_array = 10.times.map { |index| index * 3 } # rubocop

rubocop puts spaces inside of inline blocks. a small thing I know. but rubymine autoformats without spaces so I have a crapton of of inspection notices.


Solution

  • In Rubymine, go to Settings → Editor → Code Style → Ruby and ensure you have the Spaces around curly braces option checked.

    enter image description here