Showing 25 of 25 total issues
Method filter
has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring. Open
def filter(controller)
raise "Cannot use the CASClient filter because it has not yet been configured." if config.nil?
if @@fake_user
controller.session[client.username_session_key] = @@fake_user
- 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 filter
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filter(controller)
raise "Cannot use the CASClient filter because it has not yet been configured." if config.nil?
if @@fake_user
controller.session[client.username_session_key] = @@fake_user
Method parse
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def parse(raw_text, options)
raise BadResponseException,
"CAS response is empty/blank." if raw_text.to_s.empty?
@parse_datetime = Time.now
if raw_text =~ /^(yes|no)\n(.*?)\n$/m
- 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 logout_url
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def logout_url(destination_url = nil, follow_url = nil, service_url = nil)
url = @logout_url || (cas_base_url + "/logout")
uri = URI.parse(url)
service_url = (service_url if service_url) || @service_url
h = uri.query ? query_to_hash(uri.query) : {}
- 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 parse
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse(raw_text, options)
raise BadResponseException,
"CAS response is empty/blank." if raw_text.to_s.empty?
@parse_datetime = Time.now
if raw_text =~ /^(yes|no)\n(.*?)\n$/m
Method configure
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def configure(conf)
#TODO: raise error if conf contains unrecognized cas options (this would help detect user typos in the config)
raise ArgumentError, "Missing :cas_base_url parameter!" unless conf[:cas_base_url]
- 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 parse_extra_attribute_value
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def parse_extra_attribute_value(value, encode_extra_attributes_as)
attr_value = if value.to_s.empty?
nil
elsif !encode_extra_attributes_as
begin
- 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 configure
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def configure(conf)
#TODO: raise error if conf contains unrecognized cas options (this would help detect user typos in the config)
raise ArgumentError, "Missing :cas_base_url parameter!" unless conf[:cas_base_url]
Method unauthorized!
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def unauthorized!(controller, vr = nil)
format = nil
unless controller.request.format.nil?
format = controller.request.format.to_sym
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 parse_http_response
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def parse_http_response(http_response)
header = http_response.to_hash
# FIXME: this regexp might be incorrect...
if header['set-cookie'] &&
- 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 parse_extra_attribute_value
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_extra_attribute_value(value, encode_extra_attributes_as)
attr_value = if value.to_s.empty?
nil
elsif !encode_extra_attributes_as
begin
Method redirect_to_cas_for_authentication
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def redirect_to_cas_for_authentication(controller)
redirect_url = login_url(controller)
if use_gatewaying?
controller.session[:cas_sent_to_gateway] = true
- 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
Avoid deeply nested control flow statements. Open
if pgt
log.debug("Got PGT #{pgt.ticket.inspect} for PGT IOU #{pgt.iou.inspect}. This will be stored in the session.")
controller.session[:cas_pgt] = pgt
# For backwards compatibility with RubyCAS-Client 1.x configurations...
controller.session[:casfilterpgt] = pgt
Method hash_to_query
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def hash_to_query(hash)
pairs = []
hash.each do |k, vals|
vals = [vals] unless vals.kind_of? Array
vals.each {|v| pairs << (v.nil? ? CGI.escape(k) : "#{CGI.escape(k)}=#{CGI.escape(v)}")}
- 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
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return true
Avoid too many return
statements within this method. Open
return false
Avoid too many return
statements within this method. Open
return true
Avoid too many return
statements within this method. Open
return false
Method parse
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse(raw_text)
raise BadResponseException,
"CAS response is empty/blank." if raw_text.to_s.empty?
@parse_datetime = Time.now
- 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"