-
Notifications
You must be signed in to change notification settings - Fork 186
unreachable_code_linter() lints on code in if (FALSE), while (FALSE) #2123
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
unreachable_code_linter() lints on code in if (FALSE), while (FALSE) #2123
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2123 +/- ##
=======================================
Coverage 99.65% 99.65%
=======================================
Files 121 121
Lines 5232 5258 +26
=======================================
+ Hits 5214 5240 +26
Misses 18 18
|
I have seen the lints; I will correct them. |
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.
Good work. Don't forget to add a NEWS bullet.
Makes sense to me... even though some such comments should likely be removed, some are OK, and we won't have a way to distinguish them that I can think of. |
OTOH, what about cases like this? if (FALSE) {
# some_code()
# that_i_commented_out()
# that_should_be_removed()
} |
Overall, looks good! Thanks for taking this on! |
I think linter should have independent separate tasks and that would be the |
From (1) run all xml_find_all() (2) run all xml_nodes_to_lints() to (1) Run xml_find_all() and xml_nodes_to_lints() for XPath 1 (2) ... (n) Run xml_find_all() and xml_nodes_to_lints() for XPath n
…nreachable_code_linter # Conflicts: # R/unreachable_code_linter.R
Resolves #1428.
I held back from linting comments with the new features since, unlike the previous linting scenario, I don't see any issues with it and didn't find any guidelines on this in the tidyverse style guide. But I'm open to tweaking this if needed. Maybe we could even add a flag for this option?
Empty loops are intentionally ignored.
When I get a moment, I'm also planning to tackle issue #2105.
I noticed that the previous examples each contained an unnecessary line in my opinion, but I didn't want to just change it. Am I missing something why
writeLines(code_lines)
is necessary?