如果我phploc
针对我的一个 PHP 项目(开源)运行,我会看到这个输出。
phploc 1.6.4 by Sebastian Bergmann.
Directories: 3
Files: 33
Lines of Code (LOC): 2358
Cyclomatic Complexity / Lines of Code: 0.08
Comment Lines of Code (CLOC): 903
Non-Comment Lines of Code (NCLOC): 1455
Namespaces: 0
Interfaces: 3
Classes: 28
Abstract: 1 (3.57%)
Concrete: 27 (96.43%)
Average Class Length (NCLOC): 49
Methods: 149
Scope:
Non-Static: 128 (85.91%)
Static: 21 (14.09%)
Visibility:
Public: 103 (69.13%)
Non-Public: 46 (30.87%)
Average Method Length (NCLOC): 9
Cyclomatic Complexity / Number of Methods: 1.69
Anonymous Functions: 0
Functions: 3
Constants: 9
Global constants: 0
Class constants: 9
通过这个静态分析,如何判断这个代码库是好是坏?或者写得好不好?
- 如果圈复杂度太低或太高,它好吗?
- 有
3.57%
抽象类是好是坏? 14.09%
静态方法。它应该在 OOP 代码库上更低吗?- 没有使用命名空间,是好是坏?
最后一个问题你如何分析带有 phploc 输出的代码库?