Skip to content
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

Merged
merged 2 commits into from
Sep 26, 2024
Merged

rm 'dangerous_fn_linter' to fix #173 #177

merged 2 commits into from
Sep 26, 2024

Conversation

mpadge
Copy link
Member

@mpadge mpadge commented Sep 25, 2024

No description provided.

@mpadge mpadge requested a review from maelle September 25, 2024 12:32
Copy link

codecov bot commented Sep 25, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 38.35%. Comparing base (b215780) to head (6283afc).

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.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@maelle maelle left a 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(
Copy link
Contributor

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

Copy link
Member Author

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:

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?

Copy link
Contributor

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.

Copy link
Member Author

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!

@mpadge
Copy link
Member Author

mpadge commented Sep 26, 2024

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? 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

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 😆 ❗

@mpadge mpadge changed the title rm 'dangerous_fn_linter' for #173 rm 'dangerous_fn_linter' to fix #173 Sep 26, 2024
@mpadge mpadge requested a review from maelle September 26, 2024 09:27
@mpadge mpadge mentioned this pull request Sep 26, 2024
5 tasks
@mpadge mpadge merged commit 2f1ecaf into main Sep 26, 2024
@mpadge mpadge deleted the undesirable-fn-linter branch September 26, 2024 11:27
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.

3 participants