Skip to content
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

Merged
merged 1 commit into from Apr 15, 2019
Merged

Load config from XDG config home #6895

merged 1 commit into from Apr 15, 2019

Conversation

Mange
Copy link
Contributor

@Mange Mange commented Apr 6, 2019

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 the use_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.

@bbatsov
Copy link
Collaborator

bbatsov commented Apr 8, 2019

The build seems to be failing.

@Mange
Copy link
Contributor Author

Mange commented Apr 11, 2019

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 ~ in some CircleCI environments. Will try to work around that.

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.
@Mange
Copy link
Contributor Author

Mange commented Apr 13, 2019

That fixed it. 😄

@bbatsov bbatsov merged commit 6fe5956 into rubocop:master Apr 15, 2019
@bbatsov
Copy link
Collaborator

bbatsov commented Apr 15, 2019

Thanks!

specification][xdg-basedir-spec].

* `~/.rubocop.yml`
* `$XDG_HOME/rubocop/config.yml` (expands to `~/.config/rubocop/config.yml` if

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

Copy link
Contributor Author

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened it here: #7045.

bbatsov pushed a commit that referenced this pull request May 14, 2019
I made a mistake in #6895, which should be corrected to avoid confusion
on how to use the XDG directory specification.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants