karma-runner/karma

View on GitHub

Showing 193 of 258 total issues

Function calculateExitCode has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  calculateExitCode (results, singleRunBrowserNotCaptured, config) {
    config = config || {}
    if (results.disconnected || singleRunBrowserNotCaptured) {
      return 1
    }
Severity: Minor
Found in lib/browser_collection.js - About 45 mins 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

Avoid deeply nested control flow statements.
Open

        if (obj.constructor && typeof obj.constructor === 'function') {
          constructor = obj.constructor.name
        }
Severity: Major
Found in static/context.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if (q < t) {
                                break;
                            }
    Severity: Major
    Found in static/karma.js - About 45 mins to fix

      Function setup has a Cognitive Complexity of 8 (exceeds 5 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 45 mins 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 error has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        this.error = function (messageOrEvent, source, lineno, colno, error) {
      Severity: Minor
      Found in client/karma.js - About 35 mins to fix

        Function error has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          this.error = function (messageOrEvent, source, lineno, colno, error) {
        Severity: Minor
        Found in static/karma.js - About 35 mins to fix

          Function baseBrowserDecoratorFactory has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            baseLauncherDecorator,
            captureTimeoutLauncherDecorator,
            retryLauncherDecorator,
            processLauncherDecorator,
            processKillTimeout
          Severity: Minor
          Found in lib/launcher.js - About 35 mins to fix

            Function BaseReporter has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            const BaseReporter = function (formatError, reportSlow, useColors, browserConsoleLogOptions, adapter) {
            Severity: Minor
            Found in lib/reporters/base.js - About 35 mins to fix

              Function watch has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              function watch (patterns, excludes, fileList, usePolling, emitter) {
              Severity: Minor
              Found in lib/watcher.js - About 35 mins to fix

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

                const main = async () => {
                  if (process.argv[2] === 'build') {
                    await bundleResourceToFile('client/main.js', 'static/karma.js')
                    await bundleResourceToFile('context/main.js', 'static/context.js')
                  } else if (process.argv[2] === 'check') {
                Severity: Minor
                Found in scripts/client.js - About 35 mins 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 resolve has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 onKeypress has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  onKeypress (key) {
                    if (!currentOptions || !key) {
                      return
                    }
                
                
                Severity: Minor
                Found in lib/init/state_machine.js - About 35 mins 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

                Avoid too many return statements within this function.
                Open

                        return obj.toString() + '\n' + obj.stack
                Severity: Major
                Found in common/stringify.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                            return serialize(obj)
                  Severity: Major
                  Found in static/context.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                            return obj.toString()
                    Severity: Major
                    Found in static/karma.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                return 'Skipping stringify, no support for dom-serialize'
                      Severity: Major
                      Found in static/karma.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                return obj.toString() + '\n' + obj.stack
                        Severity: Major
                        Found in static/karma.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return strs.join('')
                          Severity: Major
                          Found in static/context.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                      return serialize(obj)
                            Severity: Major
                            Found in common/stringify.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                      return obj.toString()
                              Severity: Major
                              Found in common/stringify.js - About 30 mins to fix
                                Severity
                                Category
                                Status
                                Source
                                Language