MiraitSystems/enju_trunk

View on GitHub
app/controllers/export_item_lists_controller.rb

Summary

Maintainability
D
2 days
Test Coverage

Method construct_list_query has 99 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def construct_list_query(list_type, library_ids, carrier_type_ids, bookstore_ids, ndcs, acquired_at, apply_order)
    scope = Item.scoped

    ti = Item.arel_table
    tc = Checkout.arel_table
Severity: Major
Found in app/controllers/export_item_lists_controller.rb - About 3 hrs to fix

    Method get_list_size has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_list_size
        unless request.xhr? && params[:list_type].present?
          render :nothing => true, :status => :not_found
          return
        end
    Severity: Minor
    Found in app/controllers/export_item_lists_controller.rb - About 2 hrs 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 create has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

      def create
        # check checked
        @selected_list_type = params[:export_item_list][:list_type]
        @selected_library = params[:library].map(&:to_i) if params[:library]
        @selected_carrier_type = params[:carrier_type].map(&:to_i) if params[:carrier_type]
    Severity: Minor
    Found in app/controllers/export_item_lists_controller.rb - About 2 hrs 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 create has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def create
        # check checked
        @selected_list_type = params[:export_item_list][:list_type]
        @selected_library = params[:library].map(&:to_i) if params[:library]
        @selected_carrier_type = params[:carrier_type].map(&:to_i) if params[:carrier_type]
    Severity: Major
    Found in app/controllers/export_item_lists_controller.rb - About 2 hrs to fix

      File export_item_lists_controller.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class ExportItemListsController < ApplicationController
        before_filter :check_librarian
      
        def initialize
          @list_types = [[t('item_list.shelf_list'),1],
      Severity: Minor
      Found in app/controllers/export_item_lists_controller.rb - About 2 hrs to fix

        Method parse_list_params has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

          def parse_list_params(library_ids, carrier_type_ids, bookstore_ids, ndcs, acquired_at, deny_blank_bookstore_ids = true)
            error = []
        
            # check required params
            error << t('item_list.no_list_condition') if library_ids.blank? || carrier_type_ids.blank? || (deny_blank_bookstore_ids && bookstore_ids.blank?)
        Severity: Minor
        Found in app/controllers/export_item_lists_controller.rb - About 2 hrs 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 get_list_size has 39 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def get_list_size
            unless request.xhr? && params[:list_type].present?
              render :nothing => true, :status => :not_found
              return
            end
        Severity: Minor
        Found in app/controllers/export_item_lists_controller.rb - About 1 hr to fix

          Method construct_list_query has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            def construct_list_query(list_type, library_ids, carrier_type_ids, bookstore_ids, ndcs, acquired_at, apply_order)
          Severity: Major
          Found in app/controllers/export_item_lists_controller.rb - About 50 mins to fix

            Method parse_list_params has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def parse_list_params(library_ids, carrier_type_ids, bookstore_ids, ndcs, acquired_at, deny_blank_bookstore_ids = true)
            Severity: Minor
            Found in app/controllers/export_item_lists_controller.rb - About 45 mins to fix

              There are no issues that match your filters.

              Category
              Status