sweetchuck / robo-cdd
Robo task wrapper for the Circular Dependency Detector
Installs: 264 742
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: >=7.2
- consolidation/robo: ^2.0
- sweetchuck/cdd: ^0.0
Requires (Dev)
- codeception/codeception: ^4.0
- codeception/module-asserts: ^1.1
- danielstjules/stringy: ^3.0
- phpmetrics/phpmetrics: ^2.4
- squizlabs/php_codesniffer: ^3.5
- sweetchuck/codeception-module-robo-task-runner: ^0.7
- sweetchuck/git-hooks: ^0.0
- sweetchuck/robo-git: ^0.2
- sweetchuck/robo-phpcs: ^0.1
- sweetchuck/robo-phpmd: ^0.1
- symfony/error-handler: ^5.0
- symfony/finder: ^4.0
- webmozart/path-util: ^2.3
README
@todo
Install
composer require --dev sweetchuck/robo-cdd
Usage
RoboFile.php
<?php use Robo\Collection\CollectionBuilder; use Robo\State\Data as RoboStateData; use Sweetchuck\Robo\cdd\CircularDependencyTaskLoader; class RoboFile extends \Robo\Tasks { use CircularDependencyTaskLoader; /** * @command validate:module-dependencies */ public function validateModuleDependencies(): CollectionBuilder { return $this ->collectionBuilder() ->addCode(function (RoboStateData $data): int { $data['moduleDependencies'] = $this->collectModuleDependencies(); return 0; }) ->addTask( $this ->taskCircularDependencyDetector() ->setItemLabel('module') ->deferTaskConfiguration('setItems', 'moduleDependencies') ); } protected function collectModuleDependencies(): array { return [ 'a' => ['b'], 'b' => ['c'], 'c' => ['a'], 'd' => ['e'], 'e' => ['d'], ]; } }
CLI command
vendor/bin/robo validate:module-dependencies
Output is something like this:
[Circular Dependency Detector] Detect dependencies among 5 of module items
[Sweetchuck\Robo\cdd\Task\CircularDependencyDetectorTask]
c
a
b
c
e
d
e
[Sweetchuck\Robo\cdd\Task\CircularDependencyDetectorTask] Exit code 1