Skip to content

Commit 20240fc

Browse files
Move flake8-fixme rules to FIX prefix (#4917)
1 parent f990d9d commit 20240fc

9 files changed

+38
-34
lines changed

crates/ruff/src/registry.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ pub enum Linter {
159159
#[prefix = "TD"]
160160
Flake8Todos,
161161
/// [flake8-fixme](https://github.com/tommilligan/flake8-fixme)
162-
#[prefix = "T"]
162+
#[prefix = "FIX"]
163163
Flake8Fixme,
164164
/// [eradicate](https://pypi.org/project/eradicate/)
165165
#[prefix = "ERA"]

crates/ruff/src/rule_redirects.rs

+4
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,9 @@ static REDIRECTS: Lazy<HashMap<&'static str, &'static str>> = Lazy::new(|| {
9494
("RUF004", "B026"),
9595
("PIE802", "C419"),
9696
("PLW0130", "B033"),
97+
("T001", "FIX001"),
98+
("T002", "FIX002"),
99+
("T003", "FIX003"),
100+
("T004", "FIX004"),
97101
])
98102
});

crates/ruff/src/rules/flake8_fixme/rules/todos.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,13 @@ pub(crate) fn todos(directive_ranges: &[TodoComment]) -> Vec<Diagnostic> {
4343
directive_ranges
4444
.iter()
4545
.map(|TodoComment { directive, .. }| match directive.kind {
46-
// T-001
46+
// FIX001
4747
TodoDirectiveKind::Fixme => Diagnostic::new(LineContainsFixme, directive.range),
48-
// T-002
48+
// FIX002
4949
TodoDirectiveKind::Hack => Diagnostic::new(LineContainsHack, directive.range),
50-
// T-003
50+
// FIX003
5151
TodoDirectiveKind::Todo => Diagnostic::new(LineContainsTodo, directive.range),
52-
// T-004
52+
// FIX004
5353
TodoDirectiveKind::Xxx => Diagnostic::new(LineContainsXxx, directive.range),
5454
})
5555
.collect::<Vec<Diagnostic>>()
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
---
22
source: crates/ruff/src/rules/flake8_fixme/mod.rs
33
---
4-
T00.py:7:3: T001 Line contains FIXME
4+
T00.py:7:3: FIX001 Line contains FIXME
55
|
66
7 | # HACK: hack
77
8 | # hack: hack
88
9 | # FIXME: fixme
9-
| ^^^^^ T001
9+
| ^^^^^ FIX001
1010
10 | # fixme: fixme
1111
|
1212

13-
T00.py:8:3: T001 Line contains FIXME
13+
T00.py:8:3: FIX001 Line contains FIXME
1414
|
1515
8 | # hack: hack
1616
9 | # FIXME: fixme
1717
10 | # fixme: fixme
18-
| ^^^^^ T001
18+
| ^^^^^ FIX001
1919
|
2020

2121

crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-hack_T00.py.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
22
source: crates/ruff/src/rules/flake8_fixme/mod.rs
33
---
4-
T00.py:5:3: T004 Line contains HACK
4+
T00.py:5:3: FIX004 Line contains HACK
55
|
66
5 | # XXX: xxx
77
6 | # xxx: xxx
88
7 | # HACK: hack
9-
| ^^^^ T004
9+
| ^^^^ FIX004
1010
8 | # hack: hack
1111
9 | # FIXME: fixme
1212
|
1313

14-
T00.py:6:3: T004 Line contains HACK
14+
T00.py:6:3: FIX004 Line contains HACK
1515
|
1616
6 | # xxx: xxx
1717
7 | # HACK: hack
1818
8 | # hack: hack
19-
| ^^^^ T004
19+
| ^^^^ FIX004
2020
9 | # FIXME: fixme
2121
10 | # fixme: fixme
2222
|

crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
---
22
source: crates/ruff/src/rules/flake8_fixme/mod.rs
33
---
4-
T00.py:1:3: T002 Line contains TODO
4+
T00.py:1:3: FIX002 Line contains TODO
55
|
66
1 | # TODO: todo
7-
| ^^^^ T002
7+
| ^^^^ FIX002
88
2 | # todo: todo
99
3 | # XXX: xxx
1010
|
1111

12-
T00.py:2:3: T002 Line contains TODO
12+
T00.py:2:3: FIX002 Line contains TODO
1313
|
1414
2 | # TODO: todo
1515
3 | # todo: todo
16-
| ^^^^ T002
16+
| ^^^^ FIX002
1717
4 | # XXX: xxx
1818
5 | # xxx: xxx
1919
|

crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-xxx_T00.py.snap

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
22
source: crates/ruff/src/rules/flake8_fixme/mod.rs
33
---
4-
T00.py:3:3: T003 Line contains XXX
4+
T00.py:3:3: FIX003 Line contains XXX
55
|
66
3 | # TODO: todo
77
4 | # todo: todo
88
5 | # XXX: xxx
9-
| ^^^ T003
9+
| ^^^ FIX003
1010
6 | # xxx: xxx
1111
7 | # HACK: hack
1212
|
1313

14-
T00.py:4:3: T003 Line contains XXX
14+
T00.py:4:3: FIX003 Line contains XXX
1515
|
1616
4 | # todo: todo
1717
5 | # XXX: xxx
1818
6 | # xxx: xxx
19-
| ^^^ T003
19+
| ^^^ FIX003
2020
7 | # HACK: hack
2121
8 | # hack: hack
2222
|

crates/ruff/src/rules/flake8_todos/rules/todos.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ pub(crate) fn todos(
293293
}
294294

295295
if !has_issue_link {
296-
// TD-003
296+
// TD003
297297
diagnostics.push(Diagnostic::new(MissingTodoLink, directive.range));
298298
}
299299
}
@@ -359,7 +359,7 @@ fn static_errors(
359359
trimmed.text_len()
360360
}
361361
} else {
362-
// TD-002
362+
// TD002
363363
diagnostics.push(Diagnostic::new(MissingTodoAuthor, directive.range));
364364

365365
TextSize::new(0)
@@ -368,18 +368,18 @@ fn static_errors(
368368
let after_author = &post_directive[usize::from(author_end)..];
369369
if let Some(after_colon) = after_author.strip_prefix(':') {
370370
if after_colon.is_empty() {
371-
// TD-005
371+
// TD005
372372
diagnostics.push(Diagnostic::new(MissingTodoDescription, directive.range));
373373
} else if !after_colon.starts_with(char::is_whitespace) {
374-
// TD-007
374+
// TD007
375375
diagnostics.push(Diagnostic::new(MissingSpaceAfterTodoColon, directive.range));
376376
}
377377
} else {
378-
// TD-004
378+
// TD004
379379
diagnostics.push(Diagnostic::new(MissingTodoColon, directive.range));
380380

381381
if after_author.is_empty() {
382-
// TD-005
382+
// TD005
383383
diagnostics.push(Diagnostic::new(MissingTodoDescription, directive.range));
384384
}
385385
}

ruff.schema.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)