douzhang1115 2016-07-03 15:52
浏览 43

php codesniffer什么都不返回...我的标准代码是什么?

I have a laravel application (created with composer) that I am trying to ensure meets PHP coding standards (level PSR-1). I run:

$ phpcs --standard=PSR1 my_app/

And within a few seconds it returns with just a new, empty, ready-to-go command line:

$

Does this mean my code meets all requirements and standards in PSR-1? It does the same with just:

$ phpcs my_app/
$ phpcs --standard=PEAR my_app/
$ phpcs --standard=PSR1 --report=summary lauras_app/

I just want to make sure that if the commands return nothing, that means my code is in standard. Thank you!

  • 写回答

1条回答 默认 最新

  • dqdjfb2325 2016-07-03 16:59
    关注

    Phpcs does not output anything if it does detect no errors. From their doc:

    By default, PHP_CodeSniffer will run quietly, only printing the report of errors and warnings at the end. If you are checking a large number of files, you may have to wait a while to see the report. If you want to know what is happening, you can turn on progress or verbose output.

    There are 2 different options to see what phpcs is doing.

    Using show_progress

    With progress output enabled, PHP_CodeSniffer will print a single-character status for each file being checked

    phpcs --config-set show_progress 1 --standard=PSR1 my_app/
    

    or -p.

    phpcs -p --standard=PSR1 my_app/
    

    The second option is to use the verbose flag -v. You can set it up to -vvv to increase the details.

    With verbose output enabled, PHP_CodeSniffer will print the file that it is checking, show you how many tokens and lines the file contains, and let you know how long it took to process.

    phpcs -v --standard=PSR1 my_app/
    
    评论

报告相同问题?

悬赏问题

  • ¥20 有偿 写代码 要用特定的软件anaconda 里的jvpyter 用python3写
  • ¥20 cad图纸,chx-3六轴码垛机器人
  • ¥15 移动摄像头专网需要解vlan
  • ¥20 access多表提取相同字段数据并合并
  • ¥20 基于MSP430f5529的MPU6050驱动,求出欧拉角
  • ¥20 Java-Oj-桌布的计算
  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题