um-cseg/chez-betty

View on GitHub

Showing 186 of 349 total issues

Avoid too many return statements within this function.
Open

        return HTTPFound(location=request.route_url('admin_user_purchase_add'))
Severity: Major
Found in chezbetty/views_admin.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return HTTPFound(location=request.route_url('admin_box_edit', box_id=int(request.POST['box-id'])))
    Severity: Major
    Found in chezbetty/views_admin.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                      return HTTPFound(location=request.route_url('admin_event', event_id=event.id))
      Severity: Major
      Found in chezbetty/views_admin.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return HTTPFound(location=request.route_url('admin_events'))
        Severity: Major
        Found in chezbetty/views_admin.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return HTTPFound(location=request.route_url('admin_user_balance_edit'))
          Severity: Major
          Found in chezbetty/views_admin.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return HTTPFound(location=request.route_url('admin_events'))
            Severity: Major
            Found in chezbetty/views_admin.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return HTTPFound(location=request.route_url('admin_reimbursees'))
              Severity: Major
              Found in chezbetty/views_admin.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return HTTPFound(location=request.route_url('admin_user_balance_edit'))
                Severity: Major
                Found in chezbetty/views_admin.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                          return HTTPFound(location=request.route_url('admin_cash_reconcile'))
                  Severity: Major
                  Found in chezbetty/views_admin.py - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return HTTPFound(location=request.route_url('admin_item_edit', item_id=int(request.POST['item-id'])))
                    Severity: Major
                    Found in chezbetty/views_admin.py - About 30 mins to fix

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

                      function toggle_state_success (data) {
                          var parent = $("#"+$(this).attr("data-parent"))
                      
                          if ($(this).hasClass('require-refresh')) {
                              location.reload();
                      Severity: Minor
                      Found in chezbetty/static/js/chezbetty-user-onload.js - 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_events_by_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def __get_events_by_type(cls, event_type):
                          q = DBSession.query(event.Event)\
                                  .join(Transaction)
                      
                          if event_type == 'cash':
                      Severity: Minor
                      Found in chezbetty/models/transaction.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __init__(self, event, user, amount):
                              cashbox_c = account.get_cash_account("cashbox")
                              prev = cashbox_c.balance
                              Transaction.__init__(self, event, None, user, None, cashbox_c, amount)
                              new = cashbox_c.balance
                      Severity: Minor
                      Found in chezbetty/models/transaction.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 admin_user_archive has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def admin_user_archive(request):
                          try:
                              user = User.from_id(int(request.matchdict['user_id']))
                      
                              # Cannot archive already archived user
                      Severity: Minor
                      Found in chezbetty/views_admin.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 admin_inventory has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def admin_inventory(request):
                          items1 = DBSession.query(Item)\
                                            .filter(Item.enabled==True)\
                                            .filter(Item.in_stock!=0)\
                                            .order_by(Item.name).all()
                      Severity: Minor
                      Found in chezbetty/views_admin.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 toggle_state_success has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function toggle_state_success (data) {
                          var parent = $("#"+$(this).attr("data-parent"));
                      
                          if ($(this).hasClass('require-refresh')) {
                              location.reload();
                      Severity: Minor
                      Found in chezbetty/static/js/chezbetty-admin-onload.js - 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 admin_data_highcharts_period has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def admin_data_highcharts_period(metric, period):
                          start = get_start(0)
                          end = get_end()
                          if metric == 'items':
                              data = PurchaseLineItem.quantity_by_period(period, start=ftz(start), end=ftz(end))
                      Severity: Minor
                      Found in chezbetty/views_data.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 show_correct_purchase_button has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function show_correct_purchase_button () {
                          if ($("#purchase-complete:visible").length == 1) {
                              // If we are on the purchase complete page, show logout
                              $("#purchase-button-purchaselogout").hide();
                              $("#purchase-button-purchase").hide();
                      Severity: Minor
                      Found in chezbetty/static/js/chezbetty-terminal.js - 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 user_pool_changename_submit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def user_pool_changename_submit(request):
                          try:
                              pool = Pool.from_id(request.POST['pool-id'])
                              if pool.owner != request.user.id:
                                  request.session.flash('You do not have permission to view that pool.', 'error')
                      Severity: Minor
                      Found in chezbetty/views_user.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 from_barcode has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def from_barcode(cls, barcode):
                              box_list = DBSession.query(cls).filter(cls.barcode.ilike('%{}%'.format(barcode))).all()
                              for box in box_list:
                                  #split string into individual barcodes
                                  box_barcode_sub = box.barcode.split(';')
                      Severity: Minor
                      Found in chezbetty/models/box.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