I don't think I can disable the Metrics/LineLength for just the shebang line.
(If it helps, the shebang line in question is #!/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby --disable-gems. The reason I'm doing this is to reference the system Ruby on macOS while bypassing the users gem environment.)
I'd like to be able to disable Metrics/LineLength for just the shebang line. Really I think this should be Rubocops default behavior, Metrics/LineLength shouldn't apply to a shebang line because it's not Ruby source code, and it can't reliably be shortened. But if it were a configuration option, I'd say having a syntax for it in disabling cops within source code would be nice.
Thanks!
The Metrics/LineLength cop can be configured to ignore lines that match certain patterns. Maybe that would help you?
Metrics/LineLength:
IgnoredPatterns:
- ^#!
@buehmann Thanks Andreas! I tried this approach out and it seems like a good workaround for my situation. I still think ideally the shebang should be ignored by default, so I'll leave the issue open for however the maintainers want to handle it. Thanks and cheers!
@robenkleene You're welcome. And I have good news: I saw this PR this morning: https://github.com/rubocop-hq/rubocop/pull/7232
Most helpful comment
The
Metrics/LineLengthcop can be configured to ignore lines that match certain patterns. Maybe that would help you?