um-cseg/chez-betty

View on GitHub

Showing 186 of 349 total issues

Function admin_boxes_list has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def admin_boxes_list(request):
    unpopulated_boxes = []
    active_populated = []
    inactive_populated = []

Severity: Minor
Found in chezbetty/views_admin.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 deeply nested control flow statements.
Open

                for line_item in t.subtransactions:
                    wholesale += line_item.wholesale
                sheet.write_number(row, 3, wholesale, money_format)
Severity: Major
Found in export_transactions.py - About 45 mins to fix

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

        def __init__(self, name, barcode, bottle_dep,
    Severity: Minor
    Found in chezbetty/models/box.py - About 45 mins to fix

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

      def create_x_y_from_group(group, start, end, period, process_output=lambda x: x, default=0):
      Severity: Minor
      Found in chezbetty/views_data.py - About 45 mins to fix

        Function user_purchase_add_item_success has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

        function user_purchase_add_item_success (data) {
            if (data.status != "success") {
                if (data.status == "unknown_barcode") {
                    alert_error("Could not find that item.");
                } else {
        Severity: Minor
        Found in chezbetty/static/js/chezbetty-admin.js - 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

        Function update_amount has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def update_amount(self, amount):
                # Remove the balance we added before (upon init or last update_amount)
                if self.to_acct_virt:
                    self.to_acct_virt.balance -= self.amount
                if self.fr_acct_virt:
        Severity: Minor
        Found in chezbetty/models/transaction.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 deeply nested control flow statements.
        Open

                            if p.foreign_keys:
                                obj_changed = True
                                break
                        if obj_changed is True:
        Severity: Major
        Found in chezbetty/models/history_meta.py - About 45 mins to fix

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

          def create_x_y_from_group_each(group, mapping, start, end, process_output=lambda x: x, default=0):
          Severity: Minor
          Found in chezbetty/views_data.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if item_num == '':
                                        vendoritem.enabled = False
                                    else:
                                        vendoritem.item_number = item_num
                                    break
            Severity: Major
            Found in chezbetty/views_admin.py - About 45 mins to fix

              Function admin_cash_adjustment_submit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              def admin_cash_adjustment_submit(request):
                  try:
                      amount = Decimal(request.POST['amount'])
              
                      # Look for custom date
              Severity: Minor
              Found in chezbetty/views_admin.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 deeply nested control flow statements.
              Open

                                      if quantity != '':
                                          # Add a new vendor to the item
                                          item = Item.from_id(item_id)
                                          box_item = BoxItem(box, item, quantity, round(Decimal(percentage), 2))
                                          DBSession.add(box_item)
              Severity: Major
              Found in chezbetty/views_admin.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        if item_num != '':
                                            # Add a new vendor to the item
                                            vendor = Vendor.from_id(vendor_id)
                                            box_vendor = BoxVendor(vendor, box, item_num)
                                            DBSession.add(box_vendor)
                Severity: Major
                Found in chezbetty/views_admin.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if boxitem.item_id == item_id and boxitem.enabled:
                                              if quantity == '' or int(quantity) == 0:
                                                  boxitem.enabled = False
                                              else:
                                                  boxitem.quantity = int(quantity)
                  Severity: Major
                  Found in chezbetty/views_admin.py - About 45 mins to fix

                    Function admin_cash_donation_submit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def admin_cash_donation_submit(request):
                        try:
                            amount = Decimal(request.POST['amount'])
                    
                            # Look for custom date
                    Severity: Minor
                    Found in chezbetty/views_admin.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 deeply nested control flow statements.
                    Open

                                            if vendorbox.vendor_id == vendor_id and vendorbox.enabled:
                                                if item_num == '':
                                                    vendorbox.enabled = False
                                                else:
                                                    vendorbox.item_number = item_num
                    Severity: Major
                    Found in chezbetty/views_admin.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                          if output['addr'] in addrs and output['type'] == 0:
                                              addr = output['addr']
                                              amount += Decimal(output['value'])
                      
                      
                      Severity: Major
                      Found in chezbetty/views_admin.py - About 45 mins to fix

                        Function admin_cash_withdrawal_submit has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def admin_cash_withdrawal_submit(request):
                            try:
                                amount = Decimal(request.POST['amount'])
                                reimbursee = Reimbursee.from_id(int(request.POST['reimbursee']))
                        
                        
                        Severity: Minor
                        Found in chezbetty/views_admin.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

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

                        def cc_deposit(user, account, amount, txn_id, last4):
                        Severity: Minor
                        Found in chezbetty/datalayer.py - About 35 mins to fix

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

                          function ajax_button_textlike (js_obj, object, field, id, value) {
                          Severity: Minor
                          Found in chezbetty/static/js/chezbetty-common-onload.js - About 35 mins to fix

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

                            function ajax_bool (js_obj, object, field, id, state) {
                            Severity: Minor
                            Found in chezbetty/static/js/chezbetty-admin-onload.js - About 35 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language