Function update_data_from_request
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def update_data_from_request(self, request, result):
if result.get('user') is None:
result['user'] = self.get_user_info(request)
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 format_sql
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def format_sql(sql, params):
rv = []
if isinstance(params, dict):
conv = _FormatConverter(params)
- 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 capture
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def capture(self, event_type, request=None, **kwargs):
if kwargs.get('data') is None:
kwargs['data'] = data = {}
else:
data = kwargs['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 build_msg
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def build_msg(self, *args, **kwargs):
data = super(DjangoClient, self).build_msg(*args, **kwargs)
for frame in self._iter_frames(data):
module = frame.get('module')
- 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 record_sql
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def record_sql(vendor, alias, start, duration, sql, params):
Function record_many_sql
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def record_many_sql(vendor, alias, start, sql, param_list):
Function get_user_info
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_user_info(self, request):
user_info = {
'ip_address': get_client_ip(request.META),
}
- 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"