mirror of
https://github.com/astral-sh/ruff.git
synced 2025-08-03 10:23:11 +00:00
Move flake8-fixme rules to FIX prefix (#4917)
This commit is contained in:
parent
f990d9dcc5
commit
20240fc3d9
9 changed files with 38 additions and 34 deletions
|
@ -159,7 +159,7 @@ pub enum Linter {
|
|||
#[prefix = "TD"]
|
||||
Flake8Todos,
|
||||
/// [flake8-fixme](https://github.com/tommilligan/flake8-fixme)
|
||||
#[prefix = "T"]
|
||||
#[prefix = "FIX"]
|
||||
Flake8Fixme,
|
||||
/// [eradicate](https://pypi.org/project/eradicate/)
|
||||
#[prefix = "ERA"]
|
||||
|
|
|
@ -94,5 +94,9 @@ static REDIRECTS: Lazy<HashMap<&'static str, &'static str>> = Lazy::new(|| {
|
|||
("RUF004", "B026"),
|
||||
("PIE802", "C419"),
|
||||
("PLW0130", "B033"),
|
||||
("T001", "FIX001"),
|
||||
("T002", "FIX002"),
|
||||
("T003", "FIX003"),
|
||||
("T004", "FIX004"),
|
||||
])
|
||||
});
|
||||
|
|
|
@ -43,13 +43,13 @@ pub(crate) fn todos(directive_ranges: &[TodoComment]) -> Vec<Diagnostic> {
|
|||
directive_ranges
|
||||
.iter()
|
||||
.map(|TodoComment { directive, .. }| match directive.kind {
|
||||
// T-001
|
||||
// FIX001
|
||||
TodoDirectiveKind::Fixme => Diagnostic::new(LineContainsFixme, directive.range),
|
||||
// T-002
|
||||
// FIX002
|
||||
TodoDirectiveKind::Hack => Diagnostic::new(LineContainsHack, directive.range),
|
||||
// T-003
|
||||
// FIX003
|
||||
TodoDirectiveKind::Todo => Diagnostic::new(LineContainsTodo, directive.range),
|
||||
// T-004
|
||||
// FIX004
|
||||
TodoDirectiveKind::Xxx => Diagnostic::new(LineContainsXxx, directive.range),
|
||||
})
|
||||
.collect::<Vec<Diagnostic>>()
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_fixme/mod.rs
|
||||
---
|
||||
T00.py:7:3: T001 Line contains FIXME
|
||||
T00.py:7:3: FIX001 Line contains FIXME
|
||||
|
|
||||
7 | # HACK: hack
|
||||
8 | # hack: hack
|
||||
9 | # FIXME: fixme
|
||||
| ^^^^^ T001
|
||||
| ^^^^^ FIX001
|
||||
10 | # fixme: fixme
|
||||
|
|
||||
|
||||
T00.py:8:3: T001 Line contains FIXME
|
||||
T00.py:8:3: FIX001 Line contains FIXME
|
||||
|
|
||||
8 | # hack: hack
|
||||
9 | # FIXME: fixme
|
||||
10 | # fixme: fixme
|
||||
| ^^^^^ T001
|
||||
| ^^^^^ FIX001
|
||||
|
|
||||
|
||||
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_fixme/mod.rs
|
||||
---
|
||||
T00.py:5:3: T004 Line contains HACK
|
||||
T00.py:5:3: FIX004 Line contains HACK
|
||||
|
|
||||
5 | # XXX: xxx
|
||||
6 | # xxx: xxx
|
||||
7 | # HACK: hack
|
||||
| ^^^^ T004
|
||||
| ^^^^ FIX004
|
||||
8 | # hack: hack
|
||||
9 | # FIXME: fixme
|
||||
|
|
||||
|
||||
T00.py:6:3: T004 Line contains HACK
|
||||
T00.py:6:3: FIX004 Line contains HACK
|
||||
|
|
||||
6 | # xxx: xxx
|
||||
7 | # HACK: hack
|
||||
8 | # hack: hack
|
||||
| ^^^^ T004
|
||||
| ^^^^ FIX004
|
||||
9 | # FIXME: fixme
|
||||
10 | # fixme: fixme
|
||||
|
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_fixme/mod.rs
|
||||
---
|
||||
T00.py:1:3: T002 Line contains TODO
|
||||
T00.py:1:3: FIX002 Line contains TODO
|
||||
|
|
||||
1 | # TODO: todo
|
||||
| ^^^^ T002
|
||||
| ^^^^ FIX002
|
||||
2 | # todo: todo
|
||||
3 | # XXX: xxx
|
||||
|
|
||||
|
||||
T00.py:2:3: T002 Line contains TODO
|
||||
T00.py:2:3: FIX002 Line contains TODO
|
||||
|
|
||||
2 | # TODO: todo
|
||||
3 | # todo: todo
|
||||
| ^^^^ T002
|
||||
| ^^^^ FIX002
|
||||
4 | # XXX: xxx
|
||||
5 | # xxx: xxx
|
||||
|
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
---
|
||||
source: crates/ruff/src/rules/flake8_fixme/mod.rs
|
||||
---
|
||||
T00.py:3:3: T003 Line contains XXX
|
||||
T00.py:3:3: FIX003 Line contains XXX
|
||||
|
|
||||
3 | # TODO: todo
|
||||
4 | # todo: todo
|
||||
5 | # XXX: xxx
|
||||
| ^^^ T003
|
||||
| ^^^ FIX003
|
||||
6 | # xxx: xxx
|
||||
7 | # HACK: hack
|
||||
|
|
||||
|
||||
T00.py:4:3: T003 Line contains XXX
|
||||
T00.py:4:3: FIX003 Line contains XXX
|
||||
|
|
||||
4 | # todo: todo
|
||||
5 | # XXX: xxx
|
||||
6 | # xxx: xxx
|
||||
| ^^^ T003
|
||||
| ^^^ FIX003
|
||||
7 | # HACK: hack
|
||||
8 | # hack: hack
|
||||
|
|
||||
|
|
|
@ -293,7 +293,7 @@ pub(crate) fn todos(
|
|||
}
|
||||
|
||||
if !has_issue_link {
|
||||
// TD-003
|
||||
// TD003
|
||||
diagnostics.push(Diagnostic::new(MissingTodoLink, directive.range));
|
||||
}
|
||||
}
|
||||
|
@ -359,7 +359,7 @@ fn static_errors(
|
|||
trimmed.text_len()
|
||||
}
|
||||
} else {
|
||||
// TD-002
|
||||
// TD002
|
||||
diagnostics.push(Diagnostic::new(MissingTodoAuthor, directive.range));
|
||||
|
||||
TextSize::new(0)
|
||||
|
@ -368,18 +368,18 @@ fn static_errors(
|
|||
let after_author = &post_directive[usize::from(author_end)..];
|
||||
if let Some(after_colon) = after_author.strip_prefix(':') {
|
||||
if after_colon.is_empty() {
|
||||
// TD-005
|
||||
// TD005
|
||||
diagnostics.push(Diagnostic::new(MissingTodoDescription, directive.range));
|
||||
} else if !after_colon.starts_with(char::is_whitespace) {
|
||||
// TD-007
|
||||
// TD007
|
||||
diagnostics.push(Diagnostic::new(MissingSpaceAfterTodoColon, directive.range));
|
||||
}
|
||||
} else {
|
||||
// TD-004
|
||||
// TD004
|
||||
diagnostics.push(Diagnostic::new(MissingTodoColon, directive.range));
|
||||
|
||||
if after_author.is_empty() {
|
||||
// TD-005
|
||||
// TD005
|
||||
diagnostics.push(Diagnostic::new(MissingTodoDescription, directive.range));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue