thoughtbot/capybara-webkit

View on GitHub

Showing 25 of 29 total issues

Class Browser has 73 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Browser
    def initialize(connection)
      @connection = connection
      apply_defaults
    end
Severity: Major
Found in lib/capybara/webkit/browser.rb - About 1 day to fix

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

      class Driver < Capybara::Driver::Base
        def initialize(app, options={})
          @app = app
          @options = options.dup
          @options[:server] ||= Server.new(options)
    Severity: Major
    Found in lib/capybara/webkit/driver.rb - About 1 day to fix

      File capybara.js has 477 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      Capybara = {
        nextIndex: 0,
        nodes: {},
        attachedFiles: [],
        keyModifiersStack: [],
      Severity: Minor
      Found in src/capybara.js - About 7 hrs to fix

        `` has 51 functions (exceeds 20 allowed). Consider refactoring.
        Open

        Capybara = {
          nextIndex: 0,
          nodes: {},
          attachedFiles: [],
          keyModifiersStack: [],
        Severity: Major
        Found in src/capybara.js - About 7 hrs to fix

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

          require "capybara"
          require "capybara/webkit/version"
          require "capybara/webkit/node"
          require "capybara/webkit/connection"
          require "capybara/webkit/browser"
          Severity: Minor
          Found in lib/capybara/webkit/driver.rb - About 5 hrs to fix

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

              class Node < Capybara::Driver::Node
                def initialize(driver, base, browser)
                  super(driver, base)
                  @browser = browser
                end
            Severity: Minor
            Found in lib/capybara/webkit/node.rb - About 4 hrs to fix

              File browser.rb has 291 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require "json"
              require "capybara/webkit/errors"
              
              module Capybara::Webkit
                class Browser
              Severity: Minor
              Found in lib/capybara/webkit/browser.rb - About 3 hrs to fix

                Function set has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                  set: function (index, value) {
                    var length, maxLength, node, strindex, textTypes, type;
                
                    node = this.getNode(index);
                    type = (node.type || node.tagName).toLowerCase();
                Severity: Minor
                Found in src/capybara.js - 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

                Function getXPathNode has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                  getXPathNode: function(node, path) {
                    path = path || [];
                    if (node.parentNode) {
                      path = this.getXPathNode(node.parentNode, path);
                    }
                Severity: Minor
                Found in src/capybara.js - 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

                Function wrapResult has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  wrapResult: function(arg) {
                    if (this._visitedObjects.indexOf(arg) >= 0) { return '(cyclic structure)'; }
                    if (arg instanceof NodeList) { arg = Array.prototype.slice.call(arg, 0); }
                    if (Array.isArray(arg)) {
                      for(var _j = 0; _j < arg.length; _j++) {
                Severity: Minor
                Found in src/capybara.js - 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

                Function _sendKeys has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                  _sendKeys: function(keys) {
                    if (typeof keys == "string") {
                      var str_len = keys.length;
                      var str_idx;
                      for (str_idx = 0; str_idx < str_len; str_idx++) {
                Severity: Minor
                Found in src/capybara.js - 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 convert_to_named_keys has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def convert_to_named_keys(key)
                      if key.is_a? Array
                        key.map { |k| convert_to_named_keys(k)}
                      else
                        case key
                Severity: Minor
                Found in lib/capybara/webkit/node.rb - About 1 hr to fix

                  Function set has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    set: function (index, value) {
                      var length, maxLength, node, strindex, textTypes, type;
                  
                      node = this.getNode(index);
                      type = (node.type || node.tagName).toLowerCase();
                  Severity: Minor
                  Found in src/capybara.js - About 1 hr to fix

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

                          def kill_process
                            if @pid
                              if RUBY_PLATFORM =~ /mingw32/
                                Process.kill(9, @pid)
                              else
                    Severity: Minor
                    Found in lib/capybara/webkit/server.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

                    Function clickPosition has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                    Open

                      clickPosition: function(node) {
                        if(node.namespaceURI == 'http://www.w3.org/2000/svg') {
                          var rect = node.getBoundingClientRect();
                    
                          if (rect.width > 0 && rect.height > 0)
                    Severity: Minor
                    Found in src/capybara.js - 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 [] has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def [](name)
                          name = name.to_s
                          tn = tag_name
                          if (tn == "img" && name == "src") || (tn == "a" && name == "href")
                            # Although the attribute matters, the property is consistent. Return that in
                    Severity: Minor
                    Found in lib/capybara/webkit/node.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 switch_to_frame has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def switch_to_frame(frame)
                          case frame
                          when :top
                            begin
                              loop { @browser.frame_focus }
                    Severity: Minor
                    Found in lib/capybara/webkit/driver.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

                    Method apply_options has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def apply_options
                          if @options[:debug]
                            @browser.enable_logging
                          end
                    
                    
                    Severity: Minor
                    Found in lib/capybara/webkit/driver.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

                    Avoid too many return statements within this function.
                    Open

                          return result;
                    Severity: Major
                    Found in src/capybara.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return arg;
                      Severity: Major
                      Found in src/capybara.js - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language