hackedteam/test-av2

View on GitHub
AVCommon/commands/server/START_VM.py

Summary

Maintainability
C
1 day
Test Coverage

Function execute has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
Open

def execute(vm, protocol, args):
    """ server side """
    from AVMaster import vm_manager

    #logging.debug("    CS Execute")
Severity: Minor
Found in AVCommon/commands/server/START_VM.py - About 5 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

Function get_status has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

def get_status(vm):
    from AVMaster import vm_manager
    # [19/12/13 11:09:23] Seppia: pid=1432, owner=WIN7-NOAV\avtest, cmd=vmtoolsd.exe
    # pid=1776, owner=NT AUTHORITY\SYSTEM, cmd=vmtoolsd.exe
    # pid=712, owner=NT AUTHORITY\SYSTEM, cmd=TrustedInstaller.exe
Severity: Minor
Found in AVCommon/commands/server/START_VM.py - About 3 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

Avoid deeply nested control flow statements.
Open

                    if status == "INSTALL":
                        logging.debug("waiting for the install to finish: %s/%s" % (i, max_install))
                        sleep(60)
                    else:
                        break
Severity: Major
Found in AVCommon/commands/server/START_VM.py - About 45 mins to fix

    Avoid too many return statements within this function.
    Open

            return "NO-VM-TOOLS"
    Severity: Major
    Found in AVCommon/commands/server/START_VM.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return False, "Error Occurred: Timeout while starting VM"
      Severity: Major
      Found in AVCommon/commands/server/START_VM.py - About 30 mins to fix

        There are no issues that match your filters.

        Category
        Status