comparison vendor/squizlabs/php_codesniffer/tests/bootstrap.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
50 * 50 *
51 * @return void 51 * @return void
52 */ 52 */
53 function printPHPCodeSnifferTestOutput() 53 function printPHPCodeSnifferTestOutput()
54 { 54 {
55 echo PHP_EOL.PHP_EOL;
56
57 $output = 'The test files';
58 $data = [];
59
55 $codeCount = count($GLOBALS['PHP_CODESNIFFER_SNIFF_CODES']); 60 $codeCount = count($GLOBALS['PHP_CODESNIFFER_SNIFF_CODES']);
56 $files = call_user_func_array('array_merge', $GLOBALS['PHP_CODESNIFFER_SNIFF_CASE_FILES']); 61 if (empty($GLOBALS['PHP_CODESNIFFER_SNIFF_CASE_FILES']) === false) {
57 $files = array_unique($files); 62 $files = call_user_func_array('array_merge', $GLOBALS['PHP_CODESNIFFER_SNIFF_CASE_FILES']);
58 $fileCount = count($files); 63 $files = array_unique($files);
64 $fileCount = count($files);
59 65
60 echo PHP_EOL.PHP_EOL; 66 $output = '%d sniff test files';
61 echo "$fileCount sniff test files generated $codeCount unique error codes"; 67 $data[] = $fileCount;
68 }
69
70 $output .= ' generated %d unique error codes';
71 $data[] = $codeCount;
72
62 if ($codeCount > 0) { 73 if ($codeCount > 0) {
63 $fixes = count($GLOBALS['PHP_CODESNIFFER_FIXABLE_CODES']); 74 $fixes = count($GLOBALS['PHP_CODESNIFFER_FIXABLE_CODES']);
64 $percent = round(($fixes / $codeCount * 100), 2); 75 $percent = round(($fixes / $codeCount * 100), 2);
65 echo "; $fixes were fixable ($percent%)"; 76
77 $output .= '; %d were fixable (%d%%)';
78 $data[] = $fixes;
79 $data[] = $percent;
66 } 80 }
67 81
82 vprintf($output, $data);
83
68 }//end printPHPCodeSnifferTestOutput() 84 }//end printPHPCodeSnifferTestOutput()