-
-
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
RuboCop does not merge Exclude by default and therefore scans vendor/bundle #9325
Comments
The default list of excludes is small and only contains directories that are hard to imagine anyone would want to inspect. So merging by default makes a lot of sense. The only potential problem I can foresee is that users who were overriding |
With more and more projects migrating to Github Actions, this will be a growing problem (In GH Actions gems install to |
Ping, it seems many people are hitting this when using GitHub Actions, it would be great if this was fixed in RuboCop. |
Add the `inherit_mode` setting in default configuration to make `Exclude` parameters in user configuration merge with the same `Exclude` settings in inherited configuration. The result of `rubocop --auto-gen-config` is affected by this change, since we otherwise copy values from inherited `Exclude` settings into the generated file.
See #9624. |
I'm catching up on the conversation and late to the party here, but this is a great change I'd love to see merged. This issue has bit me three or four times in the last few months as I've been setting up CI for a few projects, and it's very frustrating when you hit the first instance where you need to I understand the implication of changing the default configuration behavior here; in the short term, perhaps figuring out how to warn about the behavior if the Open to feedback here, but having something give me a clue that I'm overriding a pretty important default (as far as CI is concerned) would be nice! |
The default `Exclude:` is not inherited when a custom value is provided, so the performance was degraded because time was spent searching in `.git` and `node_modules`. Ref: rubocop/rubocop#9325 This commit also: - Sorts list - Excludes all `vendor` folders in `gemfiles` subfolder ### `master` (third run) ``` real 0m5.448s user 0m5.614s sys 0m1.096s ``` ### This branch (third run) ``` real 0m2.431s user 0m2.738s sys 0m0.869s ```
The default `Exclude:` is not inherited when a custom value is provided, so the performance was degraded because time was spent searching in `.git` and `node_modules`. Ref: rubocop/rubocop#9325 This commit also: - Sorts list - Excludes all `vendor` folders in `gemfiles` subfolder ### `master` (third run) ``` real 0m5.448s user 0m5.614s sys 0m1.096s ``` ### This branch (third run) ``` real 0m2.431s user 0m2.738s sys 0m0.869s ```
Also fix RuboCop config to exclude .git Ref: rubocop/rubocop#9325
Also fix RuboCop config to exclude .git Ref: rubocop/rubocop#9325
Also fix RuboCop config to exclude .git Ref: rubocop/rubocop#9325
The default `Exclude:` is not inherited when a custom value is provided, so the performance was degraded because time was spent searching in `.git` and `node_modules`. ### Before: ``` real 0m3.699s user 0m3.595s sys 0m0.653s ``` ### After: ``` real 0m1.712s user 0m1.671s sys 0m0.600s ``` Ref: rubocop/rubocop#9325
The default `Exclude:` is not inherited when a custom value is provided, so the performance was degraded because time was spent searching in `.git` and `node_modules`. ### Before: ``` real 0m3.699s user 0m3.595s sys 0m0.653s ``` ### After: ``` real 0m1.712s user 0m1.671s sys 0m0.600s ``` Ref: rubocop/rubocop#9325
The default `Exclude:` is not inherited when a custom value is provided, so the performance was degraded because time was spent searching in `.git`. Ref: rubocop/rubocop#9325
The default `Exclude:` is not inherited when a custom value is provided, so the performance was degraded because time was spent searching in `.git`. Ref: rubocop/rubocop#9325
The default `Exclude:` is not inherited when a custom value is provided, so the performance was degraded because time was spent searching in `.git`. Ref: rubocop/rubocop#9325
RuboCop was ignoring some of the todo file's Exclude's. This PR fixes most of that - Applies the workaround suggested [here](rubocop/rubocop#13091 (comment)) and [here](rubocop/rubocop#9325 (comment)) - regenerates RuboCop todo file - removes now-unnecessary `disable`'s in `app/helpers/forms_helper.rb` - inlines the remaing `disable`; using the inline gives us one fewer place to change in case we want to remove this temporararily or permanently.
RuboCop currently does not merge
Exclude
by default.I think this is a significant usability bug, because it makes RuboCop harder to use in combination with the very common Bundler path
vendor/bundle
.Notably, it causes extra troubles for ruby/setup-ruby in ruby/setup-ruby#136 and RuboCop seems by far the most common tool to be tripped up by files under
vendor/
. Other tools seem to deal with it just fine by default, or be much less frequently used.So that even though RuboCop does exclude
vendor/**/*
in the default config,that has actually no effect at all (!) when using a
.rubocop.yml
such as:Expected behavior
RuboCop should by default ignore
vendor/**/*
, even if the config defines extraAllCops:
->Exclude:
.Actual behavior
An extra
AllCops:
->Exclude:
overrides the default, which I believe is always unintentional.This results in confusing errors, for instance when seeing an old
TargetRubyVersion
from a gem undervendor/bundle
, such as:If it does not error, it would also slow down RuboCop significantly by scanning all these extra files.
This problem will also cause
.git
,node_modules
andtmp
to be scanned, while they should not.Workaround
(https://docs.rubocop.org/rubocop/0.88/configuration.html#merging-arrays-using-inherit_mode)
I don't think it's a good workaround. RuboCop should work fine with the most used Bundler path without any extra manual step.
It is confusing that the default
Exclude
paths are completely forgotten whenever adding a customExclude
.Related: #288 (comment) #7819 and I guess other issues, this is counter-intuitive and confusing behavior.
The text was updated successfully, but these errors were encountered: