Skip to content

Lints() constructor to vectorize Lint()? #2067

@MichaelChirico

Description

@MichaelChirico

Now that we have a series of consistency checks built into Lint():

lintr/R/lint.R

Lines 374 to 395 in f8bb91e

if (!missing(linter)) {
lintr_deprecated(
old = "Using the `linter` argument of `Lint()`",
version = "3.0.0",
type = ""
)
}
if (length(line) != 1L || !is.character(line)) {
stop("`line` must be a string.")
}
max_col <- max(nchar(line) + 1L, 1L, na.rm = TRUE)
if (!is_number(column_number) || column_number < 0L || column_number > max_col) {
stop(sprintf(
"`column_number` must be an integer between 0 and nchar(line) + 1 (%d). It was %s.",
max_col, column_number
))
}
if (!is_number(line_number) || line_number < 1L) {
stop(sprintf("`line_number` must be a positive integer. It was %s.", line_number))
}
check_ranges(ranges, max_col)

It may make sense to offer a vectorized interface for constructing lints so these consistency checks can be vectorized for efficiency, rather than running the checks lint-by-lint.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions