Showing 104 of 146 total issues
Avoid deeply nested control flow statements. Open
if _dnsname_match(value, hostname):
return
dnsnames.append(value)
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, *args, **kwargs):
if len(args) == 1:
arg = args[0]
if isinstance(arg, string_types):
self.client = kwargs.pop('client_cls', Client)(dsn=arg, **kwargs)
- 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 report
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def report(request, project_id=None):
if request.method == 'OPTIONS':
return HttpResponse()
if request.method == 'POST':
- 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 get_host
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_host(request):
"""
A reimplementation of Django's get_host, without the
SuspiciousOperation check.
"""
- 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 async_send
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def async_send(self, url, data, headers, success_cb, failure_cb):
Function record_many_sql
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def record_many_sql(vendor, alias, start, sql, param_list):
Function async_send
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def async_send(self, url, data, headers, success_cb, failure_cb):
Function get_lines_from_file
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_lines_from_file(filename, lineno, context_lines,
Function init_app
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def init_app(self, app, dsn=None, logging=None, level=None,
Function _record_log_breadcrumb
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def _record_log_breadcrumb(logger, level, msg, *args, **kwargs):
Function async_send
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def async_send(self, url, data, headers, success_cb, failure_cb):
Function async_send
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def async_send(self, url, data, headers, success_cb, failure_cb):
Function putrequest
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def putrequest(self, method, url, *args, **kwargs):
Function async_send
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def async_send(self, url, data, headers, success_cb, failure_cb):
Function handler
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def handler(logger, level, msg, args, kwargs):
Function send_sync
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_sync(self, url, data, headers, success_cb, failure_cb):
Function async_send
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def async_send(self, url, data, headers, success_cb, error_cb):
Function send_sync
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_sync(self, url, data, headers, success_cb, failure_cb):
Function capture
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def capture(self, event_type, data=None, date=None, time_spent=None,
extra=None, stack=None, tags=None, sample_rate=None,
**kwargs):
"""
Captures and processes an event and pipes it off to SentryClient.send.
- 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"