Skip to content

Support case where specified method ignores mode in download_linter() #2883

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

Merged
merged 4 commits into from
Jul 21, 2025

Conversation

Bisaloo
Copy link
Collaborator

@Bisaloo Bisaloo commented Jul 19, 2025

Follow up from #2882

Copy link

codecov bot commented Jul 19, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.27%. Comparing base (b63bfbc) to head (3d8b3b4).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2883   +/-   ##
=======================================
  Coverage   99.27%   99.27%           
=======================================
  Files         128      128           
  Lines        7143     7160   +17     
=======================================
+ Hits         7091     7108   +17     
  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.

@@ -40,14 +40,36 @@ download_file_linter <- function() {

implicit_mode <- is.na(download_file_mode)

# According to download.file() documentation, mode is ignored when method
Copy link
Collaborator

Choose a reason for hiding this comment

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

include a corresponding example?

following-sibling::expr[1]/STR_CONST
"
)
no_mode_method <- !is.na(download_file_method) & download_file_method %in% c("wget", "curl")
Copy link
Collaborator

@MichaelChirico MichaelChirico Jul 21, 2025

Choose a reason for hiding this comment

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

naming suggestion: has_ignored_mode or method_ignores_mode. Particularly would like to avoid !no double-negation

# mode explicitly specified with a method that ignores it
lint_message <- rex::rex("mode argument value is ignored")
expect_lint("download.file(x, method = 'wget', mode = 'w')", lint_message, linter)
expect_lint("download.file(x, method = 'curl', mode = 'wb')", lint_message, linter)
Copy link
Collaborator

Choose a reason for hiding this comment

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

add a test where method=method, i.e., given as a name not a character literal, as well as an explicit setting outside these, e.g. method="internal".

Copy link
Collaborator

@MichaelChirico MichaelChirico left a comment

Choose a reason for hiding this comment

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

The gist LGTM, feel free to merge after addressing the minor feedback. Thanks!

@Bisaloo Bisaloo merged commit ab329d8 into main Jul 21, 2025
20 checks passed
@Bisaloo Bisaloo deleted the download_file_method branch July 21, 2025 11:12
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