avocado-framework/avocado

View on GitHub
avocado/plugins/diff.py

Summary

Maintainability
D
1 day
Test Coverage
F
58%

Consider possible security implications associated with subprocess module.
Open

import subprocess
Severity: Info
Found in avocado/plugins/diff.py by bandit

subprocess call - check for execution of untrusted input.
Open

                subprocess.Popen(  # pylint: disable=W1509
                    cmd,
                    close_fds=True,
                    stdin=in_out,
                    stdout=in_out,
Severity: Info
Found in avocado/plugins/diff.py by bandit

Function run has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

    def run(self, config):
        def _get_name(test):
            return str(test["id"])

        def _get_name_no_id(test):
Severity: Minor
Found in avocado/plugins/diff.py - About 7 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File diff.py has 377 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
Severity: Minor
Found in avocado/plugins/diff.py - About 5 hrs to fix

    Function _get_sysinfo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def _get_sysinfo(resultsdir, pre_post):
            sysinfo_dir = os.path.join(resultsdir, "sysinfo", pre_post)
            sysinfo = []
            for path, _, files in os.walk(sysinfo_dir):
                for name in sorted(files):
    Severity: Minor
    Found in avocado/plugins/diff.py - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function _cdiff has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def _cdiff(self, diff):
            for line in diff:
                if line.startswith("+"):
                    yield self.term.COLOR_GREEN + line
                elif line.startswith("-"):
    Severity: Minor
    Found in avocado/plugins/diff.py - About 25 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    There are no issues that match your filters.

    Category
    Status