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
Load config from XDG config home #6895
Conversation
The build seems to be failing. |
I don't understand why because the failures don't appear to be related to the code changes from what I can tell. I'm trying a rebuild since CircleCI had some issues recently. [EDIT]: Now I see the problem. Can't expand |
Users now have an additional place they can have their own config file, if they prefer to not have dotfiles inside their home directory. Based on initial work by @tejasbubane in #6682.
That fixed it. 😄 |
Thanks! |
specification][xdg-basedir-spec]. | ||
|
||
* `~/.rubocop.yml` | ||
* `$XDG_HOME/rubocop/config.yml` (expands to `~/.config/rubocop/config.yml` if |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-* `$XDG_HOME/rubocop/config.yml` (expands to `~/.config/rubocop/config.yml` if
+* `$XDG_CONFIG_HOME/rubocop/config.yml` (expands to `~/.config/rubocop/config.yml` if
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤦♂️
Should I do another PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened it here: #7045.
I made a mistake in #6895, which should be corrected to avoid confusion on how to use the XDG directory specification.
Users now have an additional place they can have their own config file, if they prefer to not have dotfiles inside their home directory.
Based on initial work by @tejasbubane in #6682.
I chose
rubocop/config.yml
as the config file name since it seems to be the closes to how people use the specification currently.In order to make this non-controversial, I made the XDG file last in the prioritization order instead of in front of
$HOME
. This could be changed if you prefer, or possibly changed later on (although that would then be a breaking change, while it would only be a minor bump doing it now).Documentation and changelog has been updated. I made the documentation pretty verbose, but I can dial it back if you wish. Hopefully having the algorithm spelled out in a clear example makes it easier for people to grasp how it works.
FileFinder
lost theuse_home
option as it now seems unrelated to traversing directories, and more to do with where the config files are located unless they are found by traversing the directories.The new private methods in
ConfigLoader
is written in a way to make the prioritization fairly clear and easy to change and relate to in the future.