jnicklas/capybara

View on GitHub

Showing 88 of 88 total issues

Class Session has 55 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Session
    include Capybara::SessionMatchers

    NODE_METHODS = %i[
      all first attach_file text check choose
Severity: Major
Found in lib/capybara/session.rb - About 7 hrs to fix

    Class Driver has 50 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Capybara::Selenium::Driver < Capybara::Driver::Base
      DEFAULT_OPTIONS = {
        browser: :firefox,
        clear_local_storage: false,
        clear_session_storage: false
    Severity: Minor
    Found in lib/capybara/selenium/driver.rb - About 7 hrs to fix

      File session.rb has 424 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'capybara/session/matchers'
      require 'addressable/uri'
      
      module Capybara
        ##
      Severity: Minor
      Found in lib/capybara/session.rb - About 6 hrs to fix

        File selector.rb has 399 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'capybara/selector/selector'
        Capybara::Selector::FilterSet.add(:_field) do
          node_filter(:checked, :boolean) { |node, value| !(value ^ node.checked?) }
          node_filter(:unchecked, :boolean) { |node, value| (value ^ node.checked?) }
          node_filter(:disabled, :boolean, default: false, skip_if: :all) { |node, value| !(value ^ node.disabled?) }
        Severity: Minor
        Found in lib/capybara/selector.rb - About 5 hrs to fix

          Class Node has 40 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Capybara::Selenium::Node < Capybara::Driver::Node
            def visible_text
              native.text
            end
          
          
          Severity: Minor
          Found in lib/capybara/selenium/node.rb - About 5 hrs to fix

            Class Node has 39 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Capybara::RackTest::Node < Capybara::Driver::Node
              BLOCK_ELEMENTS = %w[p h1 h2 h3 h4 h5 h6 ol ul pre address blockquote dl div fieldset form hr noscript table].freeze
            
              def all_text
                native.text
            Severity: Minor
            Found in lib/capybara/rack_test/node.rb - About 5 hrs to fix

              Class Base has 34 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Capybara::Driver::Base
                attr_writer :session
              
                def current_url
                  raise NotImplementedError
              Severity: Minor
              Found in lib/capybara/driver/base.rb - About 4 hrs to fix

                Class SelectorQuery has 32 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class SelectorQuery < Queries::BaseQuery
                      attr_accessor :selector, :locator, :options, :expression, :find, :negative
                
                      VALID_KEYS = COUNT_KEYS + %i[text id class visible exact exact_text match wait filter_set]
                      VALID_MATCH = %i[first smart prefer_exact one].freeze
                Severity: Minor
                Found in lib/capybara/queries/selector_query.rb - About 4 hrs to fix

                  Class Element has 30 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                      class Element < Base
                        def initialize(session, base, query_scope, query)
                          super(session, base)
                          @query_scope = query_scope
                          @query = query
                  Severity: Minor
                  Found in lib/capybara/node/element.rb - About 3 hrs to fix

                    File driver.rb has 313 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'uri'
                    require 'English'
                    
                    class Capybara::Selenium::Driver < Capybara::Driver::Base
                      DEFAULT_OPTIONS = {
                    Severity: Minor
                    Found in lib/capybara/selenium/driver.rb - About 3 hrs to fix

                      Class Node has 26 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class Node
                            attr_reader :driver, :native
                      
                            def initialize(driver, native)
                              @driver = driver
                      Severity: Minor
                      Found in lib/capybara/driver/node.rb - About 3 hrs to fix

                        Method compare_count has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def compare_count
                              # Only check filters for as many elements as necessary to determine result
                              if @query.options[:count]
                                count_opt = Integer(@query.options[:count])
                                loop do
                        Severity: Minor
                        Found in lib/capybara/result.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

                        File matchers.rb has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        require 'capybara/rspec/compound'
                        
                        module Capybara
                          module RSpecMatchers
                            class Matcher
                        Severity: Minor
                        Found in lib/capybara/rspec/matchers.rb - About 2 hrs to fix

                          Method reset! has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                          Open

                            def reset!
                              # Use instance variable directly so we avoid starting the browser just to reset the session
                              return unless @browser
                          
                              navigated = false
                          Severity: Minor
                          Found in lib/capybara/selenium/driver.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

                          Class Driver has 24 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Capybara::RackTest::Driver < Capybara::Driver::Base
                            DEFAULT_OPTIONS = {
                              respect_data_method: false,
                              follow_redirects: true,
                              redirect_limit: 5
                          Severity: Minor
                          Found in lib/capybara/rack_test/driver.rb - About 2 hrs to fix

                            Method synchronize has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def synchronize(seconds = session_options.default_max_wait_time, errors: nil)
                                    if session.synchronized
                                      yield
                                    else
                                      session.synchronized = true
                            Severity: Minor
                            Found in lib/capybara/node/base.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 matches_filters? has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                  def matches_filters?(node)
                                    return false if options[:text] && !matches_text_filter(node, options[:text])
                                    return false if exact_text.is_a?(String) && !matches_exact_text_filter(node, exact_text)
                            
                                    case visible
                            Severity: Minor
                            Found in lib/capybara/queries/selector_query.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

                            File node.rb has 264 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            class Capybara::Selenium::Node < Capybara::Driver::Node
                              def visible_text
                                native.text
                              end
                            
                            
                            Severity: Minor
                            Found in lib/capybara/selenium/node.rb - About 2 hrs to fix

                              Method process has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                              Open

                                def process(method, path, attributes = {}, env = {})
                                  new_uri = URI.parse(path)
                                  method.downcase! unless method.is_a? Symbol
                                  if path.empty?
                                    new_uri.path = request_path
                              Severity: Minor
                              Found in lib/capybara/rack_test/browser.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

                              Class Selector has 21 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                                class Selector
                                  attr_reader :name, :format
                                  extend Forwardable
                              
                                  class << self
                              Severity: Minor
                              Found in lib/capybara/selector/selector.rb - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language