Skip to content

Commit cdab62d

Browse files
thePanzstaabm
andauthored
Update error message in UrlRUle to better handle URLs (#159)
Co-authored-by: Markus Staab <maggus.staab@googlemail.com>
1 parent 8285917 commit cdab62d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/TodoByIssueUrlRule.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,12 @@ public function processNode(Node $node, Scope $scope): array
8484
continue;
8585
}
8686

87+
// Adding a space after the {url} allows to have a proper clickable link, without the
88+
// additional character at the end being part of the link's URL, which breaks GitHub links.
8789
if ('' !== $todoText) {
88-
$errorMessage = "Should have been resolved in {$url}: ". rtrim($todoText, '.') .'.';
90+
$errorMessage = "Should have been resolved in {$url} : ". rtrim($todoText, '.') .'.';
8991
} else {
90-
$errorMessage = "Comment should have been resolved with {$url}.";
92+
$errorMessage = "Comment should have been resolved with {$url} .";
9193
}
9294

9395
$errors[] = $this->errorBuilder->buildError(

tests/TodoByIssueUrlRuleTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ public static function provideErrors(): iterable
3939
yield [
4040
[
4141
[
42-
'Should have been resolved in https://github.com/staabm/phpstan-todo-by/issues/47: we need todo something when this issue is resolved.',
42+
'Should have been resolved in https://github.com/staabm/phpstan-todo-by/issues/47 : we need todo something when this issue is resolved.',
4343
5,
4444
],
4545
[
46-
'Comment should have been resolved with https://github.com/staabm/phpstan-todo-by/pull/155.',
46+
'Comment should have been resolved with https://github.com/staabm/phpstan-todo-by/pull/155 .',
4747
6,
4848
],
4949
],

0 commit comments

Comments
 (0)