Skip to content
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

mccable should allow ranged noqa exceptions #80

Closed
ssbarnea opened this issue Aug 14, 2020 · 3 comments
Closed

mccable should allow ranged noqa exceptions #80

ssbarnea opened this issue Aug 14, 2020 · 3 comments

Comments

@ssbarnea
Copy link
Member

Assuming you have some code that for historical reason on not may need an exemption from the desired max-complexity value, you should be able to specify an upper limit for the exception.

Without an upper limit, there is no way to prevent complexity from increasing because the linter will always be happy.

Practical example at https://github.com/ansible/ansible-lint/blob/master/.flake8#L54-L55 which adds exception for specific file.

If working correctly something like noqa: C901(12) should be allowed, one that states that C901 should be ignored unless is bigger than 12 (assume that your overall project has lower limit).

I am not aware of any workaround for achieving this.

@sigmavirus24
Copy link
Member

mccabe doesn't handle # noqa at all so this is a request for Flake8. Flake8 also defines the command-line flag. That said, I'll say that I don't think this makes much sense to include in-line like this. Perhaps another comment or annotation would work better than this. That would still be handled by Flake8 though

@ssbarnea
Copy link
Member Author

I added a feature request to flake8 itself at https://gitlab.com/pycqa/flake8/-/issues/679 -- I am not yet sure how it will be achievable but I hope that I explained the use-case well enough.

@sigmavirus24
Copy link
Member

Given that mccabe doesn't do anything like this and is basically not much of its own tool, I'm closing this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants