Skip to content

Add/export a readable wrapper for testing whether a linter is on an expression or the whole file #921

Description

@MichaelChirico

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions