Php_codesniffer: usability: do not print usage on error

Created on 4 Oct 2016  路  4Comments  路  Source: squizlabs/PHP_CodeSniffer

stop printing usage on error.

it's really annoying to see error in case of command line usage error because usage print occupies whole screen.

$ phpcs -v --standard=PHPCompatibility --runtime-set testVersion 5.3-7.0 --exclude=PHPCompatibility.Sniffs.PHP.ForbiddenNamesAsInvokedFunctionsSniff cs70-int.php

image

i have to scroll back two screens of text to see the actual error:

image

Enhancement

Most helpful comment

This change has been committed to the 3.0 branch. Output now looks like this:

$ phpcs temp.php --sniffs=NotAValidSniff
ERROR: The specified sniff code "NotAValidSniff" is invalid

Run "phpcs --help" for usage information

Thanks for the suggestion.

All 4 comments

Any solution you have in mind? Maybe:

  • either showing error after usage information
  • or showing type "phpcs --help" to see available command line options

yes, the second option, just do not print usage if it was not requested. it breaks concentration to see the actual error.

Yeah, it's getting a bit long. Might be worth changing in the 3.0 version.

This change has been committed to the 3.0 branch. Output now looks like this:

$ phpcs temp.php --sniffs=NotAValidSniff
ERROR: The specified sniff code "NotAValidSniff" is invalid

Run "phpcs --help" for usage information

Thanks for the suggestion.

Was this page helpful?
0 / 5 - 0 ratings