Skip to content

Commit

Permalink
TD003: increase max issue code length to 12 characters
Browse files Browse the repository at this point in the history
  • Loading branch information
mdbernard committed Dec 29, 2024
1 parent 7ea3a54 commit 3b0a1be
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
# TODO: this comment has no
# link after it

# 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

# TODO: the link has an issue code beyond the maximum length
# ABCDEFGHIJKLM-001

# TODO: here's a TODO with no link after it
def foo(x):
return x
Expand Down
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"
])
.unwrap()
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,49 @@ TD003.py:9:3: TD003 Missing issue link on the line following this TODO
10 | # 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 | # ABCDEFGHIJKL-001
17 |
18 | # TODO: the link has an issue code beyond the maximum length
| ^^^^ TD003
19 | # ABCDEFGHIJKLM-001
|

TD003.py:21:3: TD003 Missing issue link on the line following this TODO
|
19 | # ABCDEFGHIJKLM-001
20 |
21 | # TODO: here's a TODO with no link after it
| ^^^^ TD003
13 | def foo(x):
14 | return x
22 | def foo(x):
23 | return x
|

TD003.py:25:3: TD003 Missing issue link on the line following this TODO
TD003.py:34: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
32 | # TDO-3870
33 |
34 | # TODO: here's a TODO without an issue link
| ^^^^ TD003
26 | # TODO: followed by a new TODO with an issue link
27 | # TDO-3870
35 | # TODO: followed by a new TODO with an issue link
36 | # TDO-3870
|

TD003.py:29:9: TD003 Missing issue link on the line following this TODO
TD003.py:38:9: TD003 Missing issue link on the line following this TODO
|
27 | # TDO-3870
28 |
29 | # foo # TODO: no link!
36 | # TDO-3870
37 |
38 | # foo # TODO: no link!
| ^^^^ TD003
30 |
31 | # TODO: here's a TODO on the last line with no link
39 |
40 | # 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:40: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
38 | # foo # TODO: no link!
39 |
40 | # TODO: here's a TODO on the last line with no link
| ^^^^ TD003
|

0 comments on commit 3b0a1be

Please sign in to comment.