Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
results = {}
lines = sourceCode.splitlines()
for warning in check.messages:
if isinstance(warning.lineno, int):
lineno = warning.lineno
else:
# By some reasons I see ast NAME node here (pyflakes 0.7.3)
lineno = warning.lineno.lineno
if not IGNORE_REGEXP.search(lines[lineno - 1]):
if lineno in results:
results[lineno].append(warning.message % warning.message_args)
else:
results[lineno] = [warning.message % warning.message_args]
# Radon: CC complexity as the second value
return results, sorted_results(cc_visit_ast(tree))