Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

object_usage_linter doesn't catch assignments with = #1081

Closed
MichaelChirico opened this issue Apr 16, 2022 · 0 comments · Fixed by #1082
Closed

object_usage_linter doesn't catch assignments with = #1081

MichaelChirico opened this issue Apr 16, 2022 · 0 comments · Fixed by #1082
Labels
bug an unexpected problem or unintended behavior
Milestone

Comments

@MichaelChirico
Copy link
Collaborator

Noticed while working on #1078.

Compare

  expect_lint(
    trim_some("
      fun <- function() {
        a <- 1
      }
    "),
    rex("local variable", anything, "assigned but may not be used"),
    linter
  )

and

  expect_lint(
    trim_some("
      fun = function() {
        a = 1
      }
    "),
    rex("local variable", anything, "assigned but may not be used"),
    linter
  )

The latter test fails on HEAD because the xpath for = assignments is wrong. Fix forthcoming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant