themis/util/remote.py
Function get_ssh_keys
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
Open
def get_ssh_keys():
keys = re.split(r'\s*,\s*', config.get_value(KEY_SSH_KEYS))
for i in range(0, len(keys)):
key = keys[i]
if key[0] == '$':
- 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 run_ssh
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def run_ssh(cmd, host, user=None, keys=None, via_hosts=[], cache_duration_secs=0):
if not keys:
keys = get_ssh_keys()
user = '%s@' % user if user else ''
- 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
Avoid deeply nested control flow statements. Open
Open
if marker_begin not in key_value:
key_value = ('%s\n' % marker_begin) + key_value
if marker_end not in key_value:
Avoid deeply nested control flow statements. Open
Open
if marker_end not in key_value:
key_value += ('\n%s' % marker_end)
key_value = key_value.replace('\n\n', '\n')
Function run_ssh
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def run_ssh(cmd, host, user=None, keys=None, via_hosts=[], cache_duration_secs=0):
Error: invalid syntax (<unknown>, line 71)</unknown> Open
Open
except subprocess.CalledProcessError, e:
- Read upRead up
- Exclude checks
We encountered an error attempting to analyze this line.
TODO found Open
Open
# TODO find a more elegant solution for this.
- Exclude checks