理解php静态代码分析结果

时间:2016-06-29 10:40:42

标签: php static-code-analysis phpmd phploc

我需要一个建议。无法找到有关静态代码分析结果的任何信息。例如,我使用phploc,并生成报告。但它是一个好结果或坏我不知道。 据我所知,我不喜欢的报道必须是相同的。看到结果后,您可以解决不良代码。

我可以在哪里看到有关此结果中所有行的信息?

感谢您的帮助!

我找到的只是: 最大方法复杂度不得大于10。 循环复杂度   - 1-4低   - 5-7表示中等复杂度   - 8-10是高复杂性   - 11+是非常复杂的。

Directories                                          1
Files                                                3

Size
  Lines of Code (LOC)                              296
  Comment Lines of Code (CLOC)                     116 (39.19%)
  Non-Comment Lines of Code (NCLOC)                180 (60.81%)
  Logical Lines of Code (LLOC)                      50 (16.89%)
    Classes                                         43 (86.00%)
      Average Class Length                          14
        Minimum Class Length                         0
        Maximum Class Length                        43
      Average Method Length                          3
        Minimum Method Length                        1
        Maximum Method Length                        7
    Functions                                        0 (0.00%)
      Average Function Length                        0
    Not in classes or functions                      7 (14.00%)

Cyclomatic Complexity
  Average Complexity per LLOC                     0.22
  Average Complexity per Class                    4.67
    Minimum Class Complexity                      1.00
    Maximum Class Complexity                     12.00
  Average Complexity per Method                   2.00
    Minimum Method Complexity                     1.00
    Maximum Method Complexity                     4.00

Dependencies
  Global Accesses                                    0
    Global Constants                                 0 (0.00%)
    Global Variables                                 0 (0.00%)
    Super-Global Variables                           0 (0.00%)
  Attribute Accesses                                16
    Non-Static                                      16 (100.00%)
    Static                                           0 (0.00%)
  Method Calls                                      22
    Non-Static                                      22 (100.00%)
    Static                                           0 (0.00%)

Structure
  Namespaces                                         2
  Interfaces                                         0
  Traits                                             0
  Classes                                            3
    Abstract Classes                                 0 (0.00%)
    Concrete Classes                                 3 (100.00%)
  Methods                                           11
    Scope
      Non-Static Methods                            11 (100.00%)
      Static Methods                                 0 (0.00%)
    Visibility
      Public Methods                                10 (90.91%)
      Non-Public Methods                             1 (9.09%)
  Functions                                          0
    Named Functions                                  0 (0.00%)
    Anonymous Functions                              0 (0.00%)
  Constants                                          1
    Global Constants                                 0 (0.00%)
    Class Constants                                  1 (100.00%)

1 个答案:

答案 0 :(得分:0)

以下是一些关于metricsresultsinfo的更多来源/链接。如果你想了解更多关于错误和代码味道的信息,我建议你介绍一下:PHP_CodeSnifferPHP_Depend