Showing 186 of 349 total issues
Function admin_event
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def admin_event(request):
try:
event = Event.from_id(int(request.matchdict['event_id']))
# Mangers can only see restocks.
- 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
Avoid too many return
statements within this function. Open
Open
return zip(create_x_y_from_group(data, start, end, period, float, 0.0))
Avoid too many return
statements within this function. Open
Open
return {'status': 'error'}
Avoid too many return
statements within this function. Open
Open
return {'status': 'error'}
Avoid too many return
statements within this function. Open
Open
return True
Avoid too many return
statements within this function. Open
Open
return datetime_to_timestamps(data, float)
Avoid too many return
statements within this function. Open
Open
return {'error': str(e)}
Avoid too many return
statements within this function. Open
Open
return '<a href="/admin/pool/{}">{}</a>'.format(obj.id, shorten(obj.name, str_len))
Avoid too many return
statements within this function. Open
Open
return ["serviceaccount"]
Avoid too many return
statements within this function. Open
Open
return obj.name
Avoid too many return
statements within this function. Open
Open
return HTTPFound(location=request.route_url('user_pool', pool_id=pool.id))
Avoid too many return
statements within this function. Open
Open
return HTTPFound(location=request.route_url('user_pools'))
Avoid too many return
statements within this function. Open
Open
return '<a href="/admin/vendor/edit/{}">{}</a>'.format(obj.id, shorten(obj.name, str_len))
Avoid too many return
statements within this function. Open
Open
return {'status': 'error'}
Avoid too many return
statements within this function. Open
Open
return HTTPFound(location=request.route_url('admin_events'))
Avoid too many return
statements within this function. Open
Open
return HTTPFound(location=request.route_url('admin_user_balance_edit'))
Avoid too many return
statements within this function. Open
Open
return HTTPFound(location=request.route_url('admin_event', event_id=event.id))
Avoid too many return
statements within this function. Open
Open
return HTTPFound(location=request.route_url('admin_cash_reconcile'))
Avoid too many return
statements within this function. Open
Open
return HTTPFound(location=request.route_url('admin_cash_reconcile'))
Avoid too many return
statements within this function. Open
Open
return HTTPFound(location=request.route_url('admin_item_edit', item_id=int(request.POST['item-id'])))