You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 :)
Expected behavior
The Style/Filename cop show show be triggered by known Ruby file names.
Actual behavior
$ 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
Steps to reproduce the problem
1- Create a file named Dangerfile
2- Run rubocop Dangerfile
This commit mostly syncs up AllCops/Include with the code we use to
detect if something is a Ruby file or not.
That's just a quick temporary fix.
As mentioned in the ticket - a better solution would to unify to the
different lists that we currently employ.
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:
https://github.com/bbatsov/rubocop/blob/66405e118491afd8e8ec574cf2dc18549ef9a2df/lib/rubocop/target_finder.rb#L32-L52
In
default.yml
there is an interesting comment in theStyle/Filename
cop:https://github.com/bbatsov/rubocop/blob/ef729dfcc5d15e038db24579b761bc0b56991de0/config/default.yml#L503-L505
If we go to
AllCops:Include
in the same file, we find an interesting list of files:https://github.com/bbatsov/rubocop/blob/ef729dfcc5d15e038db24579b761bc0b56991de0/config/default.yml#L9-L29
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
toAllCops: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 :)
Expected behavior
The
Style/Filename
cop show show be triggered by known Ruby file names.Actual behavior
Steps to reproduce the problem
1- Create a file named
Dangerfile
2- Run
rubocop Dangerfile
RuboCop version
The text was updated successfully, but these errors were encountered: