mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-04 10:48:32 +00:00
Make noqa parsing consistent and more robust (#16483)
# Summary The goal of this PR is to address various issues around parsing suppression comments by 1. Unifying the logic used to parse in-line (`# noqa`) and file-level (`# ruff: noqa`) noqa comments 2. Recovering from certain errors and surfacing warnings in these cases Closes #15682 Supersedes #12811 Addresses https://github.com/astral-sh/ruff/pull/14229#discussion_r1835481018 Related: #14229 , #12809
This commit is contained in:
parent
a04347b7a3
commit
8bd140c99d
57 changed files with 1547 additions and 829 deletions
|
@ -19,5 +19,6 @@ def f():
|
|||
|
||||
|
||||
def f():
|
||||
# Only `E741` should be ignored by the `noqa`.
|
||||
# Neither of these are ignored and warning is
|
||||
# logged to user
|
||||
I = 1 # noqa: E741.F841
|
||||
|
|
|
@ -293,7 +293,14 @@ impl<'a> Checker<'a> {
|
|||
if !self.noqa.is_enabled() {
|
||||
return false;
|
||||
}
|
||||
noqa::rule_is_ignored(code, offset, self.noqa_line_for, self.locator)
|
||||
|
||||
noqa::rule_is_ignored(
|
||||
code,
|
||||
offset,
|
||||
self.noqa_line_for,
|
||||
self.comment_ranges(),
|
||||
self.locator,
|
||||
)
|
||||
}
|
||||
|
||||
/// Create a [`Generator`] to generate source code based on the current AST state.
|
||||
|
|
|
@ -38,7 +38,8 @@ pub(crate) fn check_noqa(
|
|||
let exemption = FileExemption::from(&file_noqa_directives);
|
||||
|
||||
// Extract all `noqa` directives.
|
||||
let mut noqa_directives = NoqaDirectives::from_commented_ranges(comment_ranges, path, locator);
|
||||
let mut noqa_directives =
|
||||
NoqaDirectives::from_commented_ranges(comment_ranges, &settings.external, path, locator);
|
||||
|
||||
// Indices of diagnostics that were ignored by a `noqa` directive.
|
||||
let mut ignored_diagnostics = vec![];
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -3,7 +3,7 @@ use ruff_macros::{derive_message_formats, ViolationMetadata};
|
|||
use ruff_python_trivia::Cursor;
|
||||
use ruff_text_size::{Ranged, TextRange};
|
||||
|
||||
use crate::noqa::{Directive, FileNoqaDirectives, NoqaDirectives, ParsedFileExemption};
|
||||
use crate::noqa::{self, Directive, FileNoqaDirectives, NoqaDirectives};
|
||||
use crate::settings::types::PreviewMode;
|
||||
use crate::Locator;
|
||||
|
||||
|
@ -46,7 +46,6 @@ use crate::Locator;
|
|||
#[derive(ViolationMetadata)]
|
||||
pub(crate) struct BlanketNOQA {
|
||||
missing_colon: bool,
|
||||
space_before_colon: bool,
|
||||
file_exemption: bool,
|
||||
}
|
||||
|
||||
|
@ -57,27 +56,22 @@ impl Violation for BlanketNOQA {
|
|||
fn message(&self) -> String {
|
||||
let BlanketNOQA {
|
||||
missing_colon,
|
||||
space_before_colon,
|
||||
file_exemption,
|
||||
} = self;
|
||||
// This awkward branching is necessary to ensure that the generic message is picked up by
|
||||
// `derive_message_formats`.
|
||||
if !missing_colon && !space_before_colon && !file_exemption {
|
||||
if !missing_colon && !file_exemption {
|
||||
"Use specific rule codes when using `noqa`".to_string()
|
||||
} else if *file_exemption {
|
||||
"Use specific rule codes when using `ruff: noqa`".to_string()
|
||||
} else if *missing_colon {
|
||||
"Use a colon when specifying `noqa` rule codes".to_string()
|
||||
} else {
|
||||
"Do not add spaces between `noqa` and its colon".to_string()
|
||||
"Use a colon when specifying `noqa` rule codes".to_string()
|
||||
}
|
||||
}
|
||||
|
||||
fn fix_title(&self) -> Option<String> {
|
||||
if self.missing_colon {
|
||||
Some("Add missing colon".to_string())
|
||||
} else if self.space_before_colon {
|
||||
Some("Remove space(s) before colon".to_string())
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
@ -94,11 +88,10 @@ pub(crate) fn blanket_noqa(
|
|||
) {
|
||||
if preview.is_enabled() {
|
||||
for line in file_noqa_directives.lines() {
|
||||
if let ParsedFileExemption::All = line.parsed_file_exemption {
|
||||
if let Directive::All(_) = line.parsed_file_exemption {
|
||||
diagnostics.push(Diagnostic::new(
|
||||
BlanketNOQA {
|
||||
missing_colon: false,
|
||||
space_before_colon: false,
|
||||
file_exemption: true,
|
||||
},
|
||||
line.range(),
|
||||
|
@ -116,22 +109,7 @@ pub(crate) fn blanket_noqa(
|
|||
let mut cursor = Cursor::new(&line[noqa_end.to_usize()..]);
|
||||
cursor.eat_while(char::is_whitespace);
|
||||
|
||||
// Check for extraneous spaces before the colon.
|
||||
// Ex) `# noqa : F401`
|
||||
if cursor.first() == ':' {
|
||||
let start = all.end();
|
||||
let end = start + cursor.token_len();
|
||||
let mut diagnostic = Diagnostic::new(
|
||||
BlanketNOQA {
|
||||
missing_colon: false,
|
||||
space_before_colon: true,
|
||||
file_exemption: false,
|
||||
},
|
||||
TextRange::new(all.start(), end),
|
||||
);
|
||||
diagnostic.set_fix(Fix::unsafe_edit(Edit::deletion(start, end)));
|
||||
diagnostics.push(diagnostic);
|
||||
} else if Directive::lex_code(cursor.chars().as_str()).is_some() {
|
||||
if noqa::lex_codes(cursor.chars().as_str()).is_ok_and(|codes| !codes.is_empty()) {
|
||||
// Check for a missing colon.
|
||||
// Ex) `# noqa F401`
|
||||
let start = all.end();
|
||||
|
@ -139,7 +117,6 @@ pub(crate) fn blanket_noqa(
|
|||
let mut diagnostic = Diagnostic::new(
|
||||
BlanketNOQA {
|
||||
missing_colon: true,
|
||||
space_before_colon: false,
|
||||
file_exemption: false,
|
||||
},
|
||||
TextRange::new(all.start(), end),
|
||||
|
@ -151,7 +128,6 @@ pub(crate) fn blanket_noqa(
|
|||
diagnostics.push(Diagnostic::new(
|
||||
BlanketNOQA {
|
||||
missing_colon: false,
|
||||
space_before_colon: false,
|
||||
file_exemption: false,
|
||||
},
|
||||
all.range(),
|
||||
|
|
|
@ -68,58 +68,3 @@ PGH004_0.py:21:8: PGH004 [*] Use a colon when specifying `noqa` rule codes
|
|||
22 22 |
|
||||
23 23 | # PGH004
|
||||
24 24 | x = 2 # noqa : X300
|
||||
|
||||
PGH004_0.py:24:8: PGH004 [*] Do not add spaces between `noqa` and its colon
|
||||
|
|
||||
23 | # PGH004
|
||||
24 | x = 2 # noqa : X300
|
||||
| ^^^^^^^ PGH004
|
||||
25 |
|
||||
26 | # PGH004
|
||||
|
|
||||
= help: Remove space(s) before colon
|
||||
|
||||
ℹ Unsafe fix
|
||||
21 21 | x = 2 # noqa X100, X200
|
||||
22 22 |
|
||||
23 23 | # PGH004
|
||||
24 |-x = 2 # noqa : X300
|
||||
24 |+x = 2 # noqa: X300
|
||||
25 25 |
|
||||
26 26 | # PGH004
|
||||
27 27 | x = 2 # noqa : X400
|
||||
|
||||
PGH004_0.py:27:8: PGH004 [*] Do not add spaces between `noqa` and its colon
|
||||
|
|
||||
26 | # PGH004
|
||||
27 | x = 2 # noqa : X400
|
||||
| ^^^^^^^^ PGH004
|
||||
28 |
|
||||
29 | # PGH004
|
||||
|
|
||||
= help: Remove space(s) before colon
|
||||
|
||||
ℹ Unsafe fix
|
||||
24 24 | x = 2 # noqa : X300
|
||||
25 25 |
|
||||
26 26 | # PGH004
|
||||
27 |-x = 2 # noqa : X400
|
||||
27 |+x = 2 # noqa: X400
|
||||
28 28 |
|
||||
29 29 | # PGH004
|
||||
30 30 | x = 2 # noqa :X500
|
||||
|
||||
PGH004_0.py:30:8: PGH004 [*] Do not add spaces between `noqa` and its colon
|
||||
|
|
||||
29 | # PGH004
|
||||
30 | x = 2 # noqa :X500
|
||||
| ^^^^^^^ PGH004
|
||||
|
|
||||
= help: Remove space(s) before colon
|
||||
|
||||
ℹ Unsafe fix
|
||||
27 27 | x = 2 # noqa : X400
|
||||
28 28 |
|
||||
29 29 | # PGH004
|
||||
30 |-x = 2 # noqa :X500
|
||||
30 |+x = 2 # noqa:X500
|
||||
|
|
|
@ -2,7 +2,7 @@ use ruff_diagnostics::{AlwaysFixableViolation, Diagnostic, Edit, Fix};
|
|||
use ruff_macros::{derive_message_formats, ViolationMetadata};
|
||||
use ruff_text_size::Ranged;
|
||||
|
||||
use crate::noqa::{Codes, Directive, FileNoqaDirectives, NoqaDirectives, ParsedFileExemption};
|
||||
use crate::noqa::{Codes, Directive, FileNoqaDirectives, NoqaDirectives};
|
||||
use crate::rule_redirects::get_redirect_target;
|
||||
|
||||
/// ## What it does
|
||||
|
@ -59,7 +59,7 @@ pub(crate) fn redirected_file_noqa(
|
|||
noqa_directives: &FileNoqaDirectives,
|
||||
) {
|
||||
for line in noqa_directives.lines() {
|
||||
let ParsedFileExemption::Codes(codes) = &line.parsed_file_exemption else {
|
||||
let Directive::Codes(codes) = &line.parsed_file_exemption else {
|
||||
continue;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,19 +1,26 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/rules/ruff/mod.rs
|
||||
snapshot_kind: text
|
||||
---
|
||||
noqa.py:23:5: F841 [*] Local variable `I` is assigned to but never used
|
||||
noqa.py:24:5: E741 Ambiguous variable name: `I`
|
||||
|
|
||||
21 | def f():
|
||||
22 | # Only `E741` should be ignored by the `noqa`.
|
||||
23 | I = 1 # noqa: E741.F841
|
||||
22 | # Neither of these are ignored and warning is
|
||||
23 | # logged to user
|
||||
24 | I = 1 # noqa: E741.F841
|
||||
| ^ E741
|
||||
|
|
||||
|
||||
noqa.py:24:5: F841 [*] Local variable `I` is assigned to but never used
|
||||
|
|
||||
22 | # Neither of these are ignored and warning is
|
||||
23 | # logged to user
|
||||
24 | I = 1 # noqa: E741.F841
|
||||
| ^ F841
|
||||
|
|
||||
= help: Remove assignment to unused variable `I`
|
||||
|
||||
ℹ Unsafe fix
|
||||
20 20 |
|
||||
21 21 | def f():
|
||||
22 22 | # Only `E741` should be ignored by the `noqa`.
|
||||
23 |- I = 1 # noqa: E741.F841
|
||||
23 |+ pass # noqa: E741.F841
|
||||
22 22 | # Neither of these are ignored and warning is
|
||||
23 23 | # logged to user
|
||||
24 |- I = 1 # noqa: E741.F841
|
||||
24 |+ pass # noqa: E741.F841
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "ParsedFileExemption::try_extract(TextRange::up_to(source.text_len()), source,)"
|
||||
snapshot_kind: text
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
All,
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..14,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "ParsedFileExemption::try_extract(TextRange::up_to(source.text_len()), source,)"
|
||||
snapshot_kind: text
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
All,
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..14,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "ParsedFileExemption::try_extract(TextRange::up_to(source.text_len()), source,)"
|
||||
snapshot_kind: text
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
All,
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..12,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "ParsedFileExemption::try_extract(TextRange::up_to(source.text_len()), source,)"
|
||||
snapshot_kind: text
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..26,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 16..20,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 22..26,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..26,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 16..20,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 22..26,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
All(
|
||||
All {
|
||||
range: 0..6,
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..6,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
All(
|
||||
All {
|
||||
range: 0..6,
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..6,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
All(
|
||||
All {
|
||||
range: 35..41,
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 35..41,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
All(
|
||||
All {
|
||||
range: 0..7,
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..7,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
All(
|
||||
All {
|
||||
range: 0..5,
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..5,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
All(
|
||||
All {
|
||||
range: 0..6,
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..6,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..12,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..12,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..12,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..12,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: directive
|
||||
---
|
||||
Err(
|
||||
InvalidCodeSuffix,
|
||||
)
|
|
@ -1,20 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 35..47,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 43..47,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 35..47,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 43..47,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 2..13,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 9..13,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 6..18,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 14..18,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
|
@ -1,20 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..13,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 9..13,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..13,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 9..13,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..10,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 6..10,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..10,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 6..10,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..12,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..12,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..18,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 14..18,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..18,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 14..18,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..18,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 14..18,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..18,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 14..18,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 35..53,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 43..47,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 49..53,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 35..53,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 43..47,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 49..53,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..20,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 9..13,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 16..20,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..20,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 9..13,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 16..20,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..15,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 6..10,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 11..15,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..15,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 6..10,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 11..15,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,24 +1,26 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..18,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 14..18,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..18,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 14..18,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,24 +1,30 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..18,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 14..18,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [
|
||||
MissingItem(
|
||||
13..13,
|
||||
),
|
||||
],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..18,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 14..18,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,24 +1,30 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..19,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 15..19,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [
|
||||
MissingItem(
|
||||
13..14,
|
||||
),
|
||||
],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..19,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 15..19,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 4..16,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 12..16,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 4..16,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 12..16,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: lex_codes(&source)
|
||||
---
|
||||
Ok(
|
||||
[
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 1..5,
|
||||
},
|
||||
Code {
|
||||
code: "F402",
|
||||
range: 7..11,
|
||||
},
|
||||
Code {
|
||||
code: "F403",
|
||||
range: 11..15,
|
||||
},
|
||||
],
|
||||
)
|
|
@ -1,20 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..12,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..12,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,24 +1,30 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..16,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 12..16,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [
|
||||
MissingDelimiter(
|
||||
12..12,
|
||||
),
|
||||
],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..16,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 12..16,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,20 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "Directive::try_extract(source, TextSize::default())"
|
||||
snapshot_kind: text
|
||||
expression: directive
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..12,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..12,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 8..12,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "ParsedFileExemption::try_extract(TextRange::up_to(source.text_len()), source,)"
|
||||
snapshot_kind: text
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
All,
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..12,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -1,10 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "ParsedFileExemption::try_extract(TextRange::up_to(source.text_len()), source,)"
|
||||
snapshot_kind: text
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
All,
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..12,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 18..30,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
|
@ -1,10 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "ParsedFileExemption::try_extract(TextRange::up_to(source.text_len()), source,)"
|
||||
snapshot_kind: text
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
All,
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..10,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..12,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..12,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: All(
|
||||
All {
|
||||
range: 0..12,
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 18..36,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 32..36,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..18,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 14..18,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..18,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 14..18,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..18,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 14..18,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
|
@ -1,24 +1,26 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: "ParsedFileExemption::try_extract(TextRange::up_to(source.text_len()), source,)"
|
||||
snapshot_kind: text
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
Codes(
|
||||
Codes {
|
||||
range: 0..24,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 14..18,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 20..24,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..24,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 14..18,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 20..24,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 3..27,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 17..21,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 23..27,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [
|
||||
MissingItem(
|
||||
19..19,
|
||||
),
|
||||
],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..24,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 14..18,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 20..24,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [
|
||||
MissingItem(
|
||||
19..20,
|
||||
),
|
||||
],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..25,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 14..18,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 21..25,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: exemption
|
||||
---
|
||||
Err(
|
||||
InvalidCodeSuffix,
|
||||
)
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
source: crates/ruff_linter/src/noqa.rs
|
||||
expression: exemption
|
||||
---
|
||||
Ok(
|
||||
Some(
|
||||
NoqaLexerOutput {
|
||||
warnings: [
|
||||
MissingDelimiter(
|
||||
18..18,
|
||||
),
|
||||
],
|
||||
directive: Codes(
|
||||
Codes {
|
||||
range: 0..22,
|
||||
codes: [
|
||||
Code {
|
||||
code: "F401",
|
||||
range: 14..18,
|
||||
},
|
||||
Code {
|
||||
code: "F841",
|
||||
range: 18..22,
|
||||
},
|
||||
],
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue