-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bad error handling for invalid Lint()
s
#763
Comments
Would For |
IINM NULLs are allowed in some places, but ranges are constrained to a single line only (or NULL), as we can currently only flag one line. Line and column numbers could default to 1 as that would always be valid. |
* safer Lint(), xml_nodes_to_lints() and lint() * add missing newline * add more checks to Lint() fixes #763 * fix surfaced errors in our own code * fix cyclocomp * avoid apply(..., simplify = FALSE) (R >= 4.1), try fixing r-devel * delint * line should have been line_number * more line fixups * reorder column == 0 case * fix column number problems in r-devel move column_number to nchar(line) + 1L if it's larger anchor end-of-line parse error lints to nchar(line) + 1 as well instead of nchar(line) * feedback * fix tests * fix apparent typo Co-authored-by: Michael Chirico <michaelchirico4@gmail.com>
When a linter returns a
Lint
with an invalid (NA
)column_number
, as has recently happened in some regex-based linters, the error message is extremely confusing:IMO
Lint()
should do some mild verification during construction so that invalidLint()
s can't be created successfully.Here are a bunch of checks we could add:
NA
s are allowed anywhere.1L <= column_number <= nchar(line) + 1L
.line_number >= 1L
.ranges
is a list of length 2 integer(ish) vectors, orNULL
.1L <= ranges[[i]][1L] <= ranges[[i]][2L] <= nchar(line) + 1L
for alli
.WDYT?
The text was updated successfully, but these errors were encountered: