Skip to content

C901 complex-structure has unclear documentation #25028

@GrantMoyer

Description

@GrantMoyer

Summary

The bad

def foo(a, b, c):
    if a:
        if b:
            if c:
                return 1
            else:
                return 2
        else:
            return 3
    else:
        return 4

and good

def foo(a, b, c):
    if not a:
        return 4
    if not b:
        return 3
    if not c:
        return 2
    return 1

examples for C901 have the same McCabe complexity (4), so the lint would also trigger for the good example if it would trigger for the bad example.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions