-
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
allow config to be an .R file #2177
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2177 +/- ##
=======================================
Coverage 99.65% 99.65%
=======================================
Files 113 114 +1
Lines 5167 5173 +6
=======================================
+ Hits 5149 5155 +6
Misses 18 18
|
Ah that's annoying. IIUC we can't even write |
(alternatively, we can just ignore the |
Since R code can to pretty wild things, I'd suggest to add schema validation of the settings. |
Technically also affects DCF too, right? Since we just One thing discussed in the issue that I ended up omitting is any check that users are "doing too much" in their config. I think it's fine since we write to a "clean" environment, and only copy over the "correct" keys (instead of, say, copying over every key found in the new environment). |
I would actually err on the side of safety and suggest consciously using Re validation:
But most importantly, no unused variable should be defined. And yes, the validation should be executed after loading the config from either source. |
Worth a try. The process could implicitly run |
right... one issue is line numbers will be off in error messages if we just paste that into the script. is messing with an .Rprofile the best workaround? but we should be running the subprocess as --vanilla? |
Either create a temp script that does the setup and source, or, e.g. with |
My thinking is the script should be very plain & running into issues with |
IMO running this file in a subprocess is overkill, and will have a substantial performance cost for relatively little gain. |
@AshesITR WDYT about sticking with simple |
I'm fine with that. My original point was to run our tests in a separate process to make sure they don't depend on lintr being attached. |
OK, added a test, let me know if that's what you had in mind. |
Implementation looks good. |
I want to take a pass at reorganizing the NEWS, let's merge for now |
Closes #1210
Here's a minimal change to allow
getOption("lintr.linter_file")
to be an R script. My thinking is to include this in the release as an "experimental" feature & decide by 3.2.0 the future of config files for {lintr}. Some notes:lintr.linter_file
option. That points us to which config to use.get_setting()
is a bit awkward. It might be preferable toparse()
the DCF keys up-front instead.Still needs tests/NEWS, but wanted to open discussion first.