开发者

PHP_CodeSniffer, PHPMD or PHP Depend

I am looking at doing some static code analysis of an exisiting PHP proje开发者_如何学Goct, and I'm having trouble understanding the distinctions between PHP_CodeSniffer, PHPMD, and PHP Depend. Are these simply alternatives to the same problem, or do they complement each other in some ways? Why might a developer choose one over the other?


Shameless copy from http://phpqatools.org

pdepend

pdepend can generate a large set of software metrics from a given code base. These values can be used to measure the quality of a software project and they help to identify the parts of an application where a code refactoring should be applied.

phpmd

phpmd scans PHP source code and looks for potential problems such as possible bugs, dead code, suboptimal code, and overcomplicated expressions.

phpcs

phpcs tokenises PHP, JavaScript and CSS files and detects violations of a defined set of coding standards. It is an essential development tool that ensures your code remains clean and consistent. It can also help prevent some common semantic errors made by developers.

So no, they are not just alternatives. PDepend and PMD focus on on software metrics while PHPCS defines rules based on patterns in the token stream. PDepend doesnt care the slightest about finding Coding Standard violations. You should use all three of them. If possible in your Continuous Integration server, for instance Jenkins.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜