Skip to content

Consider ways to work around stats::filter() when applying dplyr::filter() lints #2078

Closed
@MichaelChirico

Description

@MichaelChirico

Follow-up to #2077.

That PR is conservative about what filter() calls to include. We do not match filter() unless it's namespace-qualified, to avoid false positives involving stats::filter(). I'm not so familiar with stats::filter(), but my understanding is it'd be really weird to use & there too, but in any case the lint message would look strange.

We might parameterize this instead to increase the reach, e.g. assume_dplyr , when TRUE all filter() calls are matched, or allow_conjunct_filter, when TRUE all filter() calls are skipped.

Another less conservative option: assume filter() is dplyr::filter(), unless it's namespace-qualified as coming from another namespace. That gives users an out if needed, but defaults to assuming everything comes from dplyr (which seems most likely, among users who'd have this lint active)

Metadata

Metadata

Assignees

No one assigned

    Labels

    false-negativecode that should lint, but doesn'tfeaturea feature request or enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions