Some authors (e.g. data.table) apply different rules for different =, for example:
f = function(a=1) a
f(a=2)
Specifically, EQ_SUB and EQ_FORMALS should not have surrounding spaces, but EQ_ASSIGN should.
Currently, exclude_operators only supports string inputs, so this type of node-level differentiation is impossible.
There are two options:
(1) Allow specifying node names in exclude_operators=. exclude_operators = c("EQ_SUB", "EQ_FORMALS") is unambiguously a parse_tag. The advantage is a simplified user interface, the disadvantage is overloading.
(2) Add a new argument exclude_parse_tags=, which will match against lintr:::infix_metadata$parse_tag instead of lintr:::infix_metadata$string_value.
Some authors (e.g. data.table) apply different rules for different
=, for example:Specifically,
EQ_SUBandEQ_FORMALSshould not have surrounding spaces, butEQ_ASSIGNshould.Currently,
exclude_operatorsonly supports string inputs, so this type of node-level differentiation is impossible.There are two options:
(1) Allow specifying node names in
exclude_operators=.exclude_operators = c("EQ_SUB", "EQ_FORMALS")is unambiguously aparse_tag. The advantage is a simplified user interface, the disadvantage is overloading.(2) Add a new argument
exclude_parse_tags=, which will match againstlintr:::infix_metadata$parse_taginstead oflintr:::infix_metadata$string_value.