um-cseg/chez-betty

View on GitHub

Showing 186 of 349 total issues

Consider simplifying this complex logical expression.
Open

    if e.type != 'deposit' and e.type != 'purchase' and e.type != 'restock' \
       and e.type != 'inventory' and e.type != 'emptycashbox' \
       and e.type != 'emptysafe' \
       and e.type != 'donation' and e.type != 'withdrawal' \
       and e.type != 'reimbursement' \
Severity: Critical
Found in chezbetty/datalayer.py - About 2 hrs to fix

    Function user_dayssincepurchase_histogram has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def user_dayssincepurchase_histogram ():
        bin_size = 10 # days
        bins = {}
    
        def to_bin (x):
    Severity: Minor
    Found in chezbetty/views_data.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 admin_item_search_json has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def admin_item_search_json(request):
        try:
            boxes = Box.from_fuzzy(request.matchdict['search'])
            items = Item.from_fuzzy(request.matchdict['search'])
            box_vendors = BoxVendor.from_number_fuzzy(request.matchdict['search'])
    Severity: Minor
    Found in chezbetty/views_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 admin_item_barcode_pdf has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def admin_item_barcode_pdf(request):
        try:
            item = Item.from_id(request.matchdict['item_id'])
            fname = '/tmp/{}.pdf'.format(item.id)
    
    
    Severity: Minor
    Found in chezbetty/views_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 exists_barcode has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def exists_barcode(cls, barcode, id=None):
            #split string into individual barcodes
            barcode_list = barcode.split(';')
            for single_barcode in barcode_list:
                if single_barcode != "":
    Severity: Minor
    Found in chezbetty/models/item.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 admin_users_email_debt has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    def admin_users_email_debt(request):
        email_type = request.matchdict['type']
    
        if email_type == 'deadbeats':
            deadbeats = User.get_deadbeats()
    Severity: Minor
    Found in chezbetty/views_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 exists_barcode has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def exists_barcode(cls, barcode, id=None):
            #split string into individual barcodes
            barcode_list = barcode.split(';')
            for single_barcode in barcode_list:
                if single_barcode != "":
    Severity: Minor
    Found in chezbetty/models/box.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 terminal_deposit has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def terminal_deposit(request):
        try:
            if request.POST['umid'] == '':
                # User was not logged in when deposit was made. We store
                # this deposit temporarily and give it to the next user who
    Severity: Minor
    Found in chezbetty/views_terminal.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 search_item_only_success has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function search_item_only_success (data, context, one_item_fn) {
        alert_clear();
        $("#" + context + "-notice-item").text("");
        $("." + context + "-item-addedrows").remove();
    
    
    Severity: Minor
    Found in chezbetty/static/js/chezbetty-admin.js - 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 admin_cash_reconcile_submit has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def admin_cash_reconcile_submit(request):
        try:
    
            if request.POST['cash-box-reconcile-type'] == 'cashboxtosafe':
                if account.get_cash_account("cashbox").balance == Decimal('0'):
    Severity: Minor
    Found in chezbetty/views_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 admin_box_edit has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    def admin_box_edit(request):
        try:
            box = Box.from_id(request.matchdict['box_id'])
            items = Item.all_force()
    
    
    Severity: Minor
    Found in chezbetty/views_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 search_item_success has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
    Open

    function search_item_success (data) {
        alert_clear();
        $("#restock-search-notice").text("");
        $(".restock-search-addedrows").remove();
    
    
    Severity: Minor
    Found in chezbetty/static/js/chezbetty-admin.js - 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 calculate_total has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function calculate_total () {
        total = 0;
        $("#purchase-table tr.purchase-item").each(function (index) {
            if ($(this).attr('id') != "purchase-empty") {
                line_total = parseFloat(
    Severity: Minor
    Found in chezbetty/static/js/chezbetty-terminal.js - About 1 hr to fix

      Function limitable_all has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def limitable_all(fn_wrapped_by_limitable_all):
          @functools.wraps(fn_wrapped_by_limitable_all)
          def limitable_all_wrapper(*args, limit=None, offset=None, count=False, **kwargs):
              q = fn_wrapped_by_limitable_all(*args, **kwargs)
              if offset:
      Severity: Minor
      Found in chezbetty/models/model.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 admin_item_barcode_json has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def admin_item_barcode_json(request):
          try:
              item = Item.from_barcode(request.matchdict['barcode'])
              html = render('templates/admin/restock_row.jinja2', {'item': item, 'line': {}})
              return {'status': 'success',
      Severity: Minor
      Found in chezbetty/views_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 process_input has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      function process_input () {
          // Keep a local copy so we can clear global in case anything goes wrong.
          var keyin = keyboard_input;
          keyboard_input = '';
      
      
      Severity: Minor
      Found in chezbetty/static/js/chezbetty-terminal-keyboard.js - 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 wrapped_fn has 12 arguments (exceeds 4 allowed). Consider refactoring.
      Open

              def wrapped_fn(*args,
      Severity: Major
      Found in chezbetty/models/transaction.py - About 1 hr to fix

        Function submit_purchase has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function submit_purchase (this_btn, success_cb, error_cb) {
            purchase_alert_clear();
        
            if (this_btn != null) {
                $(this_btn).blur();
        Severity: Minor
        Found in chezbetty/static/js/chezbetty-terminal.js - About 1 hr to fix

          Function terminal_purchase has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          def terminal_purchase(request):
              try:
                  user = User.from_umid(request.POST['umid'])
          
                  ignored_keys = ['umid', 'pool_id']
          Severity: Minor
          Found in chezbetty/views_terminal.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 search_user_success has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          function search_user_success (data, prefix) {
              alert_clear();
              $("#"+prefix+"-notice").text("");
              $("."+prefix+"-addedrows").remove();
          
          
          Severity: Minor
          Found in chezbetty/static/js/chezbetty-admin.js - 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

          Severity
          Category
          Status
          Source
          Language