Showing 86 of 188 total issues
Function connect
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def connect(self, timeout):
deadline = None if timeout is None else self._io_loop.time() + timeout
try:
if len(self._parent.ssl) > 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 recvall
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def recvall(self, length):
res = b"" if self._read_buffer is None else self._read_buffer
while len(res) < length:
while True:
try:
- 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 __init__
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def __init__(
self,
source,
db,
table,
- 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 read_to_queue
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def read_to_queue(
self,
work_queue,
exit_event,
error_queue,
- 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 csv_writer
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def csv_writer(filename, fields, delimiter, task_queue, error_queue):
try:
with open(filename, "w") as out:
out_writer = csv.writer(out, delimiter=delimiter)
out_writer.writerow(fields)
- 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 expr
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def expr(val, nesting_depth=20):
"""
Convert a Python primitive into a RQL primitive value
"""
if not isinstance(nesting_depth, int):
- 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
Table
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Table(RqlQuery):
term_type = P_TERM.TABLE
statement = "table"
def insert(self, *args, **kwargs):
Function batches
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def batches(self, batch_size=None, warning_queue=None):
# setup table
self.setup_table()
- 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 parse_options
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def parse_options(argv, prog=None):
if platform.system() == "Windows" or platform.system().lower().startswith("cygwin"):
# no colons in name
default_dir = "rethinkdb_export_%s" % datetime.datetime.today().strftime(
"%Y-%m-%dT%H-%M-%S"
- 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 percent_done
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def percent_done(self):
"""return a float between 0 and 1 for a reasonable guess of percentage complete"""
# assume that reading takes 50% of the time and writing the other 50%
completed = 0.0 # of 2.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 _reader
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def _reader(self):
try:
while True:
buf = yield self._stream.read_bytes(12)
(token, length,) = struct.unpack("<qL", buf)
- 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 _reader
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _reader(self):
try:
while True:
buf = self._socket.recvall(12)
(token, length,) = struct.unpack("<qL", buf)
- 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 _handleResponse
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _handleResponse(self, token, data):
try:
cursor = self._cursor_cache.get(token)
if cursor is not None:
cursor._extend(data)
- 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 __call__
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def __call__(
self, name, query_str, times=5, run_options=None, test_connection=True
):
# Try a query multiple times to guard against bad connections
if name is None:
- 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 _read_response
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _read_response(self, query, deadline=None):
token = query.token
# We may get an async continue result, in which case we save
# it and read the next response
while True:
- 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 parse_options
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def parse_options(argv, prog=None):
parser = utils_common.CommonOptionsParser(
usage=usage, epilog=help_epilog, prog=prog
)
- 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 do_restore
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def do_restore(options):
# Create a temporary directory to store the extracted data
temp_dir = tempfile.mkdtemp(dir=options.temp_dir)
try:
- 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 parse_options
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_options(argv, prog=None):
parser = utils_common.CommonOptionsParser(
usage=usage, epilog=help_epilog, prog=prog
)
Function sendall
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def sendall(self, data):
offset = 0
while offset < len(data):
try:
offset += self._socket.send(data[offset:])
- 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 restore_indexes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def restore_indexes(self, warning_queue):
# recreate secondary indexes - dropping existing on the assumption they are wrong
if self.indexes:
existing_indexes = self.query_runner(
"indexes from: %s.%s" % (self.db, self.table),
- 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"