jeremiah-c-leary/hdl-component-manager

View on GitHub
hcm/utils.py

Summary

Maintainability
A
1 hr
Test Coverage

Starting a process with a partial executable path
Open

    lOutput = subprocess.check_output(['md5sum', sFileName], stderr=subprocess.STDOUT).decode('ascii').split('\n')
Severity: Info
Found in hcm/utils.py by bandit

Consider possible security implications associated with subprocess module.
Open

import subprocess
Severity: Info
Found in hcm/utils.py by bandit

subprocess call - check for execution of untrusted input.
Open

    lOutput = subprocess.check_output(['md5sum', sFileName], stderr=subprocess.STDOUT).decode('ascii').split('\n')
Severity: Info
Found in hcm/utils.py by bandit

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

def sort_component_versions_by_revision_number(lVersions, dConfig):

    dRevision_to_version_map = {}
    lRevisions = []
    lReturn = []
Severity: Minor
Found in hcm/utils.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 build_url_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def build_url_path(sUrl, sComponent, sVersion):
    sReturn = sUrl + '/' + sComponent + '/'
    if sVersion is None:
        try:
            sLatestVersion = get_latest_version(sUrl + '/' + sComponent)
Severity: Minor
Found in hcm/utils.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

Invalid escape sequence '.'
Open

    if re.match('^[0-9]+\.[0-9]+\.[0-9]+$', sVersion):
Severity: Minor
Found in hcm/utils.py by pep8

Invalid escape sequences are deprecated in Python 3.6.

Okay: regex = r'\.png$'
W605: regex = '\.png$'

Invalid escape sequence '.'
Open

    if re.match('^[0-9]+\.[0-9]+\.[0-9]+$', sVersion):
Severity: Minor
Found in hcm/utils.py by pep8

Invalid escape sequences are deprecated in Python 3.6.

Okay: regex = r'\.png$'
W605: regex = '\.png$'

Do not use bare 'except'
Open

        except:
Severity: Minor
Found in hcm/utils.py by pep8

When catching exceptions, mention specific exceptions when possible.

Okay: except Exception:
Okay: except BaseException:
E722: except:

Invalid escape sequence '|'
Open

            if re.match('^r[0-9]+ \| ', sOutput):
Severity: Minor
Found in hcm/utils.py by pep8

Invalid escape sequences are deprecated in Python 3.6.

Okay: regex = r'\.png$'
W605: regex = '\.png$'

There are no issues that match your filters.

Category
Status