Skip to content

Commit

Permalink
Move flake8-fixme rules to FIX prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jun 7, 2023
1 parent b9060ea commit c0caa75
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion crates/ruff/src/registry.rs
Expand Up @@ -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"]
Expand Down
8 changes: 4 additions & 4 deletions crates/ruff/src/rules/flake8_fixme/rules/todos.rs
Expand Up @@ -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>>()
Expand Down
@@ -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
|
Expand Down
@@ -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
|
Expand Down
@@ -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
|
Expand Down
12 changes: 6 additions & 6 deletions crates/ruff/src/rules/flake8_todos/rules/todos.rs
Expand Up @@ -293,7 +293,7 @@ pub(crate) fn todos(
}

if !has_issue_link {
// TD-003
// TD003
diagnostics.push(Diagnostic::new(MissingTodoLink, directive.range));
}
}
Expand Down Expand Up @@ -359,7 +359,7 @@ fn static_errors(
trimmed.text_len()
}
} else {
// TD-002
// TD002
diagnostics.push(Diagnostic::new(MissingTodoAuthor, directive.range));

TextSize::new(0)
Expand All @@ -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));
}
}
Expand Down

0 comments on commit c0caa75

Please sign in to comment.