How to use the radon.complexity.sorted_results function in radon

To help you get started, we’ve selected a few radon examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SergeySatskiy / codimension / codimension / analysis / ierrors.py View on Github external
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))