-
Notifications
You must be signed in to change notification settings - Fork 36
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
rm 'dangerous_fn_linter' to fix #173 #177
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #177 +/- ##
==========================================
+ Coverage 33.13% 38.35% +5.22%
==========================================
Files 11 11
Lines 338 292 -46
==========================================
Hits 112 112
+ Misses 226 180 -46 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So nice to be able to use more of lintr.
In the PR first comment why not use the "Fix #" syntax to link the PR to the issue? https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/using-keywords-in-issues-and-pull-requests#linking-a-pull-request-to-an-issue
R/prep_lintr.R
Outdated
"attach" = "Avoid attach, it is easy to create errors with it", | ||
"detach" = "Avoid detach, it is easy to create errors with it" | ||
)), | ||
setwd_linter = lintr::undesirable_function_linter(fun = c( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you might be able to rely on the defaults https://lintr.r-lib.org/reference/default_undesirable_functions.html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I pondered that, and it is of course possible, but the current setup has this useful explicit list here:
Lines 4 to 13 in c3b60fb
linters_to_lint <- list( | |
assignment_linter = lintr::assignment_linter(), | |
line_length_linter = lintr::line_length_linter(80), | |
semicolon_linter = lintr::semicolon_linter(allow_compound = TRUE), | |
attach_detach_linter = attach_detach_linter(), | |
setwd_linter = setwd_linter(), | |
sapply_linter = sapply_linter(), | |
library_require_linter = library_require_linter(), | |
seq_linter = seq_linter() | |
) |
Bundling all in single default
undesirable_functions
would then require people to look somewhere in lintr
to find out which default functions were considered undesirable. I like this explicit naming more. Does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But would there be a way for us not to store the messages here? Like for instance having "Avoid changing the working directory, or restore it in on.exit"
in goodpractice source.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, of course there is! Thank you so much for pushing further. Code in current form is much neater and more robust. thanks!
Sorry, I almost always do that, but was feeling pretty groggy yesterday and wasn't thinking quite right ... But thanks for always catching me out 😆 ❗ |
No description provided.