66
77use Drupal \qa \Controller \WorkflowsReportController ;
88use Drupal \qa \Plugin \QaCheck \References \Integrity ;
9+ use Drupal \qa \Plugin \QaCheck \References \TaxonomyIndex ;
910use Drupal \qa \Plugin \QaCheck \System \UnusedExtensions ;
1011use Drupal \qa \Plugin \QaCheckManager ;
1112use Drupal \qa \Workflows \ContentModerationGraph ;
@@ -97,14 +98,15 @@ public function dependencies() {
9798 }
9899
99100 /**
100- * Show broken entity_reference fields .
101+ * Command helper: runs a QaCheck plugin and display its results .
101102 *
102- * @command qa:references:integrity
103+ * @param string $name
104+ * The plugin name.
103105 *
104106 * @throws \Drupal\Component\Plugin\Exception\PluginException
105107 */
106- public function referencesIntegrity () {
107- $ check = $ this ->qam ->createInstance (Integrity:: NAME );
108+ public function runPlugin ( string $ name ): void {
109+ $ check = $ this ->qam ->createInstance ($ name );
108110 $ pass = $ check ->run ();
109111 $ res = [
110112 'age ' => $ pass ->life ->age (),
@@ -121,6 +123,28 @@ public function referencesIntegrity() {
121123 $ this ->output ->writeln (Yaml::dump ($ res , 5 , 2 ));
122124 }
123125
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+
124148 /**
125149 * Show projects entirely unused and unused themes.
126150 *
@@ -129,21 +153,7 @@ public function referencesIntegrity() {
129153 * @throws \Drupal\Component\Plugin\Exception\PluginException
130154 */
131155 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 );
147157 }
148158
149159 /**
0 commit comments