Skip to content

New Lint: Avoid too many static code paths #1681

Open
@Evrey

Description

@Evrey

Based on this HIC++ guideline, in addition to the existing cyclomatic complexity lint. It basically comes down to the possible number of branches in a function's code path, not counting loops. E.g. this is okay:

if this { that }
else { or_that } // Just 2 code paths

Wherease this is not so cool:

if this1 { that1(); } // ... 2 paths (do or don't)
if this2 { that2(); } // ... 4 paths
if this3 { that3(); } // ... 8 paths
...
if this10 { that10(); } // ... 1024 paths - Have fun with unit testing!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-lintArea: New lintsE-mediumCall for participation: Medium difficulty level problem and requires some initial experience.L-correctnessLint: Belongs in the correctness lint groupL-styleLint: Belongs in the style lint groupT-MIRType: This lint will require working with the MIRT-middleType: Probably requires verifiying types

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions