PyCQA / mccabe

McCabe complexity checker for Python

Home Page:pypi.python.org/pypi/mccabe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Allow setting max complexity per function

sharkwouter opened this issue · comments

I've been using flake8 for checking complexity of methods. I now set the max complexity to 6, which mostly results in more readable code, but I did find there are some exceptions. Now it's easy to exclude one method from the complexity check, but I would prefer to have a different max complexity just for this method instead. That way it won't go up further without anyone noticing.

I'm not sure what an implementation for this would look like, though. If I had an idea, I could give it a shot.

Perhaps something like # max-complexity: 7 could work. Right now # noqa: C901 is the only option.

You likely will want to switch to Radon which plugs into flake8 and has far more features than this tool intends to implement or maintain