diff --git a/flakehell/_constants.py b/flakehell/_constants.py index 9522ecc..5c84b8d 100644 --- a/flakehell/_constants.py +++ b/flakehell/_constants.py @@ -60,6 +60,7 @@ class ExitCodes(IntEnum): # 'flake8-strict', 'flake8-string-format', 'flake8-variables-names', + 'mccabe', 'pep8-naming', # built-in in flake8 diff --git a/flakehell/_logic/_extractors.py b/flakehell/_logic/_extractors.py index 8d583fa..2306e24 100644 --- a/flakehell/_logic/_extractors.py +++ b/flakehell/_logic/_extractors.py @@ -14,7 +14,7 @@ class CollectStrings(ast.NodeVisitor): _strings = [] - def visit_Str(self, node): + def visit_Str(self, node): # noqa: N802 self._strings.append(node.s) @@ -281,6 +281,13 @@ def extract_dlint(): return codes +def extract_mccabe(): + from mccabe import McCabeChecker + + code, message = McCabeChecker._error_tmpl.split(' ', maxsplit=1) + return {code: message} + + def extract_wemake_python_styleguide(): from wemake_python_styleguide import violations diff --git a/pyproject.toml b/pyproject.toml index 7743a83..ad7020e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,6 +114,7 @@ dev = [ "flake8-strict", "flake8-string-format", "flake8-variables-names", + "mccabe", "pep8-naming", "pylint", "wemake-python-styleguide",