You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The text was updated successfully, but these errors were encountered:
jcken95
changed the title
Base pipe |> on the end of a line leads to a false negative for commented_code_linter
Any pipe (|> or %>%) on the end of a line leads to a false negative for commented_code_linter
Oct 18, 2024
The expected behaviour would be for lintr::lint(text = " # mean() |>" to return a commented code linter.
Appreciate this code is not parsable in isolation, however, code of this form is a common occurrence in data wrangling. For example:
# no lint detected (expected, desirable behaviour)lintr::lint(
text="mtcars |> dplyr::filter(cyl > 4) |> dplyr::summarise(m = mean(wt))",
linters=lintr:::commented_code_linter()
)
# would like/expect the commented out `dplyr::filter(cyl > 4) |>` to picked up by the lintr# but commented_code_linter() is not flagged in this example, because the single line# is not parsablelintr::lint(
text="mtcars |> #dplyr::filter(cyl > 4) |> dplyr::summarise(m = mean(wt))",
linters=lintr:::commented_code_linter()
)
Uh oh!
There was an error while loading. Please reload this page.
Created on 2024-10-18 with reprex v2.1.1
The text was updated successfully, but these errors were encountered: