File index.js
has 370 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Future from 'fibers/future'
import assign from 'object.assign'
const Fiber = require('fibers') // ToDo fix unit test to work with imports
Function wrapCommand
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
const wrapCommand = function (fn, commandName, beforeCommand, afterCommand) {
if (isAsync()) {
/**
* async command wrap
*/
- 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 wrapCommand
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
const wrapCommand = function (fn, commandName, beforeCommand, afterCommand) {
if (isAsync()) {
/**
* async command wrap
*/
Function wrapCommands
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
const wrapCommands = function (instance, beforeCommand, afterCommand) {
const addCommand = instance.addCommand
/**
* if instance is a multibrowser instance make sure to wrap commands
Function addCommand
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
instance.addCommand = function (fnName, fn, forceOverwrite) {
let commandGroup = instance.getPrototype()
let commandName = fnName
let namespace
Function applyPrototype
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
const applyPrototype = function (result, helperScope) {
/**
* don't overload result for none objects, arrays and buffer
*/
if (!result || typeof result !== 'object' || (Array.isArray(result) && !isElements(result) && !(is$$(result))) || Buffer.isBuffer(result)) {
Function applyPrototype
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const applyPrototype = function (result, helperScope) {
/**
* don't overload result for none objects, arrays and buffer
*/
if (!result || typeof result !== 'object' || (Array.isArray(result) && !isElements(result) && !(is$$(result))) || Buffer.isBuffer(result)) {
- 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 wrapTestFunction
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const wrapTestFunction = function (fnName, origFn, testInterfaceFnNames, before, after) {
return function (...specArguments) {
/**
* Variadic arguments:
* [title, fn], [title], [fn]
- 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 wrapCommands
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
const wrapCommands = function (instance, beforeCommand, afterCommand) {
const addCommand = instance.addCommand
/**
* if instance is a multibrowser instance make sure to wrap commands
- 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 executeHooksWithArgs
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
const executeHooksWithArgs = (hooks = [], args) => {
/**
* make sure hooks are an array of functions
*/
if (typeof hooks === 'function') {
Consider simplifying this complex logical expression. Open
if (!result || typeof result !== 'object' || (Array.isArray(result) && !isElements(result) && !(is$$(result))) || Buffer.isBuffer(result)) {
return result
}
Function runHook
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const runHook = function (hookFn, origFn, before, after, repeatTest = 0) {
Function wrapTestFunction
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const wrapTestFunction = function (fnName, origFn, testInterfaceFnNames, before, after) {
Function runInFiberContext
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
const runInFiberContext = function (testInterfaceFnNames, before, after, fnName, scope = global) {
Function executeAsync
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const executeAsync = function (fn, repeatTest = 0, args = []) {
let result, error
/**
* if a new hook gets executed we can assume that all commands should have finised
- 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 future.wait()
Avoid too many return
statements within this function. Open
return fn.apply(this, commandArgs)