-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Description
It seems currently RuboCop always scans every .rb/#!ruby file under the current directory if not explictly passed filenames on the command-line.
In the config, Include seems only useful to add non-.rb files (more like "extra files" to scan), and is not really related to Exclude ("ignore those files when $ rubocop is invoked").
What I want is to be able to tell, in my RuboCop .rubocop.yml config, which files to check.
So for instance, I want to check everything under lib/ and bin/, but nothing else.
This is particularly useful in projects where some of the Ruby files are imported form other projects (so modifying them for style is not an option), or where incrementally transitioning a code base to be checked by RuboCop.
A real-world example of this can be seen in TruffleRuby's RuboCop config.
Currently, whitelisting files/dirs seems only possible if I pass the list to rubocop directly:
$ rubocop lib binBut not in the configuration file.
This quickly becomes cumbersome as this list grows or becomes more complex.
And it forces me to have the list of files checked by RuboCop outside the RuboCop config.
Currently I am working around by having a very long Exclude list, but this feels wrong, because I want to specify what files are checked by RuboCop, not every other file/dir in the repo.
Is there a way I missed to achieve what I want?
If not, do you think this feature would be worth adding to RuboCop?
RuboCop version
$ rubocop -V
0.51.0 (using Parser 2.4.0.0, running on ruby 2.4.1 x86_64-linux)