Showing 6 of 8 total issues
Method build_request
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def build_request path, opts
raise "path must be a string or symbol, not #{path.inspect}" unless [String,Symbol].include?(path.class)
path = path.to_s
opts[:proxy] = proxy unless proxy.nil?
opts[:method] ||= :get
- 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 initialize
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def initialize connection, options = {}
@proxy = @uri = nil
@connection = connection
unless false === options[:url]
url = options[:url] ? options[:url].dup : 'http://localhost/cgi-bin/koha/rest.pl/'
- 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 build_user_path
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def build_user_path koha_method, opts= {}
raise ArgumentError unless ( opts[:borrowernumber] or opts[:borrowername] ) #we have to be passed either a name or number
borrowernumber, borrowername = opts.delete(:borrowernumber), opts.delete(:borrowername)
biblionumber, itemnumber = opts.delete(:biblionumber), opts.delete(:itemnumber)
prefix = opts.delete(:prefix)
- 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 is_holdable?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def is_holdable?(koha_type, identifier, opts = {} )
opts ||= {}
opts[:evaluate] = :is_holdable unless opts[:evaluate] == false
holdable = opts[:holdable] ? opts[:holdable] : "holdable"
koha_type = koha_type.to_s == "item" ? "item" : "biblio"
- 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 to_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def to_params(params, escape = true)
mapped = params.map do |k, v|
next if v.to_s.empty?
if v.class == Array
build_param k, v.join("+"), false
- 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 process_response
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_response request, response
raise "The response does not have the correct keys => :body, :headers, :status" unless
%W(body headers status) == response.keys.map{|k|k.to_s}.sort
raise Koha::Error::Http.new request, response unless [200,302].include? response[:status]
result = request[:evaluate] ? evaluate_json_response( response, request[:evaluate]) : response[:body]
- 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"