Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/sweetchuck/robo-cdd

Robo task wrapper for the Circular Dependency Detector
https://github.com/sweetchuck/robo-cdd

dependency lint robo-task tree tree-structure validator

Last synced: 2 months ago
JSON representation

Robo task wrapper for the Circular Dependency Detector

Awesome Lists containing this project

README

        

# Robo - Circular Dependency Detector

[![CircleCI](https://circleci.com/gh/Sweetchuck/robo-cdd/tree/3.x.svg?style=svg)](https://circleci.com/gh/Sweetchuck/robo-cdd/?branch=3.x)
[![codecov](https://codecov.io/gh/Sweetchuck/robo-cdd/branch/3.x/graph/badge.svg?token=Y6GIX9ovAG)](https://app.codecov.io/gh/Sweetchuck/robo-cdd/branch/3.x)

@todo

## Install

composer require --dev sweetchuck/robo-cdd

## Usage

**RoboFile.php**
```php
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
```