karma-runner/karma

View on GitHub

Showing 258 of 258 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  yargs
    .usage('Karma - Spectacular Test Runner for JavaScript.\n\n' +
      'RUN - Run the tests (requires running server).\n\n' +
      'Usage:\n' +
      '  $0 run [configFile] [-- <clientArgs>]')
Severity: Major
Found in lib/cli.js and 1 other location - About 4 hrs to fix
lib/cli.js on lines 180..198

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 125.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  yargs
    .usage('Karma - Spectacular Test Runner for JavaScript.\n\n' +
      'START - Start the server / do a single run.\n\n' +
      'Usage:\n' +
      '  $0 start [configFile]')
Severity: Major
Found in lib/cli.js and 1 other location - About 4 hrs to fix
lib/cli.js on lines 215..236

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 125.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function BaseReporter has 110 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const BaseReporter = function (formatError, reportSlow, useColors, browserConsoleLogOptions, adapter) {
  this.adapters = [adapter || process.stdout.write.bind(process.stdout)]

  this.USE_COLORS = false
  this.EXCLUSIVELY_USE_COLORS = undefined
Severity: Major
Found in lib/reporters/base.js - About 4 hrs to fix

    Function ContextKarma has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
    Open

    function ContextKarma (callParentKarmaMethod) {
      // Define local variables
      var hasError = false
      var self = this
      var isLoaded = false
    Severity: Minor
    Found in context/karma.js - About 4 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 5 has a Cognitive Complexity of 27 (exceeds 5 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 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 ContextKarma has 96 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function ContextKarma (callParentKarmaMethod) {
      // Define local variables
      var hasError = false
      var self = this
      var isLoaded = false
    Severity: Major
    Found in static/context.js - About 3 hrs to fix

      Function ContextKarma has 96 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function ContextKarma (callParentKarmaMethod) {
        // Define local variables
        var hasError = false
        var self = this
        var isLoaded = false
      Severity: Major
      Found in context/karma.js - About 3 hrs to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        },{}],11:[function(require,module,exports){
        /**
         * This file automatically generated from `pre-publish.js`.
         * Do not manually edit.
         */
        Severity: Major
        Found in static/context.js and 1 other location - About 3 hrs to fix
        static/karma.js on lines 2879..2904

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 111.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        },{}],13:[function(require,module,exports){
        /**
         * This file automatically generated from `pre-publish.js`.
         * Do not manually edit.
         */
        Severity: Major
        Found in static/karma.js and 1 other location - About 3 hrs to fix
        static/context.js on lines 2620..2645

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 111.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                ContextKarma.getDirectCallParentKarmaMethod = function (parentWindow) {
                  return function directCallParentKarmaMethod (method, args) {
                    // If the method doesn't exist, then error out
                    if (!parentWindow.karma[method]) {
                      parentWindow.karma.error('Expected Karma method "' + method + '" to exist but it doesn\'t')
                Severity: Major
                Found in context/karma.js and 1 other location - About 3 hrs to fix
                static/context.js on lines 279..290

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 102.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                ContextKarma.getDirectCallParentKarmaMethod = function (parentWindow) {
                  return function directCallParentKarmaMethod (method, args) {
                    // If the method doesn't exist, then error out
                    if (!parentWindow.karma[method]) {
                      parentWindow.karma.error('Expected Karma method "' + method + '" to exist but it doesn\'t')
                Severity: Major
                Found in static/context.js and 1 other location - About 3 hrs to fix
                context/karma.js on lines 142..153

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 102.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                  this.onRunComplete = (browsers, results) => {
                    if (browsers.length >= 1 && !results.error && !results.disconnected) {
                      if (!results.failed) {
                        this.write(this.TOTAL_SUCCESS, results.success)
                      } else {
                Severity: Major
                Found in lib/reporters/base.js and 1 other location - About 3 hrs to fix
                lib/reporters/dots.js on lines 35..43

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 101.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                  this.onRunComplete = function (browsers, results) {
                    if (browsers.length > 1 && !results.disconnected && !results.error) {
                      if (!results.failed) {
                        this.write(this.TOTAL_SUCCESS, results.success)
                      } else {
                Severity: Major
                Found in lib/reporters/dots.js and 1 other location - About 3 hrs to fix
                lib/reporters/base.js on lines 137..145

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 101.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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
                  Severity
                  Category
                  Status
                  Source
                  Language