karma-runner/karma

View on GitHub

Showing 103 of 132 total issues

Function Karma has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
Open

function Karma (socket, iframe, opener, navigator, location, document) {
  var startEmitted = false
  var reloadingContext = false
  var self = this
  var queryParams = util.parseQueryParams(location.search)
Severity: Minor
Found in client/karma.js - About 1 day 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 Karma has 212 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Karma (socket, iframe, opener, navigator, location, document) {
  var startEmitted = false
  var reloadingContext = false
  var self = this
  var queryParams = util.parseQueryParams(location.search)
Severity: Major
Found in client/karma.js - About 1 day to fix

    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 _start has 196 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 7 hrs to fix

      Function exports has 144 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports = function (grunt) {
        grunt.initConfig({
          pkg: grunt.file.readJSON('package.json'),
          pkgFile: 'package.json',
          files: {
      Severity: Major
      Found in gruntfile.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

        Function processArgs has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

        function processArgs (argv, options, fs, path) {
          if (argv.help) {
            console.log(optimist.help())
            process.exit(0)
          }
        Severity: Minor
        Found in lib/cli.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

        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 createKarmaMiddleware has 124 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function createKarmaMiddleware (
            filesPromise,
            serveStaticFile,
            serveFile,
            injector,
          Severity: Major
          Found in lib/middleware/karma.js - About 4 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 Launcher has 119 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function Launcher (server, emitter, injector) {
              this._browsers = []
              let lastStartTime
            
              const getBrowserById = (id) => this._browsers.find((browser) => browser.id === id)
            Severity: Major
            Found in lib/launcher.js - About 4 hrs to fix

              Function ProcessLauncher has 116 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 BaseReporter has 110 lines of code (exceeds 25 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: Major
                Found in lib/reporters/base.js - About 4 hrs to fix

                  File server.js has 350 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 4 hrs to fix

                    File config.js has 341 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 4 hrs to fix

                      Function ContextKarma has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function ContextKarma (callParentKarmaMethod) {
                        // Define local variables
                        var hasError = false
                        var self = this
                        var isLoaded = false
                      Severity: Minor
                      Found in context/karma.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 97 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function processArgs (argv, options, fs, path) {
                        if (argv.help) {
                          console.log(optimist.help())
                          process.exit(0)
                        }
                      Severity: Major
                      Found in lib/cli.js - About 3 hrs to fix

                        Function ContextKarma has 96 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function ContextKarma (callParentKarmaMethod) {
                          // Define local variables
                          var hasError = false
                          var self = this
                          var isLoaded = false
                        Severity: Major
                        Found in context/karma.js - About 3 hrs to fix

                          Function onLine has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
                          Open

                            onLine (line) {
                              if (currentQuestionId) {
                                this.rli.write(this.colors.RESET)
                                line = line.trim().replace(this.colors.ANSWER, '').replace(this.colors.RESET, '')
                          
                          
                          Severity: Minor
                          Found in lib/init/state_machine.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 BaseLauncher has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function BaseLauncher (id, emitter) {
                            if (this.start) {
                              return
                            }
                          
                          
                          Severity: Major
                          Found in lib/launchers/base.js - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language