Skip to content

Generic/CyclomaticComplexity: add metrics #745

Open
@jrfnl

Description

@jrfnl

Is your feature request related to a problem?

PHPCS can provide statistics about a code base via the --report=info feature.

This information is recorded by sniffs via the File::recordMetric() method.

I believe it could be interesting for code base owners already using PHPCS to have a straight forward way to get insight into the cyclomatic complexity across their codebase.

Describe the solution you'd like

For the sniff to start recording metrics, probably grouped in a few "steps", possibly along the lines of those mentioned in this comment (+ some more for very high complexity).

Maybe a grouping like this ?

  • 1-5 (low risk)
  • 6-10 (normal risk)
  • 11-20 (moderate risk)
  • 21-50 (high risk)
  • 51-100 (very high risk)
  • 101-500 (very high risk)
  • 501-1000 (very high risk)
  • 1001-5000 (very high risk)
  • 5001-10000 (very high risk)
  • 10000+ (very high risk)
  • I have read the Contribution Guidelines and this is not a support question.
    I intend to create a pull request to implement this feature.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Generic/CyclomaticComplexity: add metrics · Issue #745 · PHPCSStandards/PHP_CodeSniffer