Skip to content

Commit

Permalink
Remove issue code length restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaReiser committed Jan 3, 2025
1 parent 0991625 commit ee51b52
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# 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 issue code can be arbitrarily long
# ABCDEFGHIJKLMNOPQRSTUVWXYZ-001

# TDO003 - errors
# TODO: this comment has no
Expand All @@ -35,6 +35,3 @@ 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
8 changes: 4 additions & 4 deletions crates/ruff_linter/src/rules/flake8_todos/rules/todos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ impl Violation for MissingTodoAuthor {
/// # TODO(charlie): this comment has a 3-digit issue code
/// # 003
///
/// # TODO(charlie): this comment has an issue code of (up to) 6 characters, then digits
/// # TODO(charlie): this comment has an issue code (matches the regex `[A-Z]+\-?\d+`)
/// # SIXCHR-003
/// ```
#[derive(ViolationMetadata)]
Expand Down 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,12}\-?\d+$", // issue code - like "TD003"
r"^#\s*(http|https)://.*", // issue link
r"^#\s*\d+$", // issue code - like "003"
r"^#\s*[A-Z]+\-?\d+$", // issue code - like "TD003"
])
.unwrap()
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,4 @@ TD003.py:37:3: TD003 Missing issue link on the line following this TODO
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
|

0 comments on commit ee51b52

Please sign in to comment.