0

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

mu is too short
  • 426,620
  • 70
  • 833
  • 800
Rpj
  • 5,348
  • 16
  • 62
  • 122

1 Answers1

2

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.

Bozhidar Batsov
  • 55,802
  • 13
  • 100
  • 117