webdriverio/wdio-sync

View on GitHub

Showing 17 of 17 total issues

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

Severity: Minor
Found in index.js - About 4 hrs to fix

    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
             */
    Severity: Minor
    Found in index.js - 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

    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
             */
    Severity: Major
    Found in index.js - About 2 hrs to fix

      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
      Severity: Major
      Found in index.js - About 2 hrs to fix

        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
        
        
        Severity: Minor
        Found in index.js - About 1 hr to fix

          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)) {
          Severity: Minor
          Found in index.js - About 1 hr to fix

            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)) {
            Severity: Minor
            Found in index.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 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]
            Severity: Minor
            Found in index.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 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
            Severity: Minor
            Found in index.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 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') {
            Severity: Minor
            Found in index.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                  if (!result || typeof result !== 'object' || (Array.isArray(result) && !isElements(result) && !(is$$(result))) || Buffer.isBuffer(result)) {
                      return result
                  }
              Severity: Major
              Found in index.js - About 40 mins to fix

                Function runHook has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                const runHook = function (hookFn, origFn, before, after, repeatTest = 0) {
                Severity: Minor
                Found in index.js - About 35 mins to fix

                  Function wrapTestFunction has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  const wrapTestFunction = function (fnName, origFn, testInterfaceFnNames, before, after) {
                  Severity: Minor
                  Found in index.js - About 35 mins to fix

                    Function runInFiberContext has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    const runInFiberContext = function (testInterfaceFnNames, before, after, fnName, scope = global) {
                    Severity: Minor
                    Found in index.js - About 35 mins to fix

                      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
                      Severity: Minor
                      Found in index.js - 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 future.wait()
                      Severity: Major
                      Found in index.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return fn.apply(this, commandArgs)
                        Severity: Major
                        Found in index.js - About 30 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language