We've got (minor perturbations of) this little idiomatic piece at the top of basically every linter:
|
if (!is.null(source_file[["file_lines"]])) { |
|
# abort if source_file is entire file, not a top level expression. |
|
return(NULL) |
|
if (is.null(source_file$file_lines)) return(list()) |
|
if (is.null(source_file$full_xml_parsed_content)) return(list()) |
This is too obscure to a first-time reader. We should add a wrapper of this expression that makes it clear what's being done/why, and also export it for use in custom downstream linters.
We've got (minor perturbations of) this little idiomatic piece at the top of basically every linter:
lintr/R/cyclocomp_linter.R
Lines 13 to 15 in 23b06bd
lintr/R/line_length_linter.R
Line 13 in 23b06bd
lintr/R/missing_argument_linter.R
Line 11 in 23b06bd
This is too obscure to a first-time reader. We should add a wrapper of this expression that makes it clear what's being done/why, and also export it for use in custom downstream linters.