pluwum/shopping-list

View on GitHub
app/views.py

Summary

Maintainability
B
4 hrs
Test Coverage

Showing 10 of 10 total issues

Function edit_list_item has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def edit_list_item(shoppinglist_id, id):
"""This displays a specified list item for editing and also saves the item
being edited
"""
# Check if user is logged in
Severity: Minor
Found in app/views.py - About 45 mins to fix

Function create_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def create_list():
"""Handles display of create list page and logic for saving new lists
submisions
"""
# First we make sure the user has logged in
Severity: Minor
Found in app/views.py - About 25 mins to fix

Function add_list_item has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def add_list_item(shoppinglist_id):
"""Handles showing of add item view and saves the item being added"""
# Check that user is logged in
if check_if_user_logged_in():
form = CreateListForm()
Severity: Minor
Found in app/views.py - About 25 mins to fix

Function edit_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def edit_list(id):
"""GET Request that displays edit form view"""
# We check that user is logged in
if check_if_user_logged_in():
form = CreateListForm()
Severity: Minor
Found in app/views.py - About 25 mins to fix

Function index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def index():
"""This handles the logic for user login and displaying login page"""
# Lets make sure the user isn't already logged in
if not check_if_user_logged_in():
form = LoginForm()
Severity: Minor
Found in app/views.py - About 25 mins to fix

Similar blocks of code found in 3 locations. Consider refactoring.
Open

try:
# Find list with item to delete
mylist = shopping_list_app.get_shopping_list(list_id, user_email)
# Remove item from the list
shopping_list_app.user_remove_item_from_list(mylist, id)
Severity: Minor
Found in app/views.py and 2 other locations - About 30 mins to fix
app/views.py on lines 261..276
app/views.py on lines 307..317

Similar blocks of code found in 2 locations. Consider refactoring.
Open

if check_if_user_logged_in():
return render_template('create_list.html',
title='Edit List',
heading="Edit New Shopping List",
btn_txt="Update List",
Severity: Minor
Found in app/views.py and 1 other location - About 30 mins to fix
app/views.py on lines 279..284

Similar blocks of code found in 3 locations. Consider refactoring.
Open

try:
# Update list item
shopping_list_app.user_update_item_in_list(
shopping_list, id, form.name.data, form.description.data)
# When no errors arise, redirect user to list detail view
Severity: Minor
Found in app/views.py and 2 other locations - About 30 mins to fix
app/views.py on lines 261..276
app/views.py on lines 345..357

Similar blocks of code found in 3 locations. Consider refactoring.
Open

try:
# Find the list we want to add items to
mylist = shopping_list_app.get_shopping_list(
shoppinglist_id, user)
# Finally add items to the list and display a success message
Severity: Minor
Found in app/views.py and 2 other locations - About 30 mins to fix
app/views.py on lines 307..317
app/views.py on lines 345..357

Similar blocks of code found in 2 locations. Consider refactoring.
Open

return render_template('create_list.html',
title='Add Items',
heading="Add An Item to your List",
btn_txt="Add Item",
form=form,
Severity: Minor
Found in app/views.py and 1 other location - About 30 mins to fix
app/views.py on lines 166..172

There are no issues that match your filters.

Category
Status