/usr/lib/python2.7/dist-packages/pylama/lint/pylama_mccabe.py is in python-pylama 7.3.3-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | """Code complexity checking."""
from mccabe import McCabeChecker
from pylama.lint import Linter as Abstract
import ast
class Linter(Abstract):
"""Run complexity checking."""
@staticmethod
def run(path, code=None, params=None, **meta):
"""MCCabe code checking.
:return list: List of errors.
"""
tree = compile(code, path, "exec", ast.PyCF_ONLY_AST)
McCabeChecker.max_complexity = int(params.get('complexity', 10))
return [
{'lnum': lineno, 'offset': offset, 'text': text, 'type': McCabeChecker._code}
for lineno, offset, text, _ in McCabeChecker(tree, path).run()
]
# pylama:ignore=W0212
|