Function remove_NaN
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def remove_NaN(obj, delete_values=True, replacement='NaN', expect_only_numbers=False):
if isinstance(obj, list):
i = 0
while i < len(obj):
if is_composite(obj[i]):
- 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
File common.py
has 281 lines of code (exceeds 250 allowed). Consider refactoring. Open
import threading
import subprocess32 as subprocess
import os
import re
import time
Function run
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def run(cmd, cache_duration_secs=0, log_error=False, retries=0, sleep=2, backoff=1.4):
def do_run(cmd):
try:
mutex_popen.acquire()
# process = subprocess.check_output(cmd, shell=True, stderr=subprocess.STDOUT)
- 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 parallelize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def parallelize(array_or_dict, func):
class MyThread (threading.Thread):
def __init__(self, item, key=None):
threading.Thread.__init__(self)
self.item = item
- 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
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def run(cmd, cache_duration_secs=0, log_error=False, retries=0, sleep=2, backoff=1.4):
Function run_cached
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def run_cached(func, cache_duration_secs=0, **kwargs):
if cache_duration_secs <= 0:
return func(**kwargs)
hash = md5(func.__name__ + str(kwargs))
cache_file = CACHE_FILE_PATTERN.replace('*', '%s') % hash
- 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 array_reverse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def array_reverse(array):
result = []
for i, item1 in enumerate(array):
for j, item2 in enumerate(item1):
if len(result) <= j:
- 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
Error: invalid syntax (<unknown>, line 54)</unknown> Open
except Exception, e:
- Read upRead up
- Exclude checks
We encountered an error attempting to analyze this line.