TheBrainFamily/chimpy

View on GitHub

Showing 131 of 131 total issues

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

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

        stderr: {
          on: jest.fn().mockImplementation((event, eventTrigger) => {
            eventToBeRemovedStdErr = eventTrigger;
            eventTrigger('Huston, we have lift off!');
          }),
Severity: Major
Found in src/__tests__/process-helper-spec.js and 1 other location - About 1 hr to fix
src/__tests__/process-helper-spec.js on lines 136..142

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

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

        stdout: {
          on: jest.fn().mockImplementation((event, eventTrigger) => {
            eventToBeRemovedStdOut = eventTrigger;
            eventTrigger('Huston, we have lift off!');
          }),
Severity: Major
Found in src/__tests__/process-helper-spec.js and 1 other location - About 1 hr to fix
src/__tests__/process-helper-spec.js on lines 143..149

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

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 initSingleBrowser has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    var initSingleBrowser = function (browser) {
      log.debug('[chimp][helper] init browser');
      log.debug('[chimp][helper] init browser callback');

      browser.screenshotsCount = 0;
Severity: Minor
Found in src/lib/chimp-helper.js - About 1 hr to fix

    Function decideReuse has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function decideReuse() {
    
        if (self.options.browser === 'phantomjs') {
          log.debug('[chimp][session-manager] browser is phantomjs, not reusing a session');
          callback(null, browser);
    Severity: Minor
    Found in src/lib/session-manager.js - About 1 hr to fix

      Function killSession has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var killSession = function (job) {
          // This will stop the session, causing a 'User terminated' error.
          // If we don't manually stop the session, we get a timed-out error.
          var options = {
            url: this.options.sauceLabsUrl + '/jobs/' + job.id + '/stop',
      Severity: Minor
      Found in src/lib/saucelabs-manager.js - About 1 hr to fix

        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

        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

        Function runJasmineInFiber has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

        new Fiber(function runJasmineInFiber() {
          const projectDir = process.env.PWD;
          const testsDir = process.env['chimp.path'];
          process.chdir(testsDir);
        
        
        Severity: Minor
        Found in src/lib/jasmine/jasmine-wrapper.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 setupGlobals has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          setupGlobals: function () {
            global.wrapAsync = wrapAsync;
            global.wrapAsyncObject = wrapAsyncObject;
        
            // give users access the request module
        Severity: Minor
        Found in src/lib/chimp-helper.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 kill has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          kill: function (options, callback) {
        
            log.debug('[chimp][' + options.prefix + ']', 'kill called on ' + options.prefix + ' process with pid', options.child.pid);
        
            options.signal = options.signal || 'SIGTERM';
        Severity: Minor
        Found in src/lib/process-helper.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 addServerExecute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var addServerExecute = function (ddpInstance) {
                ddpInstance.execute = function (func) {
                  var args = Array.prototype.slice.call(arguments, 1);
                  var result;
                  var timeout = parseInt(process.env['chimp.serverExecuteTimeout']) || 10000;
          Severity: Minor
          Found in src/lib/chimp-helper.js - About 1 hr to fix

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

                if (booleanHelper.isTruthy(this.options['fail-when-no-tests-run'])) {
                  callback(infoMessage);
                }
                else {
                  log.info(infoMessage);
            Severity: Minor
            Found in src/lib/jasmine/jasmine.js and 1 other location - About 50 mins to fix
            src/lib/cucumberjs/cucumber.js on lines 27..33

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

            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 (booleanHelper.isTruthy(this.options['fail-when-no-tests-run'])) {
                    callback(infoMessage);
                  }
                  else {
                    log.info(infoMessage);
            Severity: Minor
            Found in src/lib/cucumberjs/cucumber.js and 1 other location - About 50 mins to fix
            src/lib/jasmine/jasmine.js on lines 35..41

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

            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 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 killCurrentSession has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            BrowserStackSessionManager.prototype.killCurrentSession = function (callback) {
            
              var self = this;
              var wdOptions = this.options;
              const wdHubSession = 'http://' + wdOptions.host + ':' + wdOptions.port + '/wd/hub/session';
            Severity: Minor
            Found in src/lib/browserstack-manager.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

            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

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

                child.stdout.on('data', function (data) {
                  log.debug('[chimp][' + prefix + '.stdout]', data.toString());
                });
            Severity: Minor
            Found in src/lib/process-helper.js and 1 other location - About 40 mins to fix
            src/lib/process-helper.js on lines 33..35

            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

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

                child.stderr.on('data', function (data) {
                  log.debug('[chimp][' + prefix + '.stderr]', data.toString());
                });
            Severity: Minor
            Found in src/lib/process-helper.js and 1 other location - About 40 mins to fix
            src/lib/process-helper.js on lines 30..32

            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

            Severity
            Category
            Status
            Source
            Language