-
Notifications
You must be signed in to change notification settings - Fork 893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ruff and Flake8's McCabe complexity differs #3347
Comments
Reproduced. |
Here's a more minimal repro -- Ruff calls this 3, Flake8 calls this 2: def process_detect_lines():
try:
pass
finally:
if res:
errors.append(f"Non-zero exit code {res}") I may have to actually learn how this works, because I thought that would've been 3. |
I guess it makes sense that it's 2 if you say that the def process_detect_lines():
try:
pass
finally:
pass |
Maybe this is a bug in flake8. |
I think this is a bug in flake8. This is supposed to be 1, not 2. Radon give this code 1 cc. https://radon.readthedocs.io/en/latest/intro.html#cyclomatic-complexity |
Oh cool, I'll take another look at our implementation with those guidelines in mind. |
I also noticed this when adding Ruff to HA – didn't think to report it back then though! https://github.com/home-assistant/core/blob/fde205c158b704683650cec1d5832ca0858bbd21/pyproject.toml#L293-L302 |
From Discord: https://gitlab.com/ppentchev/temp-20230302-ruff-complexity
The text was updated successfully, but these errors were encountered: