1
|
|
|
<?php |
2
|
|
|
declare(strict_types = 1); |
3
|
|
|
|
4
|
|
|
namespace Drupal\qa\Commands; |
5
|
|
|
|
6
|
|
|
use Drupal\qa\Controller\WorkflowsReportController; |
7
|
|
|
use Drupal\qa\Workflows\ContentModerationGraph; |
8
|
|
|
use Drupal\qa\Workflows\ContentModerationGrid; |
9
|
|
|
use Drush\Commands\DrushCommands; |
|
|
|
|
10
|
|
|
use OSInet\qa\ForceRemoved; |
11
|
|
|
use Symfony\Component\Yaml\Yaml; |
|
|
|
|
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* A Drush commandfile. |
15
|
|
|
* |
16
|
|
|
* In addition to this file, you need a drush.services.yml |
17
|
|
|
* in root of your module, and a composer.json file that provides the name |
18
|
|
|
* of the services file to use. |
19
|
|
|
* |
20
|
|
|
* See these files for an example of injecting Drupal services: |
21
|
|
|
* - http://cgit.drupalcode.org/devel/tree/src/Commands/DevelCommands.php |
22
|
|
|
* - http://cgit.drupalcode.org/devel/tree/drush.services.yml |
23
|
|
|
*/ |
24
|
|
|
class QaCommands extends DrushCommands { |
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Show the content moderation as a table. |
28
|
|
|
* |
29
|
|
|
* |
30
|
|
|
* @command como:table |
31
|
|
|
* @aliases cmt,como-table |
32
|
|
|
*/ |
33
|
|
|
public function table() { |
34
|
|
|
$table = ContentModerationGrid::create(\Drupal::getContainer()); |
35
|
|
|
$table->report(); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* Show the content moderation as a Graphviz DOT file. |
40
|
|
|
* |
41
|
|
|
* @param $workflow |
42
|
|
|
* The machine name of a workflow |
43
|
|
|
* |
44
|
|
|
* @command como:graphviz |
45
|
|
|
* @aliases cmg,como-graphviz |
46
|
|
|
*/ |
47
|
|
|
public function graphviz($workflow = NULL) { |
48
|
|
|
$graph = ContentModerationGraph::create(\Drupal::getContainer()); |
49
|
|
|
echo $graph->report(); |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
|
53
|
|
|
/** |
54
|
|
|
* Show a summary of available workflows |
55
|
|
|
* |
56
|
|
|
* |
57
|
|
|
* @command qa:workflows-list |
58
|
|
|
* @aliases qawl,qa-workflows-list |
59
|
|
|
*/ |
60
|
|
|
public function workflowsList() { |
61
|
|
|
$listBuilder = WorkflowsReportController::create(\Drupal::getContainer()); |
62
|
|
|
$list = $listBuilder->getWorkflowSummary( |
63
|
|
|
$listBuilder->storage->loadMultiple() |
64
|
|
|
); |
65
|
|
|
$this->output->writeln(Yaml::dump($list)); |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* Build a Graphviz DOT file showing the module and theme dependencies. |
70
|
|
|
* |
71
|
|
|
* |
72
|
|
|
* @command qa:dependencies |
73
|
|
|
* @aliases qadep,qa-dependencies |
74
|
|
|
*/ |
75
|
|
|
public function dependencies() { |
76
|
|
|
/** @var \Drupal\qa\Dependencies $qaDep */ |
77
|
|
|
$qaDep = \Drupal::service('qa.dependencies'); |
78
|
|
|
$G = $qaDep->build(); |
79
|
|
|
echo $G->build(); |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* Show projects entirely unused and unused themes. |
84
|
|
|
* |
85
|
|
|
* @command qa:system:unused |
86
|
|
|
* |
87
|
|
|
* @throws \Drupal\Component\Plugin\Exception\PluginException |
88
|
|
|
*/ |
89
|
|
|
public function system_unused() { |
90
|
|
|
/** @var \Drupal\qa\Plugin\QaCheckManager $qam */ |
91
|
|
|
$qam = \Drupal::service('plugin.manager.qa_check'); |
92
|
|
|
$unused = $qam->createInstance('system.unused_extensions'); |
93
|
|
|
$pass = $unused->run(); |
94
|
|
|
$res = [ |
95
|
|
|
'age' => $pass->life->age(), |
96
|
|
|
'ok' => $pass->ok, |
97
|
|
|
'result' => [], |
98
|
|
|
]; |
99
|
|
|
/** @var \Drupal\qa\Result $result */ |
100
|
|
|
foreach ($pass->result as $key => $result) { |
101
|
|
|
$res['result'][$key] = [ |
102
|
|
|
'ok' => $result->ok, |
103
|
|
|
'data' => $result->data, |
104
|
|
|
]; |
105
|
|
|
} |
106
|
|
|
$this->output->writeln(Yaml::dump($res, 4, 2)); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* List extensions removed without a clean uninstall. |
111
|
|
|
* |
112
|
|
|
* |
113
|
|
|
* @command qa:force-removed |
114
|
|
|
* @aliases qafrm,qa-force-removed |
115
|
|
|
*/ |
116
|
|
|
public function forceRemoved() { |
117
|
|
|
$finder = ForceRemoved::create(); |
118
|
|
|
echo $finder->find(); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
} |
122
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths