-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix handling unordered baseline violations with ignore line numbers o…
- Loading branch information
1 parent
8171175
commit 5ff8a2d
Showing
6 changed files
with
117 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
use Arkitect\ClassSet; | ||
use Arkitect\CLI\Config; | ||
use Arkitect\Expression\ForClasses\DependsOnlyOnTheseNamespaces; | ||
use Arkitect\Expression\ForClasses\ResideInOneOfTheseNamespaces; | ||
use Arkitect\Rules\Rule; | ||
|
||
return static function (Config $config): void { | ||
$rootPath = realpath(__DIR__); | ||
$classSet = ClassSet::fromDir("$rootPath/line_numbers"); | ||
|
||
$rules = [ | ||
Rule::allClasses() | ||
->that(new ResideInOneOfTheseNamespaces('App\Application')) | ||
->should(new DependsOnlyOnTheseNamespaces('App\Application')) | ||
->because('That is how I want it'), | ||
]; | ||
|
||
$config->add($classSet, ...$rules); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Application; | ||
|
||
final class Foo | ||
{ | ||
public function doSomething(\App\Ui\Baz $baz): void | ||
{ | ||
} | ||
|
||
public function doSomethingElse(\App\Ui\Bar $bar): void | ||
{ | ||
} | ||
|
||
public function doSomethingElseEvenMore(\App\Ui\Bar $bar): void | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"violations": [ | ||
{ | ||
"fqcn": "App\\Application\\Foo", | ||
"line": 13, | ||
"error": "depends on App\\Ui\\Bar, but should depend only on classes in one of these namespaces: App\\Application because That is how I want it" | ||
}, | ||
{ | ||
"fqcn": "App\\Application\\Foo", | ||
"line": 20, | ||
"error": "depends on App\\Ui\\Baz, but should depend only on classes in one of these namespaces: App\\Application because That is how I want it" | ||
}, | ||
{ | ||
"fqcn": "App\\Application\\Foo", | ||
"line": 17, | ||
"error": "depends on App\\Ui\\Bar, but should depend only on classes in one of these namespaces: App\\Application because That is how I want it" | ||
} | ||
], | ||
"stopOnFailure": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters