How to prevent rubocop to add a space after hash

512 views Asked by At

Rubocop changes #!/usr/bin/ruby to

# !/usr/bin/ruby

adds a space after the hash when I use rubocop -a, how can I avoid this

1

There are 1 answers

3
Bozhidar Batsov On BEST ANSWER

You'll have to disable the LeadingCommentSpace cop. It ensures that there is a space between # and the text that follows it. Puts something like this in your .rubocop.yml:

LeadingCommentSpace:
  enabled: false

What you've stumbled upon is a bug, that I'll fix in the next RuboCop release (I'm its author). Obviously #! should be treated specially.