File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -7,3 +7,4 @@ phpunit.xml
77phpcs.cache
88phpstan.neon
99.phpunit.result.cache
10+ ruleset-tests-report.json
Original file line number Diff line number Diff line change @@ -147,15 +147,24 @@ private function collect_phpcs_result() {
147147 $ php = \PHP_BINARY . ' ' ;
148148 }
149149
150- $ shell = sprintf (
151- '%1$s%2$s --severity=1 --standard=%3$s --report=json ./%3$s/ruleset-test.inc ' ,
150+ $ report_file = dirname ( __DIR__ ) . '/ruleset-tests-report.json ' ;
151+ $ shell = sprintf (
152+ '%1$s%2$s --severity=1 --standard=%3$s --report-json=%4$s ./%3$s/ruleset-test.inc ' ,
152153 $ php , // Current PHP executable if available.
153154 $ this ->phpcs_bin ,
154- $ this ->ruleset
155+ $ this ->ruleset ,
156+ $ report_file
155157 );
156158
157159 // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.system_calls_shell_exec -- This is test code, not production.
158- $ output = shell_exec ( $ shell );
160+ shell_exec ( $ shell );
161+
162+ // phpcs:ignore WordPress.WP.AlternativeFunctions.file_get_contents_file_get_contents -- This code is not run in the context of WP.
163+ $ output = file_get_contents ( $ report_file );
164+
165+ // Delete the report as we no longer need it.
166+ // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged,WordPress.WP.AlternativeFunctions.unlink_unlink
167+ @unlink ( $ report_file );
159168
160169 return json_decode ( $ output );
161170 }
You can’t perform that action at this time.
0 commit comments