-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot exclude vendor/ folder #288
Comments
It looks like we have a bug, and it affects regexp as well as glob pattern matching. You can find the syntax for ruby regular expressions in YAML here, but it won't help you circumvent the bug. I will investigate further. |
thanks for the fast response and clearing it out |
I guess this is a situation like below: .
├── .rubocop.yml # config-A: this tries to exclude `vendor`
├── Gemfile
├── lib
│ └── foo.rb
└── vendor
└── bundle
└── ruby
└── 2.0.0
├── gems
│ ├── rubocop-0.8.3
│ │ ├── .rubocop.yml # config-B: this does not inherit config-A
│ │ ├── lib
│ │ │ ├── rubocop
│ │ │ │ ├── cli.rb # RuboCop refers only config-B when inspecting this file
... I think this is an issue with the configuration loading design rather than bug. |
sorry for closing and reopening, pressed the wrong button. I think the scenario sketched by @yujinakayama is correct. |
Very clear explanation @yujinakayama. I hadn't thought about this problem before, but now when I do, I want to call it a bug. It should be possible to exclude everything under @SirLenz0rlot Did you have any other gems under vendor? Were they excluded? I think there may be two different problems that come into play here. |
@jonas054 Yes, all my gems are under |
I'm seeing some weird behavior on this... However it does exclude properly if I run rubocop this way...
|
It seems we still have a bug. Thanks for reporting. I'm reopening the issue and will start to investigate. |
@jonas054 Travis:
.rubocop.yml
|
@bogdan8 Yes, the correct pattern for excluding all files under |
@jonas054 |
I stumbled on this while looking for a way to ask the bundler where it's storing the dependencies -- that way, I could avoid doing any work on files under that directory. I ended up going with a more brute-force solution based on (This function is probably of more use to the RuboCop maintainers than the consumers of the gem) |
Is there a reason why |
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. |
It is excluded by default. What happened here was that |
OK, I've been using RuboCop for six years and this is the first time I've heard of Personally I think |
I have to agree with @dmolesUC ; it's pretty surprising to add an exclude directive to |
👍 on merging |
I filed an issue to merge |
By default, this folder is excluded [issue], however when we override the `AllCops.Exclude` option it is discarded. On CI, where we put our gems in vendor/bundle, Rubocop was looking at all ~4492 files in those directories and linting them. It was also parsing the .rubocop.yml files in those directories and trying to use that configuration, leading to this mysterious error: Running RuboCop... cannot load such file -- rubocop-rspec (even though we do not use this library in our gem!) By setting `inherit_mode` in .rubocop.yml, we tell it to use the default set of exclusions, defined here: [global]. [issue]: rubocop/rubocop#288 (comment) [global]: https://github.com/rubocop/rubocop/blob/930c812d3706a2cd647bdb20cb9c4a6d7a7ae35d/config/default.yml#L63-L67
By default, this folder is excluded [issue], however when we override the `AllCops.Exclude` option it is discarded. On CI, where we put our gems in vendor/bundle, Rubocop was looking at all ~4492 files in those directories and linting them. It was also parsing the .rubocop.yml files in those directories and trying to use that configuration, leading to this mysterious error: Running RuboCop... cannot load such file -- rubocop-rspec (even though we do not use this library in our gem!) By setting `inherit_mode` in .rubocop.yml, we tell it to use the default set of exclusions, defined here: [global]. [issue]: rubocop/rubocop#288 (comment) [global]: https://github.com/rubocop/rubocopblob/930c812d3706a2cd647bdb20cb9c4a6d7a7ae35d/config/default.yml#L63-L67/
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
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?)The text was updated successfully, but these errors were encountered: