Skip to content

Commit

Permalink
Fix rule message (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored Dec 18, 2023
1 parent b0f48a2 commit a70de60
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/TodoByDateRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,9 @@ public function processNode(Node $node, Scope $scope): array
// Have always present date at the start of the message.
// If there is further text, append it.
if ($todoText !== '') {
$errorMessage = "Expired on {$date}: {$todoText}";
$errorMessage = "Expired on {$date}: ". rtrim($todoText, '.') .".";
} else {
$errorMessage = "Comment expired on {$date}";
$errorMessage = "Comment expired on {$date}.";
}

$wholeMatchStartOffset = $match[0][1];
Expand Down
42 changes: 21 additions & 21 deletions tests/TodoByDateRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,87 +23,87 @@ public function testRule(): void

$this->analyse([__DIR__ . '/data/example.php'], [
[
'Expired on 2023-12-14: Expired comment1',
'Expired on 2023-12-14: Expired comment1.',
9,
],
[
'Expired on 2023-12-14: Expired comment2',
'Expired on 2023-12-14: Expired comment2.',
10,
],
[
'Expired on 2023-12-14: Expired comment3',
'Expired on 2023-12-14: Expired comment3.',
11,
],
[
'Expired on 2023-12-14: Expired comment4',
'Expired on 2023-12-14: Expired comment4.',
12,
],
[
'Expired on 2023-12-14: Expired comment5',
'Expired on 2023-12-14: Expired comment5.',
13,
],
[
'Expired on 2023-12-14: Expired commentX',
'Expired on 2023-12-14: Expired commentX.',
19,
],
[
'Comment expired on 2023-12-14',
'Comment expired on 2023-12-14.',
21,
],
[
'Expired on 2023-12-14: class comment',
'Expired on 2023-12-14: class comment.',
29,
],
[
'Expired on 2023-12-13: class comment',
'Expired on 2023-12-13: class comment.',
30,
],
[
"Expired on 2023-12-14: method comment",
"Expired on 2023-12-14: method comment.",
34,
],
[
'Expired on 2023-12-14: in method comment1',
'Expired on 2023-12-14: in method comment1.',
36,
],
[
'Expired on 2023-12-14: in method comment2',
'Expired on 2023-12-14: in method comment2.',
38,
],
[
'Expired on 2023-12-14: Convert to standard Drupal $content code.',
43,
],
[
'Expired on 2023-12-14: Decide to fix all the broken instances of class as a string',
'Expired on 2023-12-14: Decide to fix all the broken instances of class as a string.',
46,
],
[
'Expired on 2023-12-14: fix it',
'Expired on 2023-12-14: fix it.',
48,
],
[
'Expired on 2023-12-14: fix it',
'Expired on 2023-12-14: fix it.',
49,
],
[
'Expired on 2023-12-14: fix it',
'Expired on 2023-12-14: fix it.',
50,
],
[
'Expired on 2023-12-14: fix it',
'Expired on 2023-12-14: fix it.',
51,
],
[
'Expired on 2023-12-14: fix it',
'Expired on 2023-12-14: fix it.',
53,
],
[
'Expired on 2023-12-14: fix it',
'Expired on 2023-12-14: fix it.',
54,
],
[
'Expired on 2023-12-14: classic multi line comment',
'Expired on 2023-12-14: classic multi line comment.',
59,
],
]);
Expand All @@ -122,7 +122,7 @@ public function testReferenceTime2(): void

$this->analyse([__DIR__ . '/data/referenceTime.php'], [
[
'Expired on 2023-01-14: fix it',
'Expired on 2023-01-14: fix it.',
5,
],
]);
Expand Down

0 comments on commit a70de60

Please sign in to comment.