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
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)
File capybara.js
has 477 lines of code (exceeds 250 allowed). Consider refactoring. Open
Capybara = {
nextIndex: 0,
nodes: {},
attachedFiles: [],
keyModifiersStack: [],
`` has 51 functions (exceeds 20 allowed). Consider refactoring. Open
Capybara = {
nextIndex: 0,
nodes: {},
attachedFiles: [],
keyModifiersStack: [],
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"
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
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
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();
- 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
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);
}
- 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
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++) {
- 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
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++) {
- 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 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
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();
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
- 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
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)
- 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 []
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
- 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 apply_options
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def apply_options
if @options[:debug]
@browser.enable_logging
end
- 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 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 }
- 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 function. Open
return arg;
Avoid too many return
statements within this function. Open
return result;