CodeTheChangeUBC/reBOOT

View on GitHub

Showing 10 of 79 total issues

Function createLineGraph has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  LineGraph.prototype.createLineGraph = function() {
    var self = this;

    var brandPrimary = self._option.color.primary;
    var brandSecondary = self._option.color.secondary;
Severity: Minor
Found in static/admin/js/pages/analytics/graph/line-graph.js - About 1 hr to fix

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

        def response_change(self, req: HttpRequest, obj):
            if "_generate_receipt" in req.POST or \
               "_mark_items_verified" in req.POST or \
               "_mark_items_unverified" in req.POST:
                obj.save()
    Severity: Minor
    Found in app/admin.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 ItemLocationController has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      function ItemLocationController(elementId, keyName, valueName, startDate, endDate, graphOption) {
    Severity: Minor
    Found in static/admin/js/pages/analytics/controller/item-location.js - About 45 mins to fix

      Function ItemStatusController has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        function ItemStatusController(elementId, keyName, valueName, startDate, endDate, graphOption) {
      Severity: Minor
      Found in static/admin/js/pages/analytics/controller/item-status.js - About 45 mins to fix

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

            def generate_receipt_policy(self, req, qs):
                err = None
                if not req.user.has_perm('app.generate_tax_receipt'):
                    err = PERMISSION_DENIED
                elif not all([d.is_items_received() for d in qs]):
        Severity: Minor
        Found in app/admin.py - About 35 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 poll_state has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def poll_state(request: HttpRequest):
            """A view to report the progress to the user"""
            task_id = request.POST.get("task_id", None)
            if task_id is None:
                return _error(
        Severity: Minor
        Found in app/views/views.py - About 35 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 queryset
        Severity: Major
        Found in app/filters/donation_status_filter.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return super().response_change(req, obj)
          Severity: Major
          Found in app/admin.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return queryset.filter(donate_date=None)
            Severity: Major
            Found in app/filters/donation_status_filter.py - About 30 mins to fix

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

                  def __call__(self):
                      update_percent(0)
                      # Note: SMTP may fail due to Gmail security policy. Check credentials
                      # and settings
                      if self.shouldSendCopy:
              Severity: Minor
              Found in app/worker/tasks/create_receipt.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