estimage/webapp/main/routes.py
File routes.py
has 316 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import datetime
import collections
import flask
import flask_login
Function move_consensus_estimate_to_authoritative
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def move_consensus_estimate_to_authoritative(task_name):
form = flask.current_app.get_final_class("AuthoritativeForm")()
if form.validate_on_submit():
if form.i_kid_you_not.data:
pollster_cons = webdata.AuthoritativePollster()
- 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 act_on_global_estimate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def act_on_global_estimate(task_name):
r = routers.PollsterRouter()
form = forms.ConsensusForm()
if form.validate_on_submit():
if form.submit.data and form.i_kid_you_not.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"