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
Specify -c .rubocop.yml for rake rubocop #6913
Conversation
Can't you just use |
Seems like a good idea. |
@martinemde would you mind to update the PR? We can also merge this and I can do in followup if preferred. |
I can update when I get back to the computer. Are the binstubs updated automatically somehow though? |
No, our current binstubs are maintained manually. |
This avoids the problem where an existing .rubocop.yml is found in the user's home directory that causes errors or misconfiguration. It also speeds up the run by about 13%, presumably because it doesn't need to look for the right config file.
b5ecad9
to
a421ced
Compare
I think we should keep the rake task. Interestingly, specifying |
I'm a little confused in here @martinemde. This seems problem with your specific setup. How do you handle this in other projects? Do you specify |
@simi I'm really not sure why this is showing up now. I have some basic defaults for rubocop in
My .rubocop.yml has some Rails cops in it, so it seems that when it reads that file for a single AllCops/Exclude pattern, it's not properly ignoring unrecognized cops. The change seems harmless to me, and it's a bit faster. It works around an apparent bug in rubocop for those of us that move between a lot of different ruby projects. If you see a negative to merging this, we can close it. |
I'm just trying to prevent fixing user problems in rubygems codebase. Would you mind to open issue in rubocop instead? 🤔 It could be also related to strange setup of rubocop in this repo and maybe we will get some hint how to fix it. 🙏 |
I've tracked the problem down to an unintended behavior in rubocop. I'm fine not merging this, but I also don't think it hurts anything to merge it and it saves a small amount of time every run. I'll link the rubocop issue back here when I submit it. |
This is ultimately caused by rubocop/rubocop#12147 which is, imho, a rubocop bug. Let's just leave our |
@martinemde I've been there too. Thanks for fixing things at the right place. In case it helps, see rubocop/rubocop#8176 and other linked PRs where I thought I had fixed very similar issues 😆. |
By the way, if this speeds up loading RuboCop, and we have an explicit binstub, I don't think it hurts at all to be explicit about the configuration. |
Glad to see this fixed at proper place.
Indeed, now we can open another discussion about speed performance. If that makes sense, let's merge this, just add comment in binstub explaining the reason for this. |
What was the end-user or developer problem that led to this PR?
This avoids the problem where an existing .rubocop.yml is found in the user's home directory that causes errors or misconfiguration. For example, it was picking up my ~/.rubocop.yml and complaining about Rails cops.
What is your fix for the problem, implemented in this PR?
Specify the .rubycop.yml config explicitly in the rake task.
Make sure the following tasks are checked