Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
}
],
"require": {
"consolidation/robo": "^1.4 || ^2 || ^3",
"consolidation/robo": "^3.0",
"squizlabs/php_codesniffer": "^3.5",
"phpstan/phpstan": "^0.12.77",
"phpstan/phpstan-deprecation-rules": "^0.12.6",
"async-aws/s3": "^1.8",
"php": ">=7.4",
"drush/drush": "^8 || ^10",
"drush/drush": "^10.6.1",
"webflo/drupal-finder": "^1.2",
"vincentlanglet/twig-cs-fixer": "^0.4.1"
"vincentlanglet/twig-cs-fixer": "^0.4.1",
"nunomaduro/phpinsights": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
39 changes: 39 additions & 0 deletions src/Robo/Plugin/Commands/CICommands.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ class CICommands extends Tasks
*/
protected $lintTwigFiles;

/**
* Boolean indicating whether architecture checks should be run.
*
* @var bool
*/
protected $runArchitectureAnalysis;

/**
* RoboFile constructor.
*/
Expand All @@ -53,6 +60,7 @@ public function __construct()
$this->phpcsIgnorePaths = Robo::config()->get('phpcs_ignore_paths');
$this->customCodePaths = implode(' ', $this->getCustomCodePaths());
$this->lintTwigFiles = Robo::config()->get('twig_lint_enable', true);
$this->runArchitectureAnalysis = Robo::config()->get('architecture_analysis_enable', true);
}

/**
Expand Down Expand Up @@ -107,6 +115,9 @@ public function jobCheckCodingStandards(): Result
if ($this->lintTwigFiles) {
$stack->exec("vendor/bin/twig-cs-fixer lint $this->customCodePaths");
}
if ($this->runArchitectureAnalysis) {
$this->runArchitectureAnalysis();
}
return $stack->run();
}

Expand Down Expand Up @@ -135,6 +146,18 @@ public function jobFixCodingStandards(): Result
return $stack->run();
}

/**
* Command to run architecture analysis.
*
* @return \Robo\Result
* The result of the collection of tasks.
*
* @throws \Robo\Exception\TaskException
*/
public function jobRunArchitectureAnalysis(): Result {
return $this->runArchitectureAnalysis();
}

/**
* Get custom code paths for static analysis tools to use.
*
Expand Down Expand Up @@ -166,4 +189,20 @@ protected function getCodingStandards(): array
}
return $phpcsStandards;
}

/**
* Run architecture checks.
*
* @return null|\Robo\Result
* The result of the set of tasks.
*
* @throws \Robo\Exception\TaskException
*/
protected function runArchitectureAnalysis(): Result
{
return $this->taskExecStack()
->stopOnFail()
->exec("./vendor/bin/phpinsights analyse --no-interaction $this->customCodePaths --min-quality=100 --min-complexity=100 --min-architecture=100 --min-style=100")
->run();
}
}