Showing 8 of 32 total issues
File tests.py
has 442 lines of code (exceeds 250 allowed). Consider refactoring. Open
from datetime import datetime
from channels_jsonrpc import JsonRpcConsumerTest, JsonRpcException
from channels.tests import ChannelTestCase, HttpClient
from .consumer import MyJsonRpcWebsocketConsumerTest, DjangoJsonRpcWebsocketConsumerTest
File jsonrpcconsumer.py
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
import json
import logging
import sys
if sys.version_info < (3, 5):
Function __handle
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def __handle(self, content, message):
"""
Handle
:param content:
:param message:
- 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
TestsJsonRPCWebsocketConsumer
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class TestsJsonRPCWebsocketConsumer(ChannelTestCase):
def test_connection(self):
# Test connection
client = HttpClient()
Function http_handler
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def http_handler(self, message):
"""
Called on HTTP request
:param message: message received
: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 __process
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def __process(cls, data, original_msg, is_notification=False):
"""
Process the recived data
:param dict data:
:param channels.message.Message original_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 test_group_notifications
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_group_notifications(self):
from channels import Group
@MyJsonRpcWebsocketConsumerTest.rpc_method()
def add_client_to_group(group_name, **kwargs):
Function __get_result
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __get_result(method, params, original_msg):
func_args = getattr(getfullargspec(method), keywords_args)
if func_args and "kwargs" in func_args:
- 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"