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

TD003: remove issue code length restriction #15175

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
# TODO: this comment has an issue
# TDO-3870

# TODO: the link has an issue code of the minimum length
# T-001

# TODO: the link has an issue code of the maximum length
# ABCDEFGHIJKL-001

# TDO003 - errors
# TODO: this comment has no
# link after it
Expand All @@ -29,3 +35,6 @@ def foo(x):
# foo # TODO: no link!

# TODO: here's a TODO on the last line with no link

# TODO: the link has an issue code beyond the maximum length
# ABCDEFGHIJKLM-001
6 changes: 3 additions & 3 deletions crates/ruff_linter/src/rules/flake8_todos/rules/todos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,9 @@ impl Violation for MissingSpaceAfterTodoColon {

static ISSUE_LINK_REGEX_SET: LazyLock<RegexSet> = LazyLock::new(|| {
RegexSet::new([
r"^#\s*(http|https)://.*", // issue link
r"^#\s*\d+$", // issue code - like "003"
r"^#\s*[A-Z]{1,6}\-?\d+$", // issue code - like "TD003"
r"^#\s*(http|https)://.*", // issue link
r"^#\s*\d+$", // issue code - like "003"
r"^#\s*[A-Z]{1,12}\-?\d+$", // issue code - like "TD003"
MichaReiser marked this conversation as resolved.
Show resolved Hide resolved
])
.unwrap()
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,59 @@
source: crates/ruff_linter/src/rules/flake8_todos/mod.rs
snapshot_kind: text
---
TD003.py:9:3: TD003 Missing issue link on the line following this TODO
TD003.py:15:3: TD003 Missing issue link on the line following this TODO
|
8 | # TDO003 - errors
9 | # TODO: this comment has no
14 | # TDO003 - errors
15 | # TODO: this comment has no
| ^^^^ TD003
10 | # link after it
16 | # link after it
|

TD003.py:12:3: TD003 Missing issue link on the line following this TODO
TD003.py:18:3: TD003 Missing issue link on the line following this TODO
|
10 | # link after it
11 |
12 | # TODO: here's a TODO with no link after it
16 | # link after it
17 |
18 | # TODO: here's a TODO with no link after it
| ^^^^ TD003
13 | def foo(x):
14 | return x
19 | def foo(x):
20 | return x
|

TD003.py:25:3: TD003 Missing issue link on the line following this TODO
TD003.py:31:3: TD003 Missing issue link on the line following this TODO
|
23 | # TDO-3870
24 |
25 | # TODO: here's a TODO without an issue link
29 | # TDO-3870
30 |
31 | # TODO: here's a TODO without an issue link
| ^^^^ TD003
26 | # TODO: followed by a new TODO with an issue link
27 | # TDO-3870
32 | # TODO: followed by a new TODO with an issue link
33 | # TDO-3870
|

TD003.py:29:9: TD003 Missing issue link on the line following this TODO
TD003.py:35:9: TD003 Missing issue link on the line following this TODO
|
27 | # TDO-3870
28 |
29 | # foo # TODO: no link!
33 | # TDO-3870
34 |
35 | # foo # TODO: no link!
| ^^^^ TD003
30 |
31 | # TODO: here's a TODO on the last line with no link
36 |
37 | # TODO: here's a TODO on the last line with no link
|

TD003.py:31:3: TD003 Missing issue link on the line following this TODO
TD003.py:37:3: TD003 Missing issue link on the line following this TODO
|
29 | # foo # TODO: no link!
30 |
31 | # TODO: here's a TODO on the last line with no link
35 | # foo # TODO: no link!
36 |
37 | # TODO: here's a TODO on the last line with no link
| ^^^^ TD003
38 |
39 | # TODO: the link has an issue code beyond the maximum length
|

TD003.py:39:3: TD003 Missing issue link on the line following this TODO
|
37 | # TODO: here's a TODO on the last line with no link
38 |
39 | # TODO: the link has an issue code beyond the maximum length
| ^^^^ TD003
40 | # ABCDEFGHIJKLM-001
|
Loading