Starting a process with a partial executable path Open
lOutput = subprocess.check_output(['md5sum', sFileName], stderr=subprocess.STDOUT).decode('ascii').split('\n')
- Exclude checks
Consider possible security implications associated with subprocess module. Open
import subprocess
- Exclude checks
subprocess call - check for execution of untrusted input. Open
lOutput = subprocess.check_output(['md5sum', sFileName], stderr=subprocess.STDOUT).decode('ascii').split('\n')
- Exclude checks
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 = []
- Read upRead up
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)
- Read upRead up
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):
- Read upRead up
- Exclude checks
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):
- Read upRead up
- Exclude checks
Invalid escape sequences are deprecated in Python 3.6.
Okay: regex = r'\.png$'
W605: regex = '\.png$'
Do not use bare 'except' Open
except:
- Read upRead up
- Exclude checks
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):
- Read upRead up
- Exclude checks
Invalid escape sequences are deprecated in Python 3.6.
Okay: regex = r'\.png$'
W605: regex = '\.png$'