TheBrainFamily/chimpy

View on GitHub

Showing 136 of 136 total issues

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 133..136

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.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 138..141

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

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

  constructor() {
    let mochaConfig = JSON.parse(process.env.mochaConfig);
    const mochaCommandLineOptions = process.env['chimp.mochaCommandLineOptions'] ? JSON.parse(process.env['chimp.mochaCommandLineOptions']) : false;
    if (mochaCommandLineOptions && _.isObject(mochaCommandLineOptions)) {
      _.extend(mochaConfig, mochaCommandLineOptions);
Severity: Minor
Found in src/lib/mocha/mocha-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 _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 _conditionOutput has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _conditionOutput(message) {
    if (message.indexOf('callback.pending()') === -1) {
      process.stdout.write(message);
      return;
    }
Severity: Minor
Found in src/lib/cucumberjs/cucumber.js - About 1 hr to fix

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

            stderr: {
              on: jest.genMockFn().mockImplementation(function (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 144..150

    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.genMockFn().mockImplementation(function (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 151..157

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

        Chimp.prototype.interrupt = function (callback) {
        
          log.debug('[chimp] interrupting');
        
          var self = this;
        Severity: Minor
        Found in src/lib/chimp.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

            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 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 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 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 = [];
              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(function (err, res) {
                      var 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 397..400

              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