File comp.py
has 356 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding:utf-8 -*-
# --
# Copyright (c) 2012-2014 Net-ng.
# All rights reserved.
#
Function send_notifications
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def send_notifications(self, hours, url):
mail_sender = self._services['mail_sender']
# Group users by board
boards = {}
- 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_exception
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def on_exception(self, request, response):
exc_class, e = sys.exc_info()[:2]
for k, v in request.POST.items():
if isinstance(v, cgi.FieldStorage):
request.POST[k] = u'Content not displayed'
- 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, app_title, app_banner, favicon, theme,
Avoid deeply nested control flow statements. Open
with h.tr:
h << h.td(usr.username)
h << h.td(usr.fullname)
h << h.td(usr.email)
h << h.td(usr.registration_date.isoformat())
Avoid deeply nested control flow statements. Open
if event.card:
# IDs are interpreted as anchors since HTML4. So don't use the ID of
# the card as a URL fragment, because the browser
# jumps to it.
ev_url = urlparse.urljoin(url, event.board.url)
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, app_title, theme, config, card_extensions, services_service):
Function __call__
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, environ, start_response):
query = environ['QUERY_STRING']
if ('state=' in query) and (('code=' in query) or ('error=' in query)):
request = webob.Request(environ)
environ['QUERY_STRING'] += ('&' + request.params['state'])
- 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"