muthash/Weconnect-v1

View on GitHub

Showing 11 of 17 total issues

Function get has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def get(self, business_id):
        """return a list of all businesses else a single business"""
        filter_by = request.args.get('category', 'all', type=str)
        if business_id is None and filter_by == "all":
            business_ = [business.serialize() for business in store]
Severity: Minor
Found in app/business/views.py - About 1 hr 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 validate_null has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_null(**kwargs):
        """Returns a list with null fields"""
        messages = []
        for key in kwargs:
            strip_text = True
Severity: Minor
Found in app/baseview.py - About 45 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

Avoid too many return statements within this function.
Open

        return jsonify(response), 201
Severity: Major
Found in app/business/views.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return jsonify(response), 403
    Severity: Major
    Found in app/business/views.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return jsonify(response), 200
      Severity: Major
      Found in app/business/views.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return jsonify(response), 404
        Severity: Major
        Found in app/business/views.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return jsonify(response), 200
          Severity: Major
          Found in app/business/views.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return jsonify(response), 404
            Severity: Major
            Found in app/business/views.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return jsonify(response), 201
              Severity: Major
              Found in app/business/views.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return jsonify(response), 200
                Severity: Major
                Found in app/business/views.py - About 30 mins to fix

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

                      def delete(self, business_id):
                          if self.validate_json():
                              return self.validate_json()
                          data = request.get_json()
                          password = data.get('password')
                  Severity: Minor
                  Found in app/business/views.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