TheBrainFamily/chimpy

View on GitHub
src/lib/chimp.js

Summary

Maintainability
F
4 days
Test Coverage

File chimp.js has 501 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * Externals
 */
let async = require('async'),
  path = require('path'),
Severity: Major
Found in src/lib/chimp.js - About 1 day to fix

    Function _createProcesses has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    Chimp.prototype._createProcesses = function () {
      const processes = [];
      const self = this;
    
      const addTestRunnerToRunOrder = function (name, type) {
    Severity: Minor
    Found in src/lib/chimp.js - About 5 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 _createProcesses has 76 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Chimp.prototype._createProcesses = function () {
      const processes = [];
      const self = this;
    
      const addTestRunnerToRunOrder = function (name, type) {
    Severity: Major
    Found in src/lib/chimp.js - About 3 hrs to fix

      Function watch has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      Chimp.prototype.watch = function () {
        const self = this;
      
        let watchDirectories = [];
        if (self.options.watchSource) {
      Severity: Minor
      Found in src/lib/chimp.js - About 1 hr to fix

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

        Chimp.prototype.run = function (callback) {
          log.info('\n[chimp] Running...'[DEFAULT_COLOR]);
        
          const self = this;
        
        
        Severity: Minor
        Found in src/lib/chimp.js - About 1 hr to fix

          Function _setupRoutes has 44 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Chimp.prototype._setupRoutes = function (server) {
            const self = this;
            server.route({
              method: 'GET',
              path: '/run',
          Severity: Minor
          Found in src/lib/chimp.js - About 1 hr to fix

            Function _initSimianResultBranch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            Chimp.prototype._initSimianResultBranch = function () {
              // Automatically set the result branch for the common CI tools
              if (this.options.simianAccessToken &&
                this.options.simianResultBranch === null
              ) {
            Severity: Minor
            Found in src/lib/chimp.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 interrupt has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            Chimp.prototype.interrupt = function (callback) {
              log.debug('[chimp] interrupting');
            
              const self = this;
            
            
            Severity: Minor
            Found in src/lib/chimp.js - About 1 hr to fix

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

              function Chimp(options) {
                this.chokidar = chokidar;
                this.options = options || {};
                this.processes = [];
                this.isInterrupting = false;
              Severity: Minor
              Found in src/lib/chimp.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 init has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              Chimp.prototype.init = function (callback) {
                const self = this;
              
                this.informUser();
              
              
              Severity: Minor
              Found in src/lib/chimp.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

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

                    if (options.r) {
                      options.r = _.isArray(options.r) ? options.r : [options.r];
                    } else {
                      options.r = [];
                    }
              Severity: Major
              Found in src/lib/chimp.js and 1 other location - About 1 hr to fix
              src/lib/chimp.js on lines 636..640

              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 66.

              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

                    if (options.r) {
                      options.r = _.isArray(options.r) ? options.r : [options.r];
                    } else {
                      options.r = [];
                    }
              Severity: Major
              Found in src/lib/chimp.js and 1 other location - About 1 hr to fix
              src/lib/chimp.js on lines 614..618

              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 66.

              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

                if (booleanHelper.isTruthy(this.options.criticalSteps)) {
                  this.options.e2eSteps = this.options.criticalSteps;
                  log.warn('[chimp] Please use e2eSteps instead of criticalSteps. criticalSteps is now deprecated.'.red);
                }
              Severity: Major
              Found in src/lib/chimp.js and 1 other location - About 1 hr to fix
              src/lib/chimp.js on lines 134..137

              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 61.

              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

                if (booleanHelper.isTruthy(this.options.criticalTag)) {
                  this.options.e2eTags = this.options.criticalTag;
                  log.warn('[chimp] Please use e2eTags instead of criticalTag. criticalTag is now deprecated.'.red);
                }
              Severity: Major
              Found in src/lib/chimp.js and 1 other location - About 1 hr to fix
              src/lib/chimp.js on lines 129..132

              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 61.

              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

                  if (this.options.browser === 'phantomjs') {
                    process.env['chimp.host'] = this.options.host = 'localhost';
                    const phantom = new Phantom(this.options);
                    processes.push(phantom);
                  } else if (userHasProvidedBrowser() && userHasNotProvidedSeleniumHost()) {
              Severity: Major
              Found in src/lib/chimp.js and 1 other location - About 1 hr to fix
              src/lib/chimp.js on lines 591..601

              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 57.

              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

                  } else if (userHasProvidedBrowser() && userHasNotProvidedSeleniumHost()) {
                    process.env['chimp.host'] = this.options.host = 'localhost';
                    const selenium = new Selenium(this.options);
                    processes.push(selenium);
                  } else if (userHasNotProvidedSeleniumHost()) {
              Severity: Major
              Found in src/lib/chimp.js and 1 other location - About 1 hr to fix
              src/lib/chimp.js on lines 587..601

              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 57.

              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

                    self.rerun((err, res) => {
                      const cucumberResults = self._parseResult(res);
                      reply(cucumberResults).header('Content-Type', 'application/json');
                    });
              Severity: Minor
              Found in src/lib/chimp.js and 1 other location - About 40 mins to fix
              src/lib/chimp.js on lines 381..384

              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 49.

              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

                    self.rerun((err, res) => {
                      const cucumberResults = self._parseResult(res);
                      reply(cucumberResults).header('Content-Type', 'application/json');
                    });
              Severity: Minor
              Found in src/lib/chimp.js and 1 other location - About 40 mins to fix
              src/lib/chimp.js on lines 369..372

              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 49.

              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

              There are no issues that match your filters.

              Category
              Status