complexipy 5.0.0, cognitive complexity tool

Posted by fexx3l@reddit | Python | View on Reddit | 25 comments

Hi r/Python! I've released the version v5.0.0. This version introduces new changes that will improve the tool adoption in existing projects and the cognitive complexity algorithm itself.

What My Project Does

complexipy is a command-line tool and library that calculates the cognitive complexity of Python code. Unlike cyclomatic complexity, which measures how complex code is to test, cognitive complexity measures how difficult code is for humans to read and understand.

Target audience

complexipy is built for:

Whether you're working solo or in a team, complexipy helps you keep complexity under control.

Comparison to Alternatives

Sonar has the original version which runs online only in GitHub repos, and it's a slower workflow because you need to push your changes, wait until their scanner finishes the analysis and check the results. I inspired from them to create this tool, that's why it runs locally without having to publish anything and the analysis is really fast.

Highlights of v5.0.0

Breaking: Conditional scoring now counts each elif/else branch as +1 complexity (plus its boolean test), aligning with Sonar’s cognitive-complexity rules; expect higher scores for branching.

GitHub Repo: https://github.com/rohaquinlop/complexipy