karma-runner/karma

View on GitHub

Showing 258 of 258 total issues

Function stringify has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
Open

function stringify (obj, depth) {
  if (depth === 0) {
    return '...'
  }

Severity: Minor
Found in common/stringify.js - About 7 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 parseConfig has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
Open

function parseConfig (configFilePath, cliOptions, parseOptions) {
  const promiseConfig = parseOptions && parseOptions.promiseConfig === true
  const throwErrors = parseOptions && parseOptions.throwErrors === true
  const shouldSetupLoggerEarly = promiseConfig
  if (shouldSetupLoggerEarly) {
Severity: Minor
Found in lib/config.js - About 7 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 8 has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

},{}],8:[function(require,module,exports){

/**
 * Module dependencies.
 */
Severity: Minor
Found in static/karma.js - About 6 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 6 has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

},{}],6:[function(require,module,exports){

/**
 * Module dependencies.
 */
Severity: Minor
Found in static/context.js - About 6 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 _start has 164 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  async _start (config, launcher, preprocess, fileList, capturedBrowsers, executor, done) {
    if (config.detached) {
      this._detach(config, done)
      return
    }
Severity: Major
Found in lib/server.js - About 6 hrs to fix

    Function 3 has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

    },{}],3:[function(require,module,exports){
    // Load our dependencies
    var stringify = require('../common/stringify')
    
    // Define our context Karma constructor
    Severity: Minor
    Found in static/context.js - About 5 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 config.js has 407 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    'use strict'
    
    const path = require('path')
    const assert = require('assert')
    
    
    Severity: Minor
    Found in lib/config.js - About 5 hrs to fix

      Function BaseReporter has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
      Open

      const BaseReporter = function (formatError, reportSlow, useColors, browserConsoleLogOptions, adapter) {
        this.adapters = [adapter || process.stdout.write.bind(process.stdout)]
      
        this.USE_COLORS = false
        this.EXCLUSIVELY_USE_COLORS = undefined
      Severity: Minor
      Found in lib/reporters/base.js - About 5 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 server.js has 395 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      'use strict'
      
      const SocketIO = require('socket.io')
      const di = require('di')
      const util = require('util')
      Severity: Minor
      Found in lib/server.js - About 5 hrs to fix

        Function createKarmaMiddleware has 137 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function createKarmaMiddleware (
          filesPromise,
          serveStaticFile,
          serveFile,
          injector,
        Severity: Major
        Found in lib/middleware/karma.js - About 5 hrs to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            if (cliOptionsOrConfig instanceof cfg.Config) {
              config = cliOptionsOrConfig
            } else {
              logger.setupFromConfig({
                colors: cliOptionsOrConfig.colors,
          Severity: Major
          Found in lib/runner.js and 1 other location - About 5 hrs to fix
          lib/stopper.js on lines 13..40

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 142.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

            if (cliOptionsOrConfig instanceof cfg.Config) {
              config = cliOptionsOrConfig
            } else {
              logger.setupFromConfig({
                colors: cliOptionsOrConfig.colors,
          Severity: Major
          Found in lib/stopper.js and 1 other location - About 5 hrs to fix
          lib/runner.js on lines 41..68

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 142.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function 8 has 127 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          },{}],8:[function(require,module,exports){
          
          /**
           * Module dependencies.
           */
          Severity: Major
          Found in static/karma.js - About 5 hrs to fix

            Function 6 has 127 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            },{}],6:[function(require,module,exports){
            
            /**
             * Module dependencies.
             */
            Severity: Major
            Found in static/context.js - About 5 hrs to fix

              Function normalizeConfig has 125 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function normalizeConfig (config, configFilePath) {
                function basePathResolve (relativePath) {
                  if (helper.isUrlAbsolute(relativePath)) {
                    return relativePath
                  } else if (helper.isDefined(config.basePath) && helper.isDefined(relativePath)) {
              Severity: Major
              Found in lib/config.js - About 5 hrs to fix

                Function normalizeConfig has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                function normalizeConfig (config, configFilePath) {
                  function basePathResolve (relativePath) {
                    if (helper.isUrlAbsolute(relativePath)) {
                      return relativePath
                    } else if (helper.isDefined(config.basePath) && helper.isDefined(relativePath)) {
                Severity: Minor
                Found in lib/config.js - About 4 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 processArgs has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                Open

                function processArgs (argv, options, fs, path) {
                  Object.getOwnPropertyNames(argv).forEach(function (name) {
                    let argumentValue = argv[name]
                    if (name !== '_' && name !== '$0') {
                      if (Array.isArray(argumentValue)) {
                Severity: Minor
                Found in lib/cli.js - About 4 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 ProcessLauncher has 120 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function ProcessLauncher (spawn, tempDir, timer, processKillTimeout) {
                  const self = this
                  let onExitCallback
                  const killTimeout = processKillTimeout || 2000
                  // Will hold output from the spawned child process
                Severity: Major
                Found in lib/launchers/process.js - About 4 hrs to fix

                  Function parseConfig has 115 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function parseConfig (configFilePath, cliOptions, parseOptions) {
                    const promiseConfig = parseOptions && parseOptions.promiseConfig === true
                    const throwErrors = parseOptions && parseOptions.throwErrors === true
                    const shouldSetupLoggerEarly = promiseConfig
                    if (shouldSetupLoggerEarly) {
                  Severity: Major
                  Found in lib/config.js - About 4 hrs to fix

                    Function 3 has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    },{}],3:[function(require,module,exports){
                    // Load our dependencies
                    var stringify = require('../common/stringify')
                    
                    // Define our context Karma constructor
                    Severity: Major
                    Found in static/context.js - About 4 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language