Showing 25 of 45 total issues
BasicWorker
has 26 functions (exceeds 20 allowed). Consider refactoring. Open
class BasicWorker(object):
def __init__(self, disown_timeout=DEFAULT_DISOWN_TIMEOUT,
heartbeat_timeout=DEFAULT_HEARTBEAT_TIMEOUT,
io_loop=None, app=None, uuid=None, endpoint=None):
if heartbeat_timeout < disown_timeout:
File headers.py
has 283 lines of code (exceeds 250 allowed). Consider refactoring. Open
#
# Copyright (c) 2012+ Anton Tyurin <noxiouz@yandex.ru>
# Copyright (c) 2011-2016 Other contributors as noted in the AUTHORS file.
#
# This file is part of Cocaine.
File worker.py
has 274 lines of code (exceeds 250 allowed). Consider refactoring. Open
#
# Copyright (c) 2012+ Anton Tyurin <noxiouz@yandex.ru>
# Copyright (c) 2013+ Evgeny Safronov <division494@gmail.com>
# Copyright (c) 2011-2014 Other contributors as noted in the AUTHORS file.
#
Function resolve_logging
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def resolve_logging(endpoints, name="logging", io_loop=None):
if io_loop:
warnings.warn('io_loop argument is deprecated.', DeprecationWarning)
for host, port in endpoints:
- 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 merge
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def merge(self, raw_headers):
# TODO: PY3: the static table contains only byte strings.
# Seems values must be converted to bytestrings too.
if raw_headers is None or len(raw_headers) == 0:
return Headers()
- 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 _send
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def _send(self):
""" Send a message lazy formatted with args.
External log attributes can be passed via named attribute `extra`,
like in logging from the standart library.
- 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 emit
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def emit(self, record):
lvl = record.levelno
extra = getattr(record, "extra", {})
if lvl >= logging.ERROR:
# to avoid message formatting
- 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 _invoke
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _invoke(self, method_name, *args, **kwargs):
trace = kwargs.pop("trace", None)
if trace:
update_dict_with_trace(kwargs, trace)
new_trace_id = kwargs.get('trace_id', self.trace_id)
- 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 feed_message
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def feed_message(self, msg):
session, type_id, payload = msg[:3]
if session == 1:
if type_id == RPCv1.HEARTBEAT:
self._dispatch_heartbeat(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 makeRecord
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def makeRecord(self, name, level, fn, lno, msg, args, exc_info, func=None, extra=None): # noqa
Function prepare_message_args
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def prepare_message_args(self, level, message, *args, **kwargs):
if args:
try:
message %= args
except Exception:
- 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 search
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def search(self, name, value):
"""
Searches the table for the entry specified by name
and value
- 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 on_read
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def on_read(self, read_bytes):
self.log.debug("read %.300s", read_bytes)
self.buffer.feed(read_bytes)
for msg in self.buffer:
self.log.debug("unpacked: %.300s", msg)
- 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 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, rx_tree, session_id, header_table=None, io_loop=None, service_name=None,
Function __init__
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, endpoints=LOCATOR_DEFAULT_ENDPOINT,
Function __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, tx_tree, pipe, session_id, header_table, service_name, trace_id=None):
Function manage_headers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def manage_headers(headers, table):
result = []
for k, v in six.iteritems(headers):
match = table.search(k, v)
if match 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 get
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get(self, timeout=0, protocol=None):
if self._done and self._queue.empty():
raise ChokeEvent()
# to pull various service errors
- 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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, disown_timeout=DEFAULT_DISOWN_TIMEOUT,
Function _dispatch_invoke
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _dispatch_invoke(self, msg, headers):
response = ResponseStream(msg.session, self, msg.event)
try:
workerlog.debug("invoke has been received %s", msg)
request = RequestStream(headers, self._header_table['rx'])
- 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"