-
Notifications
You must be signed in to change notification settings - Fork 194
Update sprintf_linter() to lint constant strings #2894
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
Conversation
Since it is now handled by !is.na(fmt)
R/sprintf_linter.R
Outdated
constant_fmt_lint <- xml_nodes_to_lints( | ||
sprintf_calls[constant_fmt], | ||
source_expression = source_expression, | ||
lint_message = "A constant string is used and the sprintf call can be removed", |
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.
This message should be improved to use the actual function, which can be gettextf, rather than sprintf.
3a5ab38
to
9e18825
Compare
9e18825
to
85ce180
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2894 +/- ##
=======================================
Coverage ? 99.27%
=======================================
Files ? 128
Lines ? 7222
Branches ? 0
=======================================
Hits ? 7170
Misses ? 52
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 it's ready to go, just another round of small tweaks requested. Thanks!
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.
Great, thanks!
Covers some cases from #2183.
As opposed to what seemed implied in some of the comments, I went with treating the constant strings case before checking if the call is invalid to make the maximum possible as static analysis before evaluating calls.