Lemmah/BucketList

View on GitHub

Showing 14 of 14 total issues

Function remove_bucketlist_item has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def remove_bucketlist_item(bucketlist_name, item_name):
''' Remove item_name from bucketlist_name '''
if get_session_user is not None:
session_user = get_session_user()
for bucketlist in session_user.available_bucketlists:
Severity: Minor
Found in app/views.py - About 1 hr to fix

Function update_bucketlist_item has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def update_bucketlist_item(bucketlist_name, item_name):
''' Update item_name in bucketlist_name with item_details '''
name = request.form.get('item_name')
description = request.form.get('item_desc')
category = str(request.form.get('item_category'))
Severity: Minor
Found in app/views.py - About 1 hr to fix

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

for bucketlist_item in target_bucketlist.items:
if str(bucketlist_item) == item_name:
delete_item = target_bucketlist.remove_item(bucketlist_item)
flash(delete_item)
return redirect("/dashboard/")
Severity: Major
Found in app/views.py and 1 other location - About 1 hr to fix
app/views.py on lines 122..126

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

for bucketlist in session_user.available_bucketlists:
if str(bucketlist) == bucketlist_name:
delete_bucketlist = session_user.delete_bucketlist(bucketlist)
flash(delete_bucketlist)
return redirect("/dashboard/")
Severity: Major
Found in app/views.py and 1 other location - About 1 hr to fix
app/views.py on lines 207..211

Function display_bucketlist_items has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

def display_bucketlist_items(bucketlist_name):
''' Read bucketlist items and display them '''
if session['logged_in']:
if get_session_user() is not None:
session_user = get_session_user()
Severity: Minor
Found in app/views.py - About 1 hr to fix

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

for bucketlist in session_user.available_bucketlists:
if str(bucketlist) == bucketlist_name:
update_bucketlist = session_user.change_bucketlist_details(bucketlist, bucketlist_details)
flash(update_bucketlist)
return redirect("dashboard/")
Severity: Major
Found in app/views.py and 1 other location - About 1 hr to fix
app/views.py on lines 188..191

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

if str(bucketlist_item) == item_name:
update_item = target_bucketlist.update_item(bucketlist_item, new_details)
flash(update_item)
return redirect("/dashboard/")
Severity: Major
Found in app/views.py and 1 other location - About 1 hr to fix
app/views.py on lines 108..112

Avoid deeply nested control flow statements.
Open

if str(bucketlist_item) == item_name:
update_item = target_bucketlist.update_item(bucketlist_item, new_details)
flash(update_item)
return redirect("/dashboard/")
flash("The bucketlist item you are trying to delete is not available")
Severity: Major
Found in app/views.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

    if str(bucketlist_item) == item_name:
    delete_item = target_bucketlist.remove_item(bucketlist_item)
    flash(delete_item)
    return redirect("/dashboard/")
    flash("The bucketlist item you are trying to delete is not available")
    Severity: Major
    Found in app/views.py - About 45 mins to fix

      Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def __init__(self, name, category, description=None, status=None, bucketlist=None):
      Severity: Minor
      Found in app/bucketlist/bucketlist_item.py - About 35 mins to fix

        Function login has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def login():
        ''' Validate user details from existing non-persistent data '''
        email = request.form.get('email')
        password = request.form.get('password')
        for user in registered_users:
        Severity: Minor
        Found in app/views.py - About 35 mins to fix

        Function delete_bucketlist has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def delete_bucketlist(bucketlist_name):
        ''' Deletes the bucketlist with the name name '''
        if get_session_user is not None:
        session_user = get_session_user()
        for bucketlist in session_user.available_bucketlists:
        Severity: Minor
        Found in app/views.py - About 35 mins to fix

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

        def update_bucketlist_details(bucketlist_name):
        ''' Updates the bucketlist details from a form '''
        name = request.form.get('bucketlist_name')
        description = request.form.get('bucketlist_desc')
        bucketlist_details = (name, description)
        Severity: Minor
        Found in app/views.py - About 25 mins to fix

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

        def add_bucketlist_item(bucketlist_name):
        ''' Add item details to bucketlist_name from a form '''
        name = request.form.get('item_name')
        description = request.form.get('item_desc')
        category = str(request.form.get('item_category'))
        Severity: Minor
        Found in app/views.py - About 25 mins to fix
        Severity
        Category
        Status
        Source
        Language