@@ -56,6 +56,13 @@ class CheckSniffCompleteness
5656 */
5757 protected $ showColored ;
5858
59+ /**
60+ * Verbosity level.
61+ *
62+ * @var int
63+ */
64+ protected $ verbose = 0 ;
65+
5966 /**
6067 * The target directories to examine.
6168 *
@@ -244,6 +251,10 @@ protected function processCliCommand()
244251 $ this ->showColored = $ this ->isColorSupported ();
245252 }
246253
254+ if (isset ($ argsFlipped ['-v ' ])) {
255+ $ this ->verbose = 1 ;
256+ }
257+
247258 foreach ($ args as $ arg ) {
248259 if (strpos ($ arg , '--exclude= ' ) === 0 ) {
249260 $ exclude = substr ($ arg , 10 );
@@ -284,9 +295,11 @@ public function validate()
284295 {
285296 $ this ->showVersion ();
286297
287- echo 'Target dir(s): ' , PHP_EOL ,
288- '- ' . implode (PHP_EOL . '- ' , $ this ->targetDirs ),
289- PHP_EOL , PHP_EOL ;
298+ if ($ this ->verbose > 0 ) {
299+ echo 'Target dir(s): ' , PHP_EOL ,
300+ '- ' . implode (PHP_EOL . '- ' , $ this ->targetDirs ),
301+ PHP_EOL , PHP_EOL ;
302+ }
290303
291304 if ($ this ->isComplete () !== true ) {
292305 exit (1 );
@@ -321,7 +334,7 @@ public function isComplete()
321334 $ notices = [];
322335 $ warningCount = 0 ;
323336 $ errorCount = 0 ;
324- foreach ($ this ->allSniffs as $ file ) {
337+ foreach ($ this ->allSniffs as $ i => $ file ) {
325338 if ($ this ->quietMode === false ) {
326339 $ docFile = str_replace (array_keys ($ this ->sniffToDoc ), $ this ->sniffToDoc , $ file );
327340 if (isset ($ this ->allFiles [$ docFile ]) === false ) {
@@ -353,6 +366,20 @@ public function isComplete()
353366 // Show progress.
354367 if ($ this ->showProgress === true ) {
355368 echo '. ' ;
369+
370+ $ current = ($ i + 1 );
371+ if (($ current % 60 ) === 0 || $ current === $ sniffCount ) {
372+ $ padding = strlen ($ sniffCount );
373+
374+ $ filling = '' ;
375+ if ($ current === $ sniffCount ) {
376+ $ lines = ceil ($ current / 60 );
377+ $ filling = str_repeat (' ' , (($ lines * 60 ) - $ sniffCount ));
378+ }
379+
380+ echo $ filling , ' ' , str_pad ($ current , $ padding , ' ' , \STR_PAD_LEFT ), ' / ' , $ sniffCount ,
381+ ' ( ' , str_pad (round (($ current / $ sniffCount ) * 100 ), 3 , ' ' , \STR_PAD_LEFT ), '%) ' , PHP_EOL ;
382+ }
356383 }
357384 }
358385
@@ -428,7 +455,8 @@ protected function showVersion()
428455 {
429456 echo 'PHPCSDev Tools: Sniff feature completeness checker version ' ;
430457 include __DIR__ . '/../VERSION ' ;
431- echo PHP_EOL , PHP_EOL ;
458+ echo PHP_EOL ,
459+ 'by Juliette Reinders Folmer ' , PHP_EOL , PHP_EOL ;
432460 }
433461
434462 /**
@@ -442,11 +470,11 @@ protected function showHelp()
442470
443471 echo 'Usage: ' , PHP_EOL ,
444472 ' phpcs-check-feature-completeness ' , PHP_EOL ,
445- ' phpcs-check-feature-completeness [-q] [--exclude=<dir>] [directory ] ' , PHP_EOL ;
473+ ' phpcs-check-feature-completeness [-q] [--exclude=<dir>] [directories ] ' , PHP_EOL ;
446474
447475 echo PHP_EOL ,
448476 'Options: ' , PHP_EOL ,
449- ' directory A specific directory to examine. ' , PHP_EOL ,
477+ ' directories One or more specific directories to examine. ' , PHP_EOL ,
450478 ' Defaults to the directory from which the script is run. ' , PHP_EOL ,
451479 ' -q, --quiet Turn off warnings for missing documentation. ' , PHP_EOL ,
452480 ' --exclude Comma-delimited list of (relative) directories to exclude ' , PHP_EOL ,
@@ -456,6 +484,7 @@ protected function showHelp()
456484 ' --colors Enable colors in console output. ' , PHP_EOL ,
457485 ' (disables auto detection of color support) ' , PHP_EOL ,
458486 ' --no-colors Disable colors in console output. ' , PHP_EOL ,
487+ ' -v Verbose mode. ' , PHP_EOL ,
459488 ' -h, --help Print this help. ' , PHP_EOL ,
460489 ' -V, --version Display the current version of this script. ' , PHP_EOL ;
461490 }
0 commit comments