dousuie2222 2012-04-02 14:15
浏览 67
已采纳

PHP取决于代码度量分析

I am trying to compare two PHP projects using PHP Depend (http://pdepend.org). One is a page-based PHP application written by a group of students a year ago and the second is mine that I have worked on for the past year. The objective is to provide some quantitative statistics that might help validate that refactoring the project (introducing a MVC architecture and lots of refactoring to better apply OO principles) has led to lower complexity and coupling, among others.

The problem I am facing is that when analyzing the older project, PHP depend ignores the files that were written in a procedural programming style. It only picks up those files that have classes defined. I am not sure why the previous students chose to have this hybrid style of writing code but they did.

Is this how PHP Depend works or is there some setting I can use so that it analyzes all files. The site offers little help. If PHP Depend can only analyze files with defined classes and methods, how can I generate some code metrics to validate my project?

  • 写回答

1条回答 默认 最新

  • douou9786 2012-11-11 01:28
    关注

    Actually, PHP depends will generate empty reports for file that do not contain at least a class or a function. This is sadly the expected behavior before someone decides to patch it up.

    You can use PHP LoC, PHP Mess Detector or PHP Code Sniffer to generate some code metrics for both projects. At least PHP LoC will generate all its metrics for unstructured php files, and PHP Code Sniffer and PHP Mess Detector will generate at least some of their metrics.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题