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
- Read upRead up
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
- Read upRead up
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()
- Read upRead up
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()
- Read upRead up
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()
- Read upRead up
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)
- Read upRead up
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",
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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,
- Read upRead up