karma-runner/karma

View on GitHub

Showing 193 of 258 total issues

Function resolve has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function resolve (plugins, emitter) {
  const modules = []

  function requirePlugin (name) {
    log.debug(`Loading plugin ${name}.`)
Severity: Minor
Found in lib/plugin.js - About 1 hr to fix

    Function _refresh has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _refresh () {
        const matchedFiles = new Set()
    
        let lastCompletedRefresh = this._refreshing
        lastCompletedRefresh = Promise.all(
    Severity: Minor
    Found in lib/file-list.js - About 1 hr to fix

      Function ProgressReporter has 41 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function ProgressReporter (formatError, reportSlow, useColors, browserConsoleLogOptions) {
        BaseReporter.call(this, formatError, reportSlow, useColors, browserConsoleLogOptions)
      
        this.EXCLUSIVELY_USE_COLORS = false
        this._browsers = []
      Severity: Minor
      Found in lib/reporters/progress.js - About 1 hr to fix

        Function createReporters has 40 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function createReporters (names, config, emitter, injector) {
          const errorFormatter = createErrorFormatter(config, emitter, SourceMapConsumer)
          const reporters = []
        
          names.forEach((name) => {
        Severity: Minor
        Found in lib/reporter.js - About 1 hr to fix

          Function createPriorityPreprocessor has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

          function createPriorityPreprocessor (config = {}, preprocessorPriority, basePath, instantiatePlugin) {
            _.union.apply(_, Object.values(config)).forEach((name) => instantiatePlugin('preprocessor', name))
            return async function preprocess (file) {
              const buffer = await tryToRead(file.originalPath, log)
              let isBinary = file.isBinary
          Severity: Minor
          Found in lib/preprocessor.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 navigateContextTo has 39 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function navigateContextTo (url) {
              if (self.config.useIframe === false) {
                // run in new window
                if (self.config.runInParent === false) {
                  // If there is a window already open, then close it
          Severity: Minor
          Found in client/karma.js - About 1 hr to fix

            Function navigateContextTo has 39 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function navigateContextTo (url) {
                if (self.config.useIframe === false) {
                  // run in new window
                  if (self.config.runInParent === false) {
                    // If there is a window already open, then close it
            Severity: Minor
            Found in static/karma.js - About 1 hr to fix

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

              exports.run = async () => {
                const cliOptions = exports.process()
                const cmd = cliOptions.cmd // prevent config from changing the command
                const cmdNeedsConfig = cmd === 'start' || cmd === 'run' || cmd === 'stop'
                if (cmdNeedsConfig) {
              Severity: Minor
              Found in lib/cli.js - About 1 hr to fix

                Function extend has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function extend() {
                    var options, name, src, copy, copyIsArray, clone;
                    var target = arguments[0];
                    var i = 1;
                    var length = arguments.length;
                Severity: Minor
                Found in static/context.js - About 1 hr to fix

                  Function extend has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  module.exports = function extend() {
                      var options, name, src, copy, copyIsArray, clone;
                      var target = arguments[0];
                      var i = 1;
                      var length = arguments.length;
                  Severity: Minor
                  Found in static/karma.js - About 1 hr to fix

                    Function _start has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                      async _start (config, launcher, preprocess, fileList, capturedBrowsers, executor, done) {
                        if (config.detached) {
                          this._detach(config, done)
                          return
                        }
                    Severity: Minor
                    Found in lib/server.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 7 has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    },{}],7:[function(require,module,exports){
                    (function (global){
                    
                    var NativeCustomEvent = global.CustomEvent;
                    
                    
                    Severity: Minor
                    Found in static/karma.js - About 1 hr to fix

                      Function onLine has 35 lines of code (exceeds 25 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 1 hr to fix

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

                        },{"./karma":3}],5:[function(require,module,exports){
                        (function (global){
                        
                        var NativeCustomEvent = global.CustomEvent;
                        
                        
                        Severity: Minor
                        Found in static/context.js - About 1 hr to fix

                          Function 7 has 34 lines of code (exceeds 25 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 1 hr to fix

                            Function _close has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              _close (exitCode) {
                                const webServer = this._injector.get('webServer')
                                const socketServer = this._injector.get('socketServer')
                                const done = this._injector.get('done')
                            
                            
                            Severity: Minor
                            Found in lib/server.js - About 1 hr to fix

                              Function 9 has 34 lines of code (exceeds 25 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 1 hr to fix

                                Function createWebServer has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                function createWebServer (injector, config) {
                                  const { mime = {} } = config
                                  mimeType.define({ ...mime }, true)
                                
                                  const proxyMiddlewareInstance = injector.invoke(proxyMiddleware.create)
                                Severity: Minor
                                Found in lib/web-server.js - About 1 hr to fix

                                  Function DotsReporter has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  function DotsReporter (formatError, reportSlow, useColors, browserConsoleLogOptions) {
                                    BaseReporter.call(this, formatError, reportSlow, useColors, browserConsoleLogOptions)
                                  
                                    const DOTS_WRAP = 80
                                    this.EXCLUSIVELY_USE_COLORS = false
                                  Severity: Minor
                                  Found in lib/reporters/dots.js - About 1 hr to fix

                                    Function setup has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function setup (level, colors, appenders) {
                                      // Turn color on/off on the console appenders with pattern layout
                                      const pattern = colors ? constant.COLOR_PATTERN : constant.NO_COLOR_PATTERN
                                      if (appenders) {
                                        // Convert Array to Object for backwards compatibility.
                                    Severity: Minor
                                    Found in lib/logger.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language