Repository navigation
Update sprintf_linter() to lint constant strings - #2894
Merged
Merged
Conversation
Since it is now handled by !is.na(fmt)
Bisaloo
commented
Jul 26, 2025
| 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", |
Collaborator
Author
There was a problem hiding this comment.
This message should be improved to use the actual function, which can be gettextf, rather than sprintf.
Bisaloo
force-pushed
the
constant-strings
branch
from
July 26, 2025 18:16
3a5ab38 to
9e18825
Compare
Bisaloo
force-pushed
the
constant-strings
branch
from
July 26, 2025 18:17
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:
|
MichaelChirico
left a comment
Collaborator
There was a problem hiding this comment.
I think it's ready to go, just another round of small tweaks requested. Thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.