Showing 10 of 10 total issues
Function prepare_gateway_mock
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def prepare_gateway_mock(
gateway_mock, smalld, side_effects=[()], close_reason=None, auto_close=True
):
"""Configures __iter__ for gateway.
- 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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
logger.info("Running (SmallD v%s)...", __version__)
self.closed_event.clear()
- 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 __iter__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __iter__(self):
try:
self.ws.connect(self.url)
except WebSocketError as e:
logger.debug("Exception connecting to gateway.", exc_info=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 send_request
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def send_request(self, method, path, payload="", attachments=None, params=None):
if attachments:
files = [(f"file{idx}", a) for idx, a in enumerate(attachments)]
args = {"data": {"payload_json": json.dumps(payload)}, "files": files}
elif payload:
- 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_gateway_payload
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def on_gateway_payload(self, func=None, *, op=None, t=None):
def decorator(f):
def filtered_payload_listener(data):
if op is not None and data.op != op:
return
- 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 make_ratelimit_headers
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def make_ratelimit_headers(
Function test_ratelimit_raises_on_limit_exhausted_response
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_ratelimit_raises_on_limit_exhausted_response(
Function prepare_gateway_mock
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def prepare_gateway_mock(
Function send_request
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_request(self, method, path, payload="", attachments=None, params=None):
Function run_heartbeat_loop
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def run_heartbeat_loop(self):
time.sleep(self.heartbeat_interval)
while not self.smalld.closed:
try:
self.send_heartbeat()
- 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"