Skip to content

Apply condition_call_linter() only on string literals#2888

Merged
MichaelChirico merged 3 commits intomainfrom
condition-call-string-only
Jul 23, 2025
Merged

Apply condition_call_linter() only on string literals#2888
MichaelChirico merged 3 commits intomainfrom
condition-call-string-only

Conversation

@Bisaloo
Copy link
Copy Markdown
Collaborator

@Bisaloo Bisaloo commented Jul 23, 2025

Fix #2647

@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 23, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.27%. Comparing base (ab329d8) to head (719fac5).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2888   +/-   ##
=======================================
  Coverage   99.27%   99.27%           
=======================================
  Files         128      128           
  Lines        7160     7164    +4     
=======================================
+ Hits         7108     7112    +4     
  Misses         52       52           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@MichaelChirico MichaelChirico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was discussed a bit in the issue, but it might be worth considering if this behavior should/could be optional -- I'm thinking of cases like:

msg <- gettextf(...)
stop(msg)

Those match the spirit of the original lint -- call. should be used there just as much as for stop('...'). So now users might have inconsistent usage of stop() in their code base if they obey this linter -- some will get linted, others won't.

My example also gives a common case that won't be linted but maybe should:

stop(gettextf(...))

I'm still not sure the right way forward. I also don't really use this linter myself, so I will allow you to ruminate on how best to improve it later :)

@MichaelChirico MichaelChirico merged commit 89e29d8 into main Jul 23, 2025
20 checks passed
Comment thread R/condition_call_linter.R
condition_call_linter <- function(display_call = FALSE) {
call_xpath <- glue::glue("
following-sibling::SYMBOL_SUB[text() = 'call.']
following-sibling::expr/STR_CONST
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, sorry @Bisaloo this warrants a NEWS entry, please handle as a follow-up :)

@MichaelChirico MichaelChirico deleted the condition-call-string-only branch July 23, 2025 16:04
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.

call. argument should not be added for custom conditions

2 participants