karma-runner/karma

View on GitHub

Showing 193 of 258 total issues

Function 4 has 68 lines of code (exceeds 25 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: Major
Found in static/karma.js - About 2 hrs to fix

    Function run has 66 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function run (cliOptionsOrConfig, done) {
      cliOptionsOrConfig = cliOptionsOrConfig || {}
      done = helper.isFunction(done) ? done : process.exit
    
      let config
    Severity: Major
    Found in lib/runner.js - About 2 hrs to fix

      Function StatusUpdater has 64 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function StatusUpdater (socket, titleElement, bannerElement, browsersElement) {
        function updateBrowsersInfo (browsers) {
          if (!browsersElement) {
            return
          }
      Severity: Major
      Found in static/karma.js - About 2 hrs to fix

        Function StatusUpdater has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function StatusUpdater (socket, titleElement, bannerElement, browsersElement) {
          function updateBrowsersInfo (browsers) {
            if (!browsersElement) {
              return
            }
        Severity: Major
        Found in client/updater.js - About 2 hrs to fix

          Function createServeFile has 62 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function createServeFile (fs, directory, config) {
            const cache = Object.create(null)
          
            return function (filepath, rangeHeader, response, transform, content, doNotCache) {
              let responseData
          Severity: Major
          Found in lib/middleware/common.js - About 2 hrs to fix

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

              constructor () {
                this.LOG_DISABLE = constant.LOG_DISABLE
                this.LOG_ERROR = constant.LOG_ERROR
                this.LOG_WARN = constant.LOG_WARN
                this.LOG_INFO = constant.LOG_INFO
            Severity: Major
            Found in lib/config.js - About 2 hrs to fix

              Browser has 22 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class Browser {
                constructor (id, fullName, collection, emitter, socket, timer, disconnectDelay,
                  noActivityTimeout, singleRun, clientConfig) {
                  this.id = id
                  this.fullName = fullName
              Severity: Minor
              Found in lib/browser.js - About 2 hrs to fix

                Function createErrorFormatter has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function createErrorFormatter (config, emitter, SourceMapConsumer) {
                  const basePath = config.basePath
                  const urlRoot = config.urlRoot === '/' ? '' : (config.urlRoot || '')
                  let lastServedFiles = []
                
                
                Severity: Major
                Found in lib/reporter.js - About 2 hrs to fix

                  Function serialize has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function serialize (node, context, fn, eventTarget) {
                    if (!node) return '';
                    if ('function' === typeof context) {
                      fn = context;
                      context = null;
                  Severity: Major
                  Found in static/context.js - About 2 hrs to fix

                    Function serialize has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function serialize (node, context, fn, eventTarget) {
                      if (!node) return '';
                      if ('function' === typeof context) {
                        fn = context;
                        context = null;
                    Severity: Major
                    Found in static/karma.js - About 2 hrs to fix

                      Function parseProxyConfig has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function parseProxyConfig (proxies, config) {
                        proxies = proxies || []
                        return _.sortBy(_.map(proxies, function (proxyConfiguration, proxyPath) {
                          if (typeof proxyConfiguration === 'string') {
                            proxyConfiguration = { target: proxyConfiguration }
                      Severity: Major
                      Found in lib/middleware/proxy.js - About 2 hrs to fix

                        Function setupContext has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          this.setupContext = function (contextWindow) {
                            // If we clear the context after every run and we already had an error
                            //   then stop now. Otherwise, carry on.
                            if (self.config.clearContext && hasError) {
                              return
                        Severity: Major
                        Found in context/karma.js - About 2 hrs to fix

                          Function setupContext has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            this.setupContext = function (contextWindow) {
                              // If we clear the context after every run and we already had an error
                              //   then stop now. Otherwise, carry on.
                              if (self.config.clearContext && hasError) {
                                return
                          Severity: Major
                          Found in static/context.js - About 2 hrs to fix

                            Function stop has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            exports.stop = function (cliOptionsOrConfig, done) {
                              cliOptionsOrConfig = cliOptionsOrConfig || {}
                              const log = logger.create('stopper')
                              done = helper.isFunction(done) ? done : process.exit
                            
                            
                            Severity: Major
                            Found in lib/stopper.js - About 2 hrs to fix

                              Function decode has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  function decode(input) {
                                      // Don't use UCS-2
                                      var output = [],
                                          inputLength = input.length,
                                          out,
                              Severity: Major
                              Found in static/karma.js - About 2 hrs to fix

                                Function decode has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    function decode(input) {
                                        // Don't use UCS-2
                                        var output = [],
                                            inputLength = input.length,
                                            out,
                                Severity: Major
                                Found in static/context.js - About 2 hrs to fix

                                  Function BaseLauncher has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                  function BaseLauncher (id, emitter) {
                                    if (this.start) {
                                      return
                                    }
                                  
                                  
                                  Severity: Minor
                                  Found in lib/launchers/base.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

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

                                  module.exports = function (wallaby) {
                                    return {
                                      files: [
                                        {
                                          pattern: 'package.json',
                                  Severity: Major
                                  Found in wallaby.js - About 2 hrs to fix

                                    Function StatusUpdater has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    function StatusUpdater (socket, titleElement, bannerElement, browsersElement) {
                                      function updateBrowsersInfo (browsers) {
                                        if (!browsersElement) {
                                          return
                                        }
                                    Severity: Minor
                                    Found in client/updater.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 launchSingle has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      launchSingle (protocol, hostname, port, urlRoot, upstreamProxy, processKillTimeout) {
                                        if (upstreamProxy) {
                                          protocol = upstreamProxy.protocol
                                          hostname = upstreamProxy.hostname
                                          port = upstreamProxy.port
                                    Severity: Minor
                                    Found in lib/launcher.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language