jcottobboni/inventorymaster

View on GitHub

Showing 9 of 17 total issues

Function addFields has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    addFields: function(e) {
      // Setup
      var link      = e.currentTarget;
      var assoc     = $(link).data('association');                // Name of child
      var blueprint = $('#' + $(link).data('blueprint-id'));
Severity: Minor
Found in public/javascripts/nested_form.js - About 1 hr to fix

    Method out_stock_list has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def out_stock_list
            if params[:location].blank? and params[:area].blank? and params[:manufacturer].blank?
            @products = Product.where(' ammount = 0')
          elsif params[:location].blank? and params[:area].blank?
            @products = Product.where(' ammount = 0 and manufacturer_id=?',params[:manufacturer])
    Severity: Minor
    Found in app/controllers/inventorymaster/reports_controller.rb - About 1 hr to fix

      Method low_stock_list has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def low_stock_list
              if params[:location].blank? and params[:area].blank? and params[:manufacturer].blank?
              @products = Product.where(' ammount <= minimum_stock_count')
            elsif params[:location].blank? and params[:area].blank?
              @products = Product.where(' ammount <= minimum_stock_count and manufacturer_id=?',params[:manufacturer])
      Severity: Minor
      Found in app/controllers/inventorymaster/reports_controller.rb - About 1 hr to fix

        Method create has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def create
              @transaction = Transaction.new(transaction_params)
              @product = Product.find(@transaction.product_id)
        
              if @transaction.kind =="Entrada" && @product.ammount!= nil
        Severity: Minor
        Found in app/controllers/inventorymaster/transactions_controller.rb - 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

        Method current_stock_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def current_stock_list
               if params[:location].blank? and params[:area].blank? and params[:manufacturer].blank?
                @products = Product.all
              elsif params[:location].blank? and params[:area].blank?
                @products = Product.where(:manufacturer_id=>params[:manufacturer])
        Severity: Minor
        Found in app/controllers/inventorymaster/reports_controller.rb - 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

        Method average_cost has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

             def average_cost(unit_cost,ammount)
                        if unit_cost == nil
                            if @cost || @average ==0
                                return 0
                            else
        Severity: Minor
        Found in app/helpers/inventorymaster/products_helper.rb - 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

        Method low_stock_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def low_stock_list
                if params[:location].blank? and params[:area].blank? and params[:manufacturer].blank?
                @products = Product.where(' ammount <= minimum_stock_count')
              elsif params[:location].blank? and params[:area].blank?
                @products = Product.where(' ammount <= minimum_stock_count and manufacturer_id=?',params[:manufacturer])
        Severity: Minor
        Found in app/controllers/inventorymaster/reports_controller.rb - 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

        Method average_cost has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

             def average_cost(unit_cost,ammount)
                        if unit_cost == nil
                            if @cost || @average ==0
                                return 0
                            else
        Severity: Minor
        Found in app/helpers/inventorymaster/reports_helper.rb - 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

        Method out_stock_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def out_stock_list
                if params[:location].blank? and params[:area].blank? and params[:manufacturer].blank?
                @products = Product.where(' ammount = 0')
              elsif params[:location].blank? and params[:area].blank?
                @products = Product.where(' ammount = 0 and manufacturer_id=?',params[:manufacturer])
        Severity: Minor
        Found in app/controllers/inventorymaster/reports_controller.rb - 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