Skip to content

Don't lint T and F if followed by [#2947

Merged
MichaelChirico merged 4 commits intor-lib:mainfrom
mcol:issue_2944
Oct 16, 2025
Merged

Don't lint T and F if followed by [#2947
MichaelChirico merged 4 commits intor-lib:mainfrom
mcol:issue_2944

Conversation

@mcol
Copy link
Copy Markdown
Contributor

@mcol mcol commented Oct 16, 2025

Fixes #2944.

@codecov
Copy link
Copy Markdown

codecov Bot commented Oct 16, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.24%. Comparing base (77f0dae) to head (fa74377).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2947   +/-   ##
=======================================
  Coverage   99.24%   99.24%           
=======================================
  Files         129      129           
  Lines        7276     7276           
=======================================
  Hits         7221     7221           
  Misses         55       55           

☔ 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.

Comment thread R/T_and_F_symbol_linter.R Outdated
@MichaelChirico
Copy link
Copy Markdown
Collaborator

Don't forget to cite yourself in the NEWS :)

expect_lint("DF$bool <- T", msg_true, linter)
expect_lint("S4@bool <- T", msg_true, linter)
expect_lint("sum(x, na.rm = T)", msg_true, linter)
expect_lint("x[T]", msg_true, linter)
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.

Great test. Indeed using T (as TRUE) to index a vector is valid, and we'd be better off linting it as here.

@MichaelChirico MichaelChirico merged commit 552668b into r-lib:main Oct 16, 2025
21 checks passed
@mcol mcol deleted the issue_2944 branch October 16, 2025 20:45
TimTaylor pushed a commit to TimTaylor/lintr that referenced this pull request Oct 29, 2025
* Don't lint T and F if followed by `[`.

* Address review comments.

* subsume into same expr[] as $ and @

---------

Co-authored-by: Michael Chirico <chiricom@google.com>
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.

T_and_F_symbol_linter seems too eager

2 participants