karma-runner/karma

View on GitHub

Showing 193 of 258 total issues

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

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

var NativeCustomEvent = global.CustomEvent;

Severity: Minor
Found in static/karma.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 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 processArgs has 91 lines of code (exceeds 25 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: Major
Found in lib/cli.js - About 3 hrs to fix

    Function 1 has 88 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
    var serialize = null
    try {
      serialize = require('dom-serialize')
    } catch (e) {
    Severity: Major
    Found in static/context.js - About 3 hrs to fix

      Function 5 has 88 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      },{"./constants":1}],5:[function(require,module,exports){
      var serialize = null
      try {
        serialize = require('dom-serialize')
      } catch (e) {
      Severity: Major
      Found in static/karma.js - About 3 hrs to fix

        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

          Function 9 has 82 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          },{}],9:[function(require,module,exports){
          'use strict';
          
          var hasOwn = Object.prototype.hasOwnProperty;
          var toStr = Object.prototype.toString;
          Severity: Major
          Found in static/context.js - About 3 hrs to fix

            Function 11 has 82 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            },{}],11:[function(require,module,exports){
            'use strict';
            
            var hasOwn = Object.prototype.hasOwnProperty;
            var toStr = Object.prototype.toString;
            Severity: Major
            Found in static/karma.js - About 3 hrs to fix

              Function 7 has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

              },{"custom-event":5,"ent/encode":7,"extend":9,"void-elements":11}],7:[function(require,module,exports){
              var punycode = require('punycode');
              var revEntities = require('./reversed.json');
              
              module.exports = encode;
              Severity: Minor
              Found in static/context.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 9 has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
              Open

              },{"custom-event":7,"ent/encode":9,"extend":11,"void-elements":13}],9:[function(require,module,exports){
              var punycode = require('punycode');
              var revEntities = require('./reversed.json');
              
              module.exports = encode;
              Severity: Minor
              Found in static/karma.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 ProcessLauncher has a Cognitive Complexity of 22 (exceeds 5 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: Minor
              Found in lib/launchers/process.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 stringify has 76 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function stringify (obj, depth) {
                if (depth === 0) {
                  return '...'
                }
              
              
              Severity: Major
              Found in static/context.js - About 3 hrs to fix

                Function stringify has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function stringify (obj, depth) {
                  if (depth === 0) {
                    return '...'
                  }
                
                
                Severity: Major
                Found in common/stringify.js - About 3 hrs to fix

                  Function stringify has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function stringify (obj, depth) {
                    if (depth === 0) {
                      return '...'
                    }
                  
                  
                  Severity: Major
                  Found in static/karma.js - About 3 hrs to fix

                    Function createRunnerMiddleware has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function createRunnerMiddleware (emitter, fileList, capturedBrowsers, reporter, executor,
                      /* config.protocol */ protocol, /* config.hostname */ hostname, /* config.port */
                      port, /* config.urlRoot */ urlRoot, config) {
                      helper.saveOriginalArgs(config)
                      return function (request, response, next) {
                    Severity: Major
                    Found in lib/middleware/runner.js - About 3 hrs to fix

                      Function constructor has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        constructor (cliOptionsOrConfig, done) {
                          super()
                          cliOptionsOrConfig = cliOptionsOrConfig || {}
                          this.log = logger.create('karma-server')
                          done = helper.isFunction(done) ? done : process.exit
                      Severity: Major
                      Found in lib/server.js - About 2 hrs to fix

                        Function encode has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function encode(input) {
                                var n,
                                    delta,
                                    handledCPCount,
                                    basicLength,
                        Severity: Major
                        Found in static/context.js - About 2 hrs to fix

                          Function encode has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              function encode(input) {
                                  var n,
                                      delta,
                                      handledCPCount,
                                      basicLength,
                          Severity: Major
                          Found in static/karma.js - About 2 hrs to fix

                            File cli.js has 285 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            'use strict'
                            
                            const path = require('path')
                            const yargs = require('yargs')
                            const fs = require('graceful-fs')
                            Severity: Minor
                            Found in lib/cli.js - About 2 hrs to fix

                              Function 4 has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                              Open

                              },{"../common/util":6,"./constants":1,"./karma":2,"./updater":4}],4:[function(require,module,exports){
                              var VERSION = require('./constants').VERSION
                              
                              function StatusUpdater (socket, titleElement, bannerElement, browsersElement) {
                                function updateBrowsersInfo (browsers) {
                              Severity: Minor
                              Found in static/karma.js - About 2 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

                              Severity
                              Category
                              Status
                              Source
                              Language