Last active
August 29, 2015 13:56
Revisions
-
padraic revised this gist
Feb 14, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ <?php define('PACKAGE_LIST', 'list.txt'); define('CODING_STANDARD', 'PSR2'); define('SEVERITY', 1); define('ENCODING', 'utf-8'); -
padraic revised this gist
Feb 12, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -73,8 +73,8 @@ foreach ($paths as $name => $path) { $i++; $report_name = str_replace('/', '.', $name); $options['source'] = '--report-source=./' . $reports_dir . '/' . $report_name . '.source.txt'; $options['csv'] = '--report-csv=./' . $reports_dir . '/' . $report_name . '.csv'; echo "\n" . 'Setting the Sniffer on ' . $name . ' (' . $i . ' of ' . $count . ")\n\n"; $command = 'phpcs ' . implode(' ', $options) . ' ' . $path; echo $command . "\n\n"; -
padraic revised this gist
Feb 12, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -63,7 +63,7 @@ '--severity=' . SEVERITY, '--encoding=' . ENCODING, '--report=' . REPORT, '--extensions=' . EXTENSIONS, ]; $reports_dir = 'reports-' . time(); -
padraic revised this gist
Feb 12, 2014 . 1 changed file with 15 additions and 7 deletions.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,7 @@ define('SEVERITY', 1); define('ENCODING', 'utf-8'); define('REPORT', 'source'); define('EXTENSIONS', 'php'); $excluded = [ '*/test/*', '*/tests/*', @@ -13,7 +14,13 @@ '*/doc/*', '*/docs/*', '*/build/*', '*/data/*', '*/resource/*', '*/resources/*', '*/bin/*', '*/script/*', '*/scripts/*', '*/ext/*', ]; if (file_exists('composer.phar')) { @@ -51,11 +58,12 @@ } $options = [ '--ignore=' . implode(',', $excluded), '--standard=' . CODING_STANDARD, '--severity=' . SEVERITY, '--encoding=' . ENCODING, '--report=' . REPORT, '--extensions' . EXTENSIONS, ]; $reports_dir = 'reports-' . time(); @@ -68,7 +76,7 @@ $options[] = '--report-source=./' . $reports_dir . '/' . $report_name . '.source.txt'; $options[] = '--report-csv=./' . $reports_dir . '/' . $report_name . '.csv'; echo "\n" . 'Setting the Sniffer on ' . $name . ' (' . $i . ' of ' . $count . ")\n\n"; $command = 'phpcs ' . implode(' ', $options) . ' ' . $path; echo $command . "\n\n"; passthru($command); } -
padraic revised this gist
Feb 12, 2014 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -68,5 +68,7 @@ $options[] = '--report-source=./' . $reports_dir . '/' . $report_name . '.source.txt'; $options[] = '--report-csv=./' . $reports_dir . '/' . $report_name . '.csv'; echo "\n" . 'Setting the Sniffer on ' . $name . ' (' . $i . ' of ' . $count . ")\n\n"; $command = 'phpcs' . implode(' ', $options) . ' ' . $path; echo $command . "\n\n"; passthru($command); } -
padraic created this gist
Feb 12, 2014 .There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,72 @@ <?php define('PACKAGE_LIST', 'packages.txt'); define('CODING_STANDARD', 'PSR2'); define('SEVERITY', 1); define('ENCODING', 'utf-8'); define('REPORT', 'source'); $excluded = [ '*/test/*', '*/tests/*', '*/example/*', '*/examples/*', '*/doc/*', '*/docs/*', '*/build/*', '*/data/*' ]; if (file_exists('composer.phar')) { passthru('php composer.phar self-update'); } else { passthru('curl -sS https://getcomposer.org/installer | php'); } if (!file_exists('composer.lock') || !file_exists('composer.json')) { $packages_required = ''; $handle = fopen(PACKAGE_LIST, "r"); while(fscanf($handle, "%s", $package_name)) { $packages_required .= ' ' . $package_name . ':dev-master'; } fclose($handle); passthru('php composer.phar require --prefer-dist' . $packages_required); } else { passthru('php composer.phar update'); } $paths = []; $installed = json_decode(file_get_contents('./vendor/composer/installed.json'), true); foreach($installed as $package) { $fullpath = './vendor/' . $package['name']; if (isset($package['autoload']['psr-0'])) { foreach($package['autoload']['psr-0'] as $ns => $path) { if (strlen($path) == 0) { $fullpath .= '/' . str_replace('\\', '/', $ns); } else { $fullpath .= '/' . $path; } $paths[$package['name']] = $fullpath; } } } $options = [ ' --ignore=' . implode(',', $excluded), ' --standard=' . CODING_STANDARD, ' --severity=' . SEVERITY, ' --encoding=' . ENCODING, ' --report=' . REPORT, ]; $reports_dir = 'reports-' . time(); mkdir($reports_dir); $count = count($paths); $i = 0; foreach ($paths as $name => $path) { $i++; $report_name = str_replace('/', '.', $name); $options[] = '--report-source=./' . $reports_dir . '/' . $report_name . '.source.txt'; $options[] = '--report-csv=./' . $reports_dir . '/' . $report_name . '.csv'; echo "\n" . 'Setting the Sniffer on ' . $name . ' (' . $i . ' of ' . $count . ")\n\n"; passthru('phpcs ' . implode(' ', $options) . ' ' . $path); }