php_codesninffer phpcs用法学习使用:

 

 

购买阿里云相关服务,这里可以领取优惠券, 有的产品5折优惠哟, 注意, 领取的优惠券30天内有效,尽快使用:
领取方式:进入链接后 页面下拉 一键领取全部 或者按需每次领取对应的优惠,领取链接:
点击此处链接领取
https://promotion.aliyun.com/ntms/act/ambassador/sharetouser.html?userCode=s306eooi&utm_source=s306eooi
如果有需要, 可以帮助部署LNMP环境, 价格80,学生可以商量

最新阿里云优惠  


18:34 2016/1/12
php_codesninffer phpcs用法学习使用:
可以加一个参数设置结果输出为各种格式:
如source格式:
$ phpcs -s --report=source /path/to/code
原文:
To show source codes instead of friendly names, use the -s command line argument.

Sample PHP_CodeSniffer source code output

$ phpcs -s --report=source /path/to/code


输出显示时显示屏幕一般很小,可以设置屏幕大小:
Specifying a Report Width
By default, PHP_CodeSniffer will print all screen-based reports 80 characters wide. File paths will be truncated if they don't fit within this limit and error messages will be wrapped across multiple lines. You can increase the report width to show longer file paths and limit the wrapping of error messages using the -report-width command line argument.

Setting the report width to be 120 characters

$ phpcs --report-width=120 --report=summary /path/to/code/myfile.php

很有用的是可以不输出到屏幕而保存到文件进行查看:
Writing a full report to a file and a summary report to the screen

$ phpcs --report-full=/path/to/full.txt --report-summary /path/to/code

很有用的一个用法,把结果输出到屏幕的同时保存到文件:
把phpcs + 文件名运行的结果输出到屏幕的同时输入保存到一个指定文件:
phpcs --reprt-full=保存的文件 index.php
原文:
Writing a Report to a File
PHP_CodeSniffer always prints the specified report to the screen, but it can also be told to write a copy of the report to a file. When writing to a file, all internal parsing errors and verbose output PHP_CodeSniffer produces will not be included in the file. This feature is particularly useful when using report types such as XML and CSV that are often parsed by scripts or used with continuous integration software.

To write a copy of a report to a file, use the --report-file command line argument.

Writing a report to a file

$ phpcs --report=xml --report-file=/path/to/file.xml /path/to/code

也可以把结果部分保存到文件,部分输出大屏幕:
You can print some reports to the screen and other reports to files.

Writing a full report to a file and a summary report to the screen

$ phpcs --report-full=/path/to/full.txt --report-summary /path/to/code

还可以输出不同格式到不同的多个文件:
You can write the reports to separate files by specifying the path to the output file after each report argument.

Writing a full and summary report to a file

$ phpcs --report-full=/path/to/full.txt --report-summary=/path/to/summary.txt /path/to/code

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值