rubocop: Cannot exclude vendor/ folder
I’m using bundler, and all my gems are installed in projects_folder/vendor/ (including rubocop). I’ve been succesfully excluding folders, but somehow I’m not able to exclude the vendor folder. Maybe it has something to do with rubocop being in it???
I think I’ve tried everything, like
vendor/**
'**/vendor/**'
vendor/**/*
etc.
(furthermore: in the code in Rubocop::Config#match_path? I see that pattern can either be a string or a regex… but how to define a regex in the rubocop.yml?)
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 19 (5 by maintainers)
Commits related to this issue
- Exclude vendor/ in RuboCop https://github.com/bbatsov/rubocop/issues/288 — committed to aried3r/acts_as_archival by aried3r 7 years ago
- Stop Rubocop looking for configs & violations in vendor/ folder By default, this folder is excluded [issue], however when we override the `AllCops.Exclude` option it is discarded. On CI, where we put... — committed to zaikio/zaikio-oauth_client by deleted user 3 years ago
- Stop Rubocop looking for configs & violations in vendor/ folder By default, this folder is excluded [issue], however when we override the `AllCops.Exclude` option it is discarded. On CI, where we put... — committed to zaikio/zaikio-hub-ruby by deleted user 2 years ago
@bogdan8 Yes, the correct pattern for excluding all files under
vendorrecursively isvendor/**/*.Is there a reason why
vendoris not excluded by default?I have to agree with @dmolesUC ; it’s pretty surprising to add an exclude directive to
.rubocop.ymland have that result in files that were previous being excluded no longer being so. It’s true that after reading about it and reasoning about it you can totally understand how it works, but it’s pretty confusing when you first encounter it.I filed an issue to merge
Exclude:by default, I believe that is always the intention for RuboCop users: #9325👍 on merging
Exclude:should be the default, who doesn’t want that?OK, I’ve been using RuboCop for six years and this is the first time I’ve heard of
inherit_mode— I see it wasn’t in the README back in the day.Personally I think
Excludeshould default tomerge, but failing that, maybe it should be documented more prominently – or the fact that without it adding any customExcludewill lose the defaults should be called out more explicitly. Given the special behavior ofIncludeandExcludewith regard to shadowing in subdirectories, it’s not entirely intuitive.I agree it probably should. I’ll try to remember to do that when I tackle #7819; you may want to subscribe to that thread.