Skip to content

Commit

Permalink
Support todo@username comments
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Dec 17, 2023
1 parent b30ceac commit 459f42c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/TodoByRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ final class TodoByRule implements Rule
private const PATTERN = <<<'REGEXP'
/
@?TODO # possible @ prefix
@?[a-zA-Z0-9_-]*\s* # optional username
\s*[:-]?\s* # optional colon or hyphen
(?P<date>\d{4}-\d{2}-\d{2}) # date consisting of YYYY-MM-DD format
\s*[:-]?\s* # optional colon or hyphen
Expand Down
8 changes: 8 additions & 0 deletions tests/TodoByRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,14 @@ public function testRule(): void
'Expired on 2023-12-14: fix it',
51,
],
[
'Expired on 2023-12-14: fix it',
53,
],
[
'Expired on 2023-12-14: fix it',
54,
],
]);
}
}
3 changes: 3 additions & 0 deletions tests/data/example.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@ public function XY():void {
// @todo 2023-12-14: fix it
// todo - 2023-12-14 fix it
// todo 2023-12-14 - fix it

// TODO@lars 2023-12-14 - fix it
// TODO@lars: 2023-12-14 - fix it

1 comment on commit 459f42c

@staabm
Copy link
Owner Author

@staabm staabm commented on 459f42c Dec 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

//cc @voku

Please sign in to comment.