code review sum
2014-07-10 06:55
197 查看
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语法:
xhprof_disable — 停止 xhprof 分析器
xhprof_enable — 启动 xhprof 性能分析器
xhprof_sample_disable — 停止 xhprof 性能采样分析器
xhprof_sample_enable — 以采样模式启动 XHProf 性能分析 http://blog.51yip.com/php/1099.html报告: http://aofengblog.blog.163.com/blog/static/6317021201341851510578/
[/code]
相关文章推荐
- LINTCODE——Sliding Window Unique Elements Sum
- [bzoj4299]Codechef FRBSUM
- redmine添加redmine_code_review 插件
- LintCode "k Sum" !!
- 豆瓣 CODE 两年历程回顾:git 不是万能的,没有 review 是万万不能的
- BZOJ4299 Codechef FRBSUM(主席树)
- LCMS Code Review
- code-review: 去掉多余的缩进,代码会更清晰。
- Jupiter Code Review Reference -- Jupiter代码审查工具使用参考
- Codeforces Round #336 (Div. 2)B. Hamming Distance Sum 前缀和
- Leet Code 18 4Sum - 四个数的和等于给定值 - Java
- bzoj 4299: Codechef FRBSUM 主席树
- Leet Code 40 - Combination Sum II - 组合和 - Java
- lintcode: k Sum 解题报告
- Bzoj4299 Codechef FRBSUM
- 基于Code_Collaborator和Review_board的代码审工具试用对比说明
- leecode 解题总结:307. Range Sum Query - Mutable
- Codeforces Gym F. Performance Review (树状数组 + DFS 序)
- lintcode: Partition Equal Subset Sum
- 20 Best Code Review Tools for Developers