Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move flake8-fixme rules to FIX prefix #4917

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/ruff/src/registry.rs
Original file line number Diff line number Diff line change
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
4 changes: 4 additions & 0 deletions crates/ruff/src/rule_redirects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
])
});
8 changes: 4 additions & 4 deletions crates/ruff/src/rules/flake8_fixme/rules/todos.rs
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
|


Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
14 changes: 7 additions & 7 deletions ruff.schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.