Skip to content

Commit

Permalink
TodoByVersionRule UX: added configuration tip (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm authored Dec 19, 2023
1 parent 08305d8 commit 9285e13
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/TodoByVersionRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public function processNode(Node $node, Scope $scope): array
if ($this->nonIgnorable) {
$errBuilder->nonIgnorable();
}
$errBuilder->tip("Calculated reference version is '". $referenceVersion ."'.\n\n See also:\n https://github.com/staabm/phpstan-todo-by#reference-version");
$errors[] = $errBuilder->build();
}
}
Expand Down
14 changes: 14 additions & 0 deletions tests/TodoByVersionRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,48 +42,58 @@ public static function provideErrors(): iterable
]
];

$tip = "Calculated reference version is '1.0.0.0'.\n\n See also:\n https://github.com/staabm/phpstan-todo-by#reference-version";
yield [
"1.0",
[
[
'Version requirement <1.0.0 not satisfied: This has to be in the first major release.',
5,
$tip
],
[
'Version requirement <1.0.0 not satisfied.',
10,
$tip
]
]
];

$tip = "Calculated reference version is '123.4.0.0'.\n\n See also:\n https://github.com/staabm/phpstan-todo-by#reference-version";
yield [
"123.4",
[
[
'Version requirement <1.0.0 not satisfied: This has to be in the first major release.',
5,
$tip
],
[
'Version requirement <1.0.0 not satisfied.',
10,
$tip
]
]
];

$tip = "Calculated reference version is '123.5.0.0'.\n\n See also:\n https://github.com/staabm/phpstan-todo-by#reference-version";
yield [
"123.5",
[
[
'Version requirement <1.0.0 not satisfied: This has to be in the first major release.',
5,
$tip
],
[
'Version requirement >123.4 not satisfied: Must fix this or bump the version.',
7,
$tip
],
[
'Version requirement <1.0.0 not satisfied.',
10,
$tip
]
]
];
Expand All @@ -105,16 +115,20 @@ public function testSemanticVersions(string $referenceVersion, array $errors): v
*/
public static function provideSemanticVersions(): iterable
{
$tip = "Calculated reference version is '1.0.0.0'.\n\n See also:\n https://github.com/staabm/phpstan-todo-by#reference-version";

yield [
'nextMajor', // we assume this resolves to 1.0
[
[
'Version requirement <1.0.0 not satisfied: This has to be in the first major release.',
5,
$tip
],
[
'Version requirement <1.0.0 not satisfied.',
10,
$tip
]
]
];
Expand Down

0 comments on commit 9285e13

Please sign in to comment.