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
Behaviour of home directory .rubocop.yml vs project specific .rubocop.yml #9879
Comments
It's taking So it's not a bug exactly, but an undesirable side effect of how the configuration system doesn't have the concept of project root, only of ancestor directories. I would recommend that you don't have RuboCop configuration in your home directory. |
I think this problem was fixed by #8314? |
Yes, that should have fixed it. And sorry I wasn't aware of your improvement of the logic for looking up configuration, @deivid-rodriguez! But for some reason |
@jonas054 I think it's because OP is using rubocop 0.70 and my improvements were introduced in rubocop 0.80. |
@deivid-rodriguez's explanation seems correct. Solution is to upgrade RuboCop. Closing. |
This is a useless solution to me, because there are so many projects still using pre-0.80. I can't go around upgrading every project's rubocop before contributing to it. Even if I did, the moment I pull down a new project (to me) that has an old version of rubocop I just can't run the linter locally. I think this could use a backport. Thank you guys for figuring it out though. |
What about moving |
My intention is to maintain a personal cross-computer set of rubocop rules which automagically (when opened w/ my editor) applies to my various ruby scripts littered around my computer. These scripts do not warrant the whole ceremony of setting up a project directory w/ a rubocop.yml. I could place a .rubocop.yml that explicitly inherits from my config in every folder in which I have a ruby script, but I won't remember/bother to do that when dropping into said script for a quick edit or quickly making a new one (which is the nature of these scripts). I also don't want to litter my filesystem with these .rubocop.yml files. (Also what if this .rubocop.yml ends up being in a parent directory to a project w/ pre-0.80 rubocop installed?) The fact that I'm using editor integration (SublimeLinter for Sublime text), means it's too much of a hassle to use the It's not that its impossible, but it is too much effort for too little value. |
I see. Then you should be able to move |
The error I'm getting is this:
Rubocop 0.70 doesn't know that Ruby 3.0 exists. I already tried moving my config into |
I've now tried to reproduce your problem on my machine, and it seems that you're right. Moving the common configuration to As far as I can see, your problem is quite unique and doesn't really warrant backporting the solution from 0.80 to a new 0.70.2 version. So I'm not re-opening the issue at this point. Let me know if you disagree. |
And I found weird function
absolute path is not applied at all. |
@KSH-code What's the output in those two cases if you add the |
Here you are. |
Oooops it seems a my human error.. maybe from a rubocop extension inside vscode. |
Hey. I'm having a problem using a .rubocop.yml in my home directory.
I'm using rbenv, rbenv-gemsets and bundler to isolate the project, and in a project dir we have a project specific .rubocop.yml, specifying a TargetRubyVersion of 2.6, compatible with the older version of rubocop.
In my home directory I have a .rubocop.yml intended for use w/ a newer version of rubocop and ruby than what we're running in the project. It has a TargetRubyVersion of 3.0.
When invoking rubocop -d in the project dir, here is the output.
output when invoking rubocop -d in the project dir
Based on the documentation at https://docs.rubocop.org/rubocop/configuration.html I expected rubocop only to load configuration from my home directory if it could not find a .rubocop.yml inside the project directory.
Am I misunderstanding the docs or is this a bug?
Versions in project
Versions in home dir (system)
The text was updated successfully, but these errors were encountered: