Skip to content

Allow users to set lintr.linter_file - #338

Merged
jimhester merged 1 commit into
r-lib:masterfrom
jabranham:config-by-option
Jul 25, 2018
Merged

jimhester merged 1 commit into
r-lib:masterfrom
jabranham:config-by-option

Conversation

@jabranham

Copy link
Copy Markdown
Contributor

This lets users specify the location of the linter file with
options(lintr.linter_file) before calling lintr::lint(). This should
be useful to allow the various plugins to specify the path to the
.lintr file

Related to #123 and #335

@jabranham
jabranham requested a review from jimhester as a code owner July 24, 2018 21:06
@codecov

codecov Bot commented Jul 24, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #338 into master will decrease coverage by 0.04%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #338      +/-   ##
=========================================
- Coverage   85.64%   85.6%   -0.05%     
=========================================
  Files          41      41              
  Lines        2131    2132       +1     
=========================================
  Hits         1825    1825              
- Misses        306     307       +1
Impacted Files Coverage Δ
R/settings.R 90% <0%> (-2.31%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89ec417...db4b348. Read the comment docs.

@jimhester

Copy link
Copy Markdown
Member

I agree this needs to change, however I think the test needs to be something like

if (is_absolute_path(linter_file) && file.exists(linter_file)) {
  return(linter_file)
}

@jabranham

Copy link
Copy Markdown
Contributor Author

Checking if the file exists makes sense, but doesn't it make sense for users to be able to use a relative path? It could be just as simple as saying .lintr-config (or whatever) instead of .lintr.

@jimhester

Copy link
Copy Markdown
Member

Yes, you can already do that, but the code assumes the path is relative to the file being linted or the project rather than the working directory; which causes issues when the 3rd party plugins call lintr on a copy of the file in a temporary directory rather than the file itself.

This lets users specify the location of the linter file with
options(lintr.linter_file) before calling lintr::lint(). This should
be useful to allow the various plugins to specify the path to the
.lintr file

Related to r-lib#123 and r-lib#335
@jabranham

Copy link
Copy Markdown
Contributor Author

Ah, I forgot that. Probably should have more coffee :-)

Changed, thanks

@jimhester

Copy link
Copy Markdown
Member

Thanks!

@jimhester
jimhester merged commit baddc5b into r-lib:master Jul 25, 2018
@jabranham
jabranham deleted the config-by-option branch July 25, 2018 18:11
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.

2 participants