-
Notifications
You must be signed in to change notification settings - Fork 186
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
Use XDG config directory #460
Conversation
How about the rappdirs package? |
Good idea! However, if I understand correctly rappdirs is particularly geared towards GUI applications, rather than cross-platform tools and/or code library packages. In particular, on macOS, |
I think using rappdirs is the best solution if we want to go down this route. |
Meanwhile, base R provides |
@AshesITR (Wrong user tagged) Absolutely, and I had thought I had already submitted an updated PR. My bad! I’ll check the other PR and submit my changes ASAP! |
Thanks a ton and sorry for the wrong tag. |
971fa47
to
eddfb04
Compare
Codecov Report
@@ Coverage Diff @@
## main #460 +/- ##
=======================================
Coverage 98.87% 98.87%
=======================================
Files 109 109
Lines 4621 4622 +1
=======================================
+ Hits 4569 4570 +1
Misses 52 52
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
OK, I’ve added the necessary changes. This includes adding an environment variable to override the lintr config file location; I added this change because I think it belongs here: it is a widespread convention that the location of a configuration file can be overridden by an environment variable. In the case of ‘lintr’ it made sense (I think) to make this environment variable act as the default value for @AshesITR At your suggestion I rebased this PR onto #1757; however, this means that the outstanding changes to that PR will probably block this one. |
9e8fb79
to
219dacf
Compare
Could you write some tests to see if the XDG config is pulled as expected? |
@AshesITR Apologies, I had completely missed that. Test added. |
Sorry for taking so long to review, I'll try to get to this soon. |
It would be great if the default lintr config would be preferentially looked up in the appropriate XDG base configuration directory instead of the user home directory. That is, if lintr defaulted to loading
${XDG_CONFIG_HOME-$HOME/.config}/lintr
(note lack of leading dot in the filename!) and only if that doesn’t exist, checked for$HOME/.lintr
. This avoids cluttering the home directory with config files.Of course this can already be achieved by appropriately setting the
lintr.linter_file
option. But defaults matter.This PR implements the necessary change, and stays 100% backwards compatible. Note that this causes the cyclomatic complexity of the
find_config
function to exceed the linting threshold. I’m open for suggestions of how to change this — but I’m tempted to call it a false positive (and to add an appropriatenolint
comment).