karma-runner/karma

View on GitHub

Showing 258 of 258 total issues

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 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 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 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 strs.join('')
        Severity: Major
        Found in static/context.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

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

            Avoid too many return statements within this function.
            Open

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

              Avoid too many return statements within this function.
              Open

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

                Avoid too many return statements within this function.
                Open

                    return next()
                Severity: Major
                Found in lib/middleware/karma.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 obj.toString()
                    Severity: Major
                    Found in common/stringify.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                              return obj.nodeValue
                      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 filesPromise.then((files) => {
                                  common.setNoCacheHeaders(response)
                                  response.writeHead(200)
                                  response.end(JSON.stringify({
                                    files: files.included.map((file) => filePathToUrlPath(file.path + '?' + file.sha, basePath, urlRoot, proxyPath))
                          Severity: Major
                          Found in lib/middleware/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 obj.outerHTML
                              Severity: Major
                              Found in static/context.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                      return serveStaticFile(requestUrl, requestedRangeHeader, response)
                                Severity: Major
                                Found in lib/middleware/karma.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                        return filesPromise.then((files) => {
                                          let fileServer
                                          let requestedFileUrl
                                          log.debug('custom files', customContextFile, customDebugFile, customClientContextFile)
                                          if (isRequestingContextFile && customContextFile) {
                                  Severity: Major
                                  Found in lib/middleware/karma.js - About 30 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language