Skip to content

Create download_file_linter() - #2882

Merged
Bisaloo merged 11 commits into
mainfrom
download_file_linter
Jul 19, 2025
Merged

Bisaloo merged 11 commits into
mainfrom
download_file_linter

Conversation

@Bisaloo

@Bisaloo Bisaloo commented Jul 16, 2025

Copy link
Copy Markdown
Collaborator

First attempt to fix #2866 (cc @maelle).

A potential improvement would be to not lint when method = "wget" or method = "curl", as mode is ignored in this situation according to ?download.file.

@codecov

codecov Bot commented Jul 16, 2025 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.27%. Comparing base (449ed5c) to head (77cd84e).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2882   +/-   ##
=======================================
  Coverage   99.26%   99.27%           
=======================================
  Files         127      128    +1     
  Lines        7115     7143   +28     
=======================================
+ Hits         7063     7091   +28     
  Misses         52       52           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Comment thread R/download_file_linter.R Resolved
Comment thread R/download_file_linter.R Resolved
Comment thread R/download_file_linter.R Resolved
Comment thread R/download_file_linter.R Resolved
Comment thread R/download_file_linter.R Resolved
Comment thread R/download_file_linter.R Resolved
Comment thread R/download_file_linter.R Resolved
Comment thread inst/lintr/linters.csv Resolved
@MichaelChirico

Copy link
Copy Markdown
Collaborator

A potential improvement would be to not lint when method = "wget" or method = "curl", as mode is ignored in this situation according to ?download.file.

There are a few linters that do similar things you could consult, I'm not sure which is the simplest (inner_combine_linter() and paste_linter() came to mind but they're both pretty complicated in different ways):

https://github.com/search?q=repo%3Ar-lib%2Flintr%20%2FSYMBOL_SUB%2F&type=code

@Bisaloo

Bisaloo commented Jul 18, 2025

Copy link
Copy Markdown
Collaborator Author

A potential improvement would be to not lint when method = "wget" or method = "curl", as mode is ignored in this situation according to ?download.file.

There are a few linters that do similar things you could consult, I'm not sure which is the simplest (inner_combine_linter() and paste_linter() came to mind but they're both pretty complicated in different ways):

github.com/search?q=repo%3Ar-lib%2Flintr%20%2FSYMBOL_SUB%2F&type=code

Thanks for the pointer! I knew something like get_r_string() existed but I couldn't find it.

I am now much happier with the result. Please let me know if you think this is moving in the right direction and I can add support for method = "wget" / method = "curl".

@Bisaloo
Bisaloo force-pushed the download_file_linter branch from f686069 to 90a962f Compare July 18, 2025 11:29
Comment thread man/download_file_linter.Rd Outdated
% Please edit documentation in R/download_file_linter.R
\name{download_file_linter}
\alias{download_file_linter}
\title{Recommend usage of a portable \code{mode} value in \code{\link[=download.file]{download.file()}}}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Somewhat unusual to see a link in a title, can't say I've come across that often...

In ~508K \title{} fields on CRAN, I see

Given that we also link it in \description{} below, and the [utils:download.file] qualification was apparently lost in the \title{}. let's drop that link in the \title{}.

Comment thread R/download_file_linter.R Resolved

@MichaelChirico MichaelChirico left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looking great! One minor revision needed.

Feel free to merge and handle the method= nuances as a follow-up.

@Bisaloo
Bisaloo merged commit b63bfbc into main Jul 19, 2025
@Bisaloo
Bisaloo deleted the download_file_linter branch July 19, 2025 07:53
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.

New linter suggestion: download.url(mode = "w")

2 participants