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
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
- Read upRead up
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]
- Read upRead up
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]
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],
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?)
- Read upRead up
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
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)
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)