code review sum

 

 

 

 

 
 

 

 

1.代码质量 phploc phpcpd phpmd

PHPLOC 代码成分

https://github.com/sebastianbergmann/phploc  yuezh:framework yuezh$ phploc YiiBase.php --log-xml=/Users/shushuy/Sites/phploc.xml
phploc 2.0.2 by Sebastian Bergmann.

Size
  Lines of Code (LOC)                              845
  Comment Lines of Code (CLOC)                     283 (33.49%)
  Non-Comment Lines of Code (NCLOC)                562 (66.51%)
  Logical Lines of Code (LLOC)                     117 (13.85%)
    Classes                                        108 (92.31%)
      Average Class Length                         108
      Average Method Length                          5
    Functions                                        0 (0.00%)
      Average Function Length                        0
    Not in classes or functions                      9 (7.69%)

Complexity
  Cyclomatic Complexity / LLOC                    0.66
  Cyclomatic Complexity / Number of Methods       4.33

Dependencies
  Global Accesses                                   11
    Global Constants                                11 (100.00%)
    Global Variables                                 0 (0.00%)
    Super-Global Variables                           0 (0.00%)
  Attribute Accesses                                48
    Non-Static                                       1 (2.08%)
    Static                                          47 (97.92%)
  Method Calls                                      25
    Non-Static                                       6 (24.00%)
    Static                                          19 (76.00%)

Structure
  Namespaces                                         0
  Interfaces                                         0
  Traits                                             0
  Classes                                            1
    Abstract Classes                                 0 (0.00%)
    Concrete Classes                                 1 (100.00%)
  Methods                                           21
    Scope
      Non-Static Methods                             0 (0.00%)
      Static Methods                                21 (100.00%)
    Visibility
      Public Method                                 20 (95.24%)
      Non-Public Methods                             1 (4.76%)
  Functions                                          0
    Named Functions                                  0 (0.00%)
    Anonymous Functions                              0 (0.00%)
  Constants                                          7
    Global Constants                                 7 (100.00%)
    Class Constants                                  0 (0.00%)
 

PHPCpd  代码复制

https://github.com/sebastianbergmann/phpcpd
Time: 603 ms, Memory: 36.25Mb
yuezh:commands yuezh$ phpcpd --names *.php
phpcpd 2.0.0 by Sebastian Bergmann.

Found 43 exact clones with 2154 duplicated lines in 14 files:

  -     /Users/shushuy/Sites/finance-fork-yuezh/apps/finance/protected/commands/FinanceRejoStatsCommand.php:146-178
        /Users/shushuy/Sites/finance-fork-yuezh/apps/finance/protected/commands/FinanceRejoStatsCommand.php:484-516
 
  -     /Users/shushuy/Sites/finance-fork-yuezh/apps/finance/protected/commands/FinanceRmaStatsCommand.php:251-273
        /Users/shushuy/Sites/finance-fork-yuezh/apps/finance/protected/commands/FinanceRmaStatsCommand.php:590-612
 
  -     /Users/shushuy/Sites/finance-fork-yuezh/apps/finance/protected/commands/LogisticCodStatsByWareHouseCommand.php:64-92
        /Users/shushuy/Sites/finance-fork-yuezh/apps/finance/protected/commands/LogisticCodStatsCommand.php:16-44
 
  -     /Users/shushuy/Sites/finance-fork-yuezh/apps/finance/protected/commands/LogisticCodStatsByWareHouseCommand.php:439-471
        /Users/shushuy/Sites/finance-fork-yuezh/apps/finance/protected/commands/LogisticCodStatsCommand.php:342-374
 
  -     /Users/shushuy/Sites/finance-fork-yuezh/apps/finance/protected/commands/LogisticCodStatsByWareHouseCommand.php:470-517
        /Users/shushuy/Sites/finance-fork-yuezh/apps/finance/protected/commands/LogisticCodStatsCommand.php:373-420
 
  
9.41% duplicated lines out of 22885 total lines of code.

Time: 566 ms, Memory: 34.75Mb

PHPmd  代码建议

http://phpmd.org/download/release/1.5.0/changelog.html
http://tech.it168.com/a2011/0511/1189/000001189319_all.shtml


2.代码标准 phpcs

https://github.com/opensky/Symfony2-coding-standard

http://phpgeek.diandian.com/post/2011-11-20/6957719

3.代码文档 phpdoc

http://www.phpdoc.org/

memory_limit = 128M

brew install phpdocumentor

http://blog.163.com/yuki_1154/blog/static/712027712014111535094/
http://blog.163.com/lvshutao@126/blog/static/164637467201361015245978/

http://pear.phpdoc.org/

 

 

 

4.代码效率 xhprof

安装:

yum install php54-xhprof

cp xhprof_html xhprof_lib 到可执行php路径下,查看生成报告

 

配置:

[xhprof]
extension=xhprof.so;

xhprof.output_dir=/tmp/xhprof


语法:

http://blog.51yip.com/php/1099.html

报告:

http://aofengblog.blog.163.com/blog/static/6317021201341851510578/

 

 

 

 

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值