Skip to content

Generic/CyclomaticComplexity: potential inconsistencies when counting cyclomatic complexity #744

Open
@rodrigoprimo

Description

@rodrigoprimo

Is your feature request related to a problem?

While working on #684, I noticed some divergences between how PHPCS and PHPMD/PHP Depend count cyclomatic complexity. For example, PHPCS increases the cyclomatic complexity by one whenever it finds a default statement, while PHPMD/PHP Depend doesn't.

Maybe there needs to be a review of the sniff to ensure that it is correctly counting cyclomatic complexity? This issue is somewhat related to #726, which presents another case that the sniff considers but that potentially it should not.

I'm not sure if PHPCS or PHPMD is correct, and I was not able to find what is the definition of cyclomatic complexity that is used by the sniff to check if it is following it or not.

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