dxania/Send_IT_APIs

View on GitHub

Showing 27 of 46 total issues

Avoid too many return statements within this function.
Open

        return jsonify({'message': f"{user_name} does not exist"}), 404
Severity: Major
Found in app/controllers/user_controller.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                            return jsonify({"message":"Your details have successfully been updated"}), 200
    Severity: Major
    Found in app/controllers/user_controller.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                  return jsonify({'message':"User name required"}), 400
      Severity: Major
      Found in app/validator.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        return jsonify({'message':'Please enter a valid email'}), 400
        Severity: Major
        Found in app/controllers/user_controller.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return jsonify({"message":f"User {user_name} successfully created"}), 201
          Severity: Major
          Found in app/controllers/user_controller.py - About 30 mins to fix

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

                def get_delivered_parcels_by_user(user_id):
                    """Retrieve all parcels by a specific user"""
                    parcel_list = []
                    current_user = get_jwt_identity()
                    if current_user.get('id') == user_id:
            Severity: Minor
            Found in app/controllers/parcel_controller.py - About 25 mins to fix

            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 get_parcels has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def get_parcels():
                    """Retrieve all parcels"""     
                    parcel_list = []
                    current_user = get_jwt_identity()
                    if current_user.get('role') == True:
            Severity: Minor
            Found in app/controllers/parcel_controller.py - About 25 mins to fix

            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

            Severity
            Category
            Status
            Source
            Language