brynary/webrat

View on GitHub

Showing 24 of 35 total issues

Method select_time has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def select_time(time_to_select, options ={})
      time = time_to_select.is_a?(Time) ? time_to_select : Time.parse(time_to_select)

      id_prefix = locate_id_prefix(options) do
        hour_field = FieldByIdLocator.new(@session, dom, /(.*?)_#{DATE_TIME_SUFFIXES[:hour]}$/).locate
Severity: Minor
Found in lib/webrat/core/scope.rb - About 25 mins 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 field_class has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.field_class(element)
      case element.name
      when "button"   then ButtonField
      when "select"
        if element.attributes["multiple"].nil?
Severity: Minor
Found in lib/webrat/core/elements/field.rb - About 25 mins 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 locate_id_prefix has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def locate_id_prefix(options, &location_strategy) #:nodoc:
      return options[:id_prefix] if options[:id_prefix]

      if options[:from]
        if (label = LabelLocator.new(@session, dom, options[:from]).locate)
Severity: Minor
Found in lib/webrat/core/scope.rb - About 25 mins 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 link_element has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def link_element
        matching_links.min { |a, b|
          a_score = a.inner_text =~ matcher ? a.inner_text.length : 100
          b_score = b.inner_text =~ matcher ? b.inner_text.length : 100
          a_score <=> b_score
Severity: Minor
Found in lib/webrat/core/locators/link_locator.rb - About 25 mins 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

Severity
Category
Status
Source
Language