Showing 24 of 35 total issues
Class Session
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class Session
extend Forwardable
include Logging
include SaveAndOpenPage
File field.rb
has 332 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "cgi"
require "digest/md5"
require "webrat/core_extensions/blank"
require "webrat/core_extensions/nil_to_query_string"
Class SeleniumSession
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class SeleniumSession
include Webrat::SaveAndOpenPage
include Webrat::Selenium::SilenceStream
def initialize(*args) # :nodoc:
Class Scope
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Scope
include Logging
include Locators
def self.from_page(session, response, response_body) #:nodoc:
Class Field
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Field < Element #:nodoc:
attr_reader :value
def self.xpath_search
".//button|.//input|.//textarea|.//select"
Method replace_param_value
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.replace_param_value(params, oval, nval)
output = Hash.new
params.each do |key, value|
case value
when Hash
- 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 wait_for
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def wait_for(params={})
timeout = params[:timeout] || 5
message = params[:message] || "Timeout exceeded"
begin_time = 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"
Further reading
Method adapter_class
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.adapter_class
case Webrat.configuration.mode
when :rails
RailsAdapter
when :merb
Method locate
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def locate
if @id_or_name_or_label
field = FieldLocator.new(@session, @dom, @id_or_name_or_label, SelectField, MultipleSelectField).locate!
field.options.detect do |o|
- 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 app_server_instance
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.app_server_instance
case Webrat.configuration.application_framework
when :sinatra
require "webrat/selenium/application_servers/sinatra"
return Webrat::Selenium::ApplicationServers::Sinatra.new
Method build_query_string
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def build_query_string(escape_value=true)
if @value.is_a?(Array)
@value.collect {|value| "#{name}=#{ escape_value ? escape(value) : value }" }.join("&")
else
"#{name}=#{ escape_value ? escape(value) : value }"
- 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 label_elements
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def label_elements
return @label_elements unless @label_elements.nil?
@label_elements = []
parent = @element.parent
- 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 request_page
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def request_page(url, http_method, data) #:nodoc:
h = headers
h['HTTP_REFERER'] = @current_url if @current_url
debug_log "REQUESTING PAGE: #{http_method.to_s.upcase} #{url} with #{data.inspect} and HTTP headers #{h.inspect}"
- 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 document
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.document(stringlike) #:nodoc:
return stringlike.dom if stringlike.respond_to?(:dom)
case stringlike
when Nokogiri::HTML::Document, Nokogiri::XML::NodeSet
- 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 select_date
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def select_date(date_to_select, options ={})
date = date_to_select.is_a?(Date) || date_to_select.is_a?(Time) ?
date_to_select : Date.parse(date_to_select)
id_prefix = locate_id_prefix(options) do
- 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 Webrat::Selenium::ApplicationServers::External.new
Method unescape_params
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def self.unescape_params(params)
case params.class.name
when 'Hash', 'Mash'
params.each { |key,value| params[key] = unescape_params(value) }
params
- 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 matches_id?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def matches_id?(link)
if @value.is_a?(Regexp)
link["id"] =~ @value ? true : false
else
link["id"] == @value ? true : 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 normalize_url
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def normalize_url(href) #:nodoc:
uri = URI.parse(href)
normalized_url = []
normalized_url << "#{uri.scheme}://" if uri.scheme
normalized_url << uri.host if uri.host
- 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 click
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def click(options = {})
method = options[:method] || http_method
return if href =~ /^#/ && method == :get
options[:javascript] = true if options[:javascript].nil?
- 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"