gpt4 book ai didi

PHP_CodeSniffer、PHPMD 或 PHP 依赖

转载 作者:IT王子 更新时间:2023-10-29 01:07:38 26 4
gpt4 key购买 nike

我正在考虑对现有 PHP 项目进行一些静态代码分析,但我无法理解 PHP_CodeSniffer、PHPMD 和 PHP Depend 之间的区别。这些只是同一问题的替代方案,还是它们在某些方面相互补充?为什么开发人员会选择其中一个?

最佳答案

来自 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.

所以不,它们不仅仅是替代品。 PDepend 和 PMD 专注于软件指标,而 PHPCS 定义基于 token 流模式的规则。 PDepend 丝毫不关心是否发现违反编码标准。你应该使用所有这三个。如果可能,在您的持续集成服务器中,例如 Jenkins .

关于PHP_CodeSniffer、PHPMD 或 PHP 依赖,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6009619/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com