FR: store full lint call within `Linter` output
Would you be receptive (and hopefully find useful) functionality that stores the full (modified) lint call in the output of Linter(). By this I mean adding a call_ attribute. For example, for Linter(indentation_linter(4L)) we would get
attr(Linter(indentation_linter(4L)), "call_")
#> indentation_linter(indent = 4L, hanging_indent_style = c("tidy",
#> "always", "never"), assignment_as_infix = TRUE)
This would then transfer functions that return lists of linters so we would have
linters_with_defaults(indentation_linter(4L)) |>
lapply(attr, "call_") |>
head(7L)
#> $assignment_linter
#> assignment_linter(operator = c("<-", "<<-"), allow_cascading_assign = NULL,
#> allow_right_assign = NULL, allow_trailing = TRUE, allow_pipe_assign = NULL)
#>
#> $brace_linter
#> brace_linter(allow_single_line = FALSE, function_bodies = c("multi_line",
#> "always", "not_inline", "never"))
#>
#> $commas_linter
#> commas_linter(allow_trailing = FALSE)
#>
#> $commented_code_linter
#> commented_code_linter()
#>
#> $equals_na_linter
#> equals_na_linter()
#>
#> $function_left_parentheses_linter
#> function_left_parentheses_linter()
#>
#> $indentation_linter
#> indentation_linter(indent = 4L, hanging_indent_style = c("tidy",
#> "always", "never"), assignment_as_infix = TRUE)
I've a hacky proof-of-concept branch setup up at https://github.com/TimTaylor/lintr/tree/store-call. Happy to work on this more if you thought useful?
This is motivated by wanting to take an implicit-style of lints, e.g. linters_with_defaults(indentation_linter(4L)) and make it easy to see what lints are being called and what the arguments are. FWIW - also somewhat related to providing a better base for https://github.com/r-lib/lintr/issues/2628.