Skip to content

False positive in unnecessarry_lambda_linter() #2310

Closed

Description

@Bisaloo
library(lintr)

lint(text = "lapply(l, function(e) 'a' %in% names(e))", linters = unnecessary_lambda_linter())
#> <text>:1:11: warning: [unnecessary_lambda_linter] Pass names directly as a symbol to lapply() instead of wrapping it in an unnecessary anonymous function. For example, prefer lapply(DF, sum) to lapply(DF, function(x) sum(x)).
#> lapply(l, function(e) 'a' %in% names(e))
#>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Created on 2023-11-18 with reprex v2.0.2

Activity

  1. MichaelChirico commented on Nov 18, 2023

    @MichaelChirico
    Collaborator

    can you confirm this is in the current dev version? there's been some recent related fixes

  2. IndrajeetPatil commented on Nov 18, 2023

    @IndrajeetPatil
    Collaborator

    I had actually checked with current dev before adding the label. This indeed seems like another false positive.

  3. Bisaloo commented on Nov 20, 2023

    @Bisaloo
    CollaboratorAuthor

    Fixed by #2320

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    false-positivecode that shouldn't lint, but does

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions