6
6
7
7
use Drupal \qa \Controller \WorkflowsReportController ;
8
8
use Drupal \qa \Plugin \QaCheck \References \Integrity ;
9
+ use Drupal \qa \Plugin \QaCheck \References \TaxonomyIndex ;
9
10
use Drupal \qa \Plugin \QaCheck \System \UnusedExtensions ;
10
11
use Drupal \qa \Plugin \QaCheckManager ;
11
12
use Drupal \qa \Workflows \ContentModerationGraph ;
@@ -97,14 +98,15 @@ public function dependencies() {
97
98
}
98
99
99
100
/**
100
- * Show broken entity_reference fields .
101
+ * Command helper: runs a QaCheck plugin and display its results .
101
102
*
102
- * @command qa:references:integrity
103
+ * @param string $name
104
+ * The plugin name.
103
105
*
104
106
* @throws \Drupal\Component\Plugin\Exception\PluginException
105
107
*/
106
- public function referencesIntegrity () {
107
- $ check = $ this ->qam ->createInstance (Integrity:: NAME );
108
+ public function runPlugin ( string $ name ): void {
109
+ $ check = $ this ->qam ->createInstance ($ name );
108
110
$ pass = $ check ->run ();
109
111
$ res = [
110
112
'age ' => $ pass ->life ->age (),
@@ -121,6 +123,28 @@ public function referencesIntegrity() {
121
123
$ this ->output ->writeln (Yaml::dump ($ res , 5 , 2 ));
122
124
}
123
125
126
+ /**
127
+ * Show broken entity_reference fields.
128
+ *
129
+ * @command qa:references:integrity
130
+ *
131
+ * @throws \Drupal\Component\Plugin\Exception\PluginException
132
+ */
133
+ public function referencesIntegrity () {
134
+ $ this ->runPlugin (Integrity::NAME );
135
+ }
136
+
137
+ /**
138
+ * Show broken taxonomy_index data.
139
+ *
140
+ * @command qa:references:taxonomy_index
141
+ *
142
+ * @throws \Drupal\Component\Plugin\Exception\PluginException
143
+ */
144
+ public function referencesTaxonomyIndex () {
145
+ $ this ->runPlugin (TaxonomyIndex::NAME );
146
+ }
147
+
124
148
/**
125
149
* Show projects entirely unused and unused themes.
126
150
*
@@ -129,21 +153,7 @@ public function referencesIntegrity() {
129
153
* @throws \Drupal\Component\Plugin\Exception\PluginException
130
154
*/
131
155
public function systemUnused () {
132
- $ check = $ this ->qam ->createInstance (UnusedExtensions::NAME );
133
- $ pass = $ check ->run ();
134
- $ res = [
135
- 'age ' => $ pass ->life ->age (),
136
- 'ok ' => $ pass ->ok ,
137
- 'result ' => [],
138
- ];
139
- /** @var \Drupal\qa\Result $result */
140
- foreach ($ pass ->result as $ key => $ result ) {
141
- $ res ['result ' ][$ key ] = [
142
- 'ok ' => $ result ->ok ,
143
- 'data ' => $ result ->data ,
144
- ];
145
- }
146
- $ this ->output ->writeln (Yaml::dump ($ res , 4 , 2 ));
156
+ $ this ->runPlugin (UnusedExtensions::NAME );
147
157
}
148
158
149
159
/**
0 commit comments