appfolio/ae_page_objects

View on GitHub

Showing 10 of 10 total issues

Method initialize has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(*document_classes, &block)
      @conditions = []

      if document_classes.empty?
        raise ArgumentError, "block expected" if block.nil?
Severity: Minor
Found in lib/ae_page_objects/document_query.rb - About 3 hrs 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 wait_until has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

    def wait_until(seconds_to_wait = nil, error_message = nil, &block)
      @wait_until ||= 0
      @wait_until += 1

      result = nil
Severity: Minor
Found in lib/ae_page_objects.rb - About 2 hrs 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 match? has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

      def match?(document)
        @document_conditions.each do |type, value|
          case type
          when :title then
            return false unless Capybara.current_session.driver.browser.title.include?(value)
Severity: Minor
Found in lib/ae_page_objects/document_query.rb - About 1 hr 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 scoped_node has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def scoped_node
      locator = eval_locator(@locator)

      return parent.node if locator.empty?

Severity: Minor
Found in lib/ae_page_objects/element.rb - About 1 hr 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 wait_until has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def wait_until(seconds_to_wait = nil, error_message = nil, &block)
      @wait_until ||= 0
      @wait_until += 1

      result = nil
Severity: Minor
Found in lib/ae_page_objects.rb - About 1 hr to fix

    Method visit has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

          def visit(*args)
            args = args.dup
            inner_options = args.last.is_a?(::Hash)? args.last : {}
    
            path = inner_options.delete(:via) || paths.first
    Severity: Minor
    Found in lib/ae_page_objects/document.rb - About 1 hr 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 load_document_with_condition has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def load_document_with_condition(condition)
            # Look in the current window first unless told not to
            unless condition.document_conditions[:ignore_current]
              @original_window.switch_to
    
    
    Severity: Minor
    Found in lib/ae_page_objects/multiple_windows/cross_window_loader_strategy.rb - About 55 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 method_missing has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def method_missing(name, *args, **kwargs, &block)
          if name == :class
            return @element_class
          end
    
    
    Severity: Minor
    Found in lib/ae_page_objects/element_proxy.rb - About 45 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 collection has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def collection(name, options = {}, &block)
          options ||= {}
    
          # only a collection class is specified or the item class
          # specified matches the collection's item class
    Severity: Minor
    Found in lib/ae_page_objects/core/dsl.rb - About 45 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 current has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.current
            # Accessing browser.window_handle tries to find an existing page, which will blow up
            # if there isn't one. So... we look at the collection first as a guard.
            if all.empty?
              nil
    Severity: Minor
    Found in lib/ae_page_objects/multiple_windows/window_handle_manager.rb - About 35 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