diff --git a/crates/ruff/src/registry.rs b/crates/ruff/src/registry.rs index 8d2b1baa1ed32..c57390c0598d6 100644 --- a/crates/ruff/src/registry.rs +++ b/crates/ruff/src/registry.rs @@ -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"] diff --git a/crates/ruff/src/rule_redirects.rs b/crates/ruff/src/rule_redirects.rs index ebf63dddd036c..a9fd305027db2 100644 --- a/crates/ruff/src/rule_redirects.rs +++ b/crates/ruff/src/rule_redirects.rs @@ -94,5 +94,9 @@ static REDIRECTS: Lazy> = Lazy::new(|| { ("RUF004", "B026"), ("PIE802", "C419"), ("PLW0130", "B033"), + ("T001", "FIX001"), + ("T002", "FIX002"), + ("T003", "FIX003"), + ("T004", "FIX004"), ]) }); diff --git a/crates/ruff/src/rules/flake8_fixme/rules/todos.rs b/crates/ruff/src/rules/flake8_fixme/rules/todos.rs index 1d6d4d05c234d..495fccc030f59 100644 --- a/crates/ruff/src/rules/flake8_fixme/rules/todos.rs +++ b/crates/ruff/src/rules/flake8_fixme/rules/todos.rs @@ -43,13 +43,13 @@ pub(crate) fn todos(directive_ranges: &[TodoComment]) -> Vec { 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::>() diff --git a/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap b/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap index aaefcbcfec692..51153377ed4c1 100644 --- a/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap +++ b/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-fixme_T00.py.snap @@ -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 | diff --git a/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-hack_T00.py.snap b/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-hack_T00.py.snap index 8125bd7c938cd..8a06eed829f27 100644 --- a/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-hack_T00.py.snap +++ b/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-hack_T00.py.snap @@ -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 | diff --git a/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap b/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap index 73de9d6898bc9..9abe705e8a41b 100644 --- a/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap +++ b/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-todo_T00.py.snap @@ -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 | diff --git a/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-xxx_T00.py.snap b/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-xxx_T00.py.snap index 9f826cdbdab91..a72d1e51b668f 100644 --- a/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-xxx_T00.py.snap +++ b/crates/ruff/src/rules/flake8_fixme/snapshots/ruff__rules__flake8_fixme__tests__line-contains-xxx_T00.py.snap @@ -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 | diff --git a/crates/ruff/src/rules/flake8_todos/rules/todos.rs b/crates/ruff/src/rules/flake8_todos/rules/todos.rs index bbc456a9f1d6d..07fc25b2cf877 100644 --- a/crates/ruff/src/rules/flake8_todos/rules/todos.rs +++ b/crates/ruff/src/rules/flake8_todos/rules/todos.rs @@ -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)); } } diff --git a/ruff.schema.json b/ruff.schema.json index 7076a7c2c5998..ec762028df6a1 100644 --- a/ruff.schema.json +++ b/ruff.schema.json @@ -1918,6 +1918,13 @@ "FBT001", "FBT002", "FBT003", + "FIX", + "FIX0", + "FIX00", + "FIX001", + "FIX002", + "FIX003", + "FIX004", "FLY", "FLY0", "FLY00", @@ -2408,13 +2415,6 @@ "SLF00", "SLF001", "T", - "T", - "T0", - "T00", - "T001", - "T002", - "T003", - "T004", "T1", "T10", "T100",