About PHP_ Codesniffer code detection parameter learning record


PHP code detection toolCodeSniffer

  • Installing using composercomposer require squizlabs/php_codesniffer

  • Git pull Download https://github.com/squizlabs/PHP_CodeSniffer.git

  • There are two main files:

|-- squizlabs
    |-- php_codesniffer
        |-- bin
            |--Phpcbf // code correction script
            |-- phpcbf.bat
            |--Phpcs // code detection script
            |-- phpcs.bat
  • View parameters of running detection file./bin/phpcs -h | --help

  • For the parameters of running code repair script, see./bin/phpcbf -h | --help

  • View version information./bin/phpcs --version

  • For example, detecting a file can be run directly./bin/phpcs ./testCheck the test directory under the current directory. You can also check a file and change the directory to a specific file name

  • Set encoding format at run time./bin/phpcs --encoding=utf-8

  • Test results are not printedwarninginformation./bin/phpcs -n ./test

  • Dynamic display of detection progress./bin/phpcs -p ./test

  • Print error and warning information. The default configuration does not need to be modified./bin/phpcs -w ./test

  • parameter-lNo recursive check, only check the current directory./bin/phpcs -l ./test

  • parameter-sShow the specific problems of each file in detail./bin/phpcs -s ./test

  • parameter-aInteractive operation generally has three options: re detection, skip and exit./bin/phpcs -a ./test

  • parameter-iDisplays the installed coding standards./bin/phpcs -i ./test

The installed coding standards are MySource, PEAR, PSR1, PSR12, PSR2, Squiz and Zend

  • parameter--colorsSets the color of the output

  • parameter--no-colorsDo not set the output color, default configuration

  • parameter--cacheCache output results

  • parameter--no-cacheDo not cache output results, default configuration

  • parameter--ignore-annotationsIgnore code comments

  • parameter--report=summaryDisplays only a summary report of the number of errors and warnings per file

  • parameter--report=souurcePrint source report

  • parameter--report=infoPrint detail report

  • parameter--report=ocdePrint code report

  • more--reportparameterCheckstyle,csv, Emacs, git, json, JUnit, svn, xml

  • Write test results to file--report-full=Followed by the file path

  • parameter--standardSet the encoding standard used when detecting files./bin/phpcs --standard=psr2 ./test

  • parameter-eAnd parameters--standard=psr2Used together, you can print out the current file and check the standard bricks that need to be done

  • parameter--extensionsCheck only files with currently listed file suffixes./bin/phpcs --extensions=php --standard=psr2 ./test

  • parameter--severityDisplays the level of the printed message. The default is 5./bin/phpcs --severity=2 ./test

  • parameter--config-setModify configuration options

This work adoptsCC agreement, reprint must indicate the author and the link to this article

LIYi —- GitHub address

Recommended Today

Expectation maximization algorithm (EM)

Expectation maximization algorithm (EM) Expectation maximization algorithm (EM) 1、 Generalized steps of EM algorithm 2、 First write the formula of EM 3、 Proof of its convergence 4、 Formula derivation method 1 4.1 E-M step formula 4.2 derivation process 5、 Formula derivation method 2 (involving Jensen inequality) 5.1 Jensen inequality 5.2 understanding of E-M algorithm 5.3 […]