-
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
# nolint next
special comment
#1791
Comments
Out of curiosity, are there other linters / code analysis tools that provide such a feature? Also NB in your example, you'll also want to add a |
pylint has disable-next, which is basically the same thing. # pylint: disable-next=unbalanced-tuple-unpacking
a, b = ... Attributes in Rust can suppress the native linters and behave in a similar way: fn used_function() {}
// `#[allow(dead_code)]` is an attribute that disables the `dead_code` lint
#[allow(dead_code)]
fn unused_function() {}
fn noisy_unused_function() {}
// FIXME ^ Add an attribute to suppress the warning
fn main() {
used_function();
} Not sure about the reprexlintr::lint("
# nolint: line_length_linter. Lorem ipsum dolor sit amet, ornare ex et himenaeos aenean commodo auctor accumsan gravida.
MyFunctionName <- function( # nolint: object_name_linter
a = 1,
b = 2
) {
a + b
}
")
lintr::lint("
# nolint start: line_length_linter
# Lorem ipsum dolor sit amet, ornare ex et himenaeos aenean commodo auctor accumsan gravida.
# nolint end: line_length_linter
# nolint start: object_name_linter
MyFunctionName <- function(
# nolint end: object_name_linter
a = 1,
b = 2
) {
a + b
}
") Created on 2022-12-04 with reprex v2.0.2 |
That's because they parse as unqualified |
I think it's a great idea. It's especially a pain if a API-wise, I think we'll do well to avoid having both |
We already have |
I have a PR basically done implementing this (posting soon). One difference of the clash of That makes something like this: x<-1 # nolint: infix_spaces_linter. # nolint next: assignment_linter.
y = 2 Harder to handle than something like this: x<-1 # nolint: infix_spaces_linter. # nolint start: assignment_linter.
y = 2
z = 3 # nolint end (I think it's not particularly relevant in practice, so I'll proceed by ignoring this situation) |
Is there any interest in using a
# nolint next
special comment to be applied to the next line of code?Current special comments can look kind of intrusive and awkward for some lines. Using a
next
comment may look and feel a bit more natural.# nolint
# nolint start ... end
# nolint next
I'd be happy enough with a next line only implementation, but it might open up a possible request of
# nolint next 5
.The text was updated successfully, but these errors were encountered: