Rubocop will interpret a file named Dangerfile as having ruby source, but will throw an invalid name error.
Diving in Rubocop's source, I've identified the list of file names to be considered Ruby source:
In default.yml there is an interesting comment in the Style/Filename cop:
Style/FileName:
# File names listed in `AllCops:Include` are excluded by default. Add extra
# excludes here.
If we go to AllCops:Include in the same file, we find an interesting list of files:
These two lists have a big overlap but are not identical.
As I see it, to solve my particular issue I would need to add Dangerfile to AllCops:Include, but I'm wondering if these two lists of potential Ruby files shouldn't be merged instead of being maintained separately?
I want to hear what folks think. I'll be happy to send a PR when/if someone more knowledgeable in the codebase gives me some pointers :)
The Style/Filename cop show show be triggered by known Ruby file names.
$ rubocop Dangerfile
Inspecting 1 file
C
Offenses:
Dangerfile:1:1: C: The name of this source file (Dangerfile) should use snake_case.
# Make it more obvious that a PR is a work in progress and shouldn't be merged yet
^
1 file inspected, 1 offense detected
1- Create a file named Dangerfile
2- Run rubocop Dangerfile
$ rubocop -V
0.48.1 (using Parser 2.4.0.0, running on ruby 2.4.0 x86_64-darwin16)
Seems like an oversight on our part. Guess we should merge those lists and ideally rely on the configuration so users can change the list themselves.
I've synced up the two lists for now, but down the road this duplication should really be taken care of.
Is this still an issue?
@ryanhageman Thank you for mentioning. This issue has been solved by edge RuboCop with #5882.
Most helpful comment
I've synced up the two lists for now, but down the road this duplication should really be taken care of.