TheBrainFamily/chimpy

View on GitHub

Showing 131 of 131 total issues

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

    it('should load the chimp.js file if it exists in the current directory', () => {
      const argv = ['not', 'applicable', 'not-a-config-file.js'];
      optionsLoader._getProcessArgv = jest.fn().mockReturnValue(argv);

      fs.existsSync = jest.fn().mockReturnValue(true);
Severity: Major
Found in src/__tests__/options-loader.js and 1 other location - About 4 hrs to fix
src/__tests__/options-loader.js on lines 16..24

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

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

  self.child.on('close', (code) => {
    log.debug('[chimp][jasmine] Closed with code', code);
    const failWhenNoTestsRun = booleanHelper.isTruthy(self.options['fail-when-no-tests-run']);
    if (!self.child.stopping) {
      log.debug('[chimp][jasmine] Jasmine not in a stopping state');
Severity: Major
Found in src/lib/jasmine/jasmine.js and 1 other location - About 4 hrs to fix
src/lib/mocha/mocha.js on lines 118..125

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

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

  self.child.on('close', (code) => {
    log.debug('[chimp][mocha] Closed with code', code);
    const failWhenNoTestsRun = booleanHelper.isTruthy(self.options['fail-when-no-tests-run']);
    if (!self.child.stopping) {
      log.debug('[chimp][mocha] Mocha not in a stopping state');
Severity: Major
Found in src/lib/mocha/mocha.js and 1 other location - About 4 hrs to fix
src/lib/jasmine/jasmine.js on lines 92..99

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

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

function Versions(options) {
  this.options = options;

  this.appDir = '../..';
  this.chromeDriverExec = chromedriver.path;
Severity: Minor
Found in src/lib/versions.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

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

BrowserStackSessionManager.prototype.remote = function (webdriverOptions, callback) {

  var self = this;

  log.debug('[chimp][browserstack-session-manager] creating webdriver remote ');
Severity: Major
Found in src/lib/browserstack-manager.js and 1 other location - About 3 hrs to fix
src/lib/saucelabs-manager.js on lines 38..50

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

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

SauceLabsSessionManager.prototype.remote = function (webdriverOptions, callback) {

  var self = this;

  log.debug('[chimp][saucelabs-session-manager] creating webdriver remote ');
Severity: Major
Found in src/lib/saucelabs-manager.js and 1 other location - About 3 hrs to fix
src/lib/browserstack-manager.js on lines 40..52

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

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

module.exports = function hooks() {
  const screenshots = {};

  this.setDefaultTimeout(60 * 1000);

Severity: Major
Found in src/lib/cucumberjs/hooks.js - About 3 hrs to fix

    Function start has 82 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    Mocha.prototype.start = function (callback) {
    
      var self = this;
      if (glob.sync(self.options.path).length === 0) {
        const infoMessage = `[chimp][mocha] Directory ${self.options.path} does not exist. Not running`;
    Severity: Major
    Found in src/lib/mocha/mocha.js - About 3 hrs to fix

      Function start has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

      Mocha.prototype.start = function (callback) {
      
        var self = this;
        if (glob.sync(self.options.path).length === 0) {
          const infoMessage = `[chimp][mocha] Directory ${self.options.path} does not exist. Not running`;
      Severity: Minor
      Found in src/lib/mocha/mocha.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 _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

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

          self.child.stdout.on('data', function(data) {
            const colorCodesRegExp = new RegExp(`\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]`, 'g');
            const dataFromStdout = data.toString().replace(colorCodesRegExp, '').trim();
            if (/^0 passing/.test(dataFromStdout)) {
              noTestsFound = true;
        Severity: Major
        Found in src/lib/mocha/mocha.js and 1 other location - About 3 hrs to fix
        src/lib/jasmine/jasmine.js on lines 78..84

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

        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

          self.child.stdout.on('data', function(data) {
            const colorCodesRegExp = new RegExp(`\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]`, 'g');
            const dataFromStdout = data.toString().replace(colorCodesRegExp, '').trim();
            if (/^No specs found/.test(dataFromStdout)) {
              noTestsFound = true;
        Severity: Major
        Found in src/lib/jasmine/jasmine.js and 1 other location - About 3 hrs to fix
        src/lib/mocha/mocha.js on lines 104..110

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

        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

        File selenium-spec.js has 283 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /* eslint-disable global-require */
        jest.dontMock('../lib/selenium');
        jest.dontMock('../lib/boolean-helper');
        jest.dontMock('underscore');
        
        
        Severity: Minor
        Found in src/__tests__/selenium-spec.js - About 2 hrs to fix

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

            request(hub, function (error, response, body) {
              if (!error && response.statusCode === 200) {
                log.debug('[chimp][testingbot-session-manager]', 'received data', body);
                callback(null, JSON.parse(body));
              } else {
          Severity: Major
          Found in src/lib/testingbot-manager.js and 3 other locations - About 2 hrs to fix
          src/lib/browserstack-manager.js on lines 78..86
          src/lib/browserstack-manager.js on lines 99..107
          src/lib/saucelabs-manager.js on lines 67..75

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

          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 4 locations. Consider refactoring.
          Open

            request(hub, function (error, response, body) {
              if (!error && response.statusCode === 200) {
                log.debug('[chimp][browserstack-session-manager]', 'received data', body);
                callback(null, JSON.parse(body));
              } else {
          Severity: Major
          Found in src/lib/browserstack-manager.js and 3 other locations - About 2 hrs to fix
          src/lib/browserstack-manager.js on lines 78..86
          src/lib/saucelabs-manager.js on lines 67..75
          src/lib/testingbot-manager.js on lines 55..63

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

          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 4 locations. Consider refactoring.
          Open

            request(hub, function (error, response, body) {
              if (!error && response.statusCode === 200) {
                log.debug('[chimp][saucelabs-session-manager]', 'received data', body);
                callback(null, JSON.parse(body));
              } else {
          Severity: Major
          Found in src/lib/saucelabs-manager.js and 3 other locations - About 2 hrs to fix
          src/lib/browserstack-manager.js on lines 78..86
          src/lib/browserstack-manager.js on lines 99..107
          src/lib/testingbot-manager.js on lines 55..63

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

          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 4 locations. Consider refactoring.
          Open

            request(hub, function (error, response, body) {
              if (!error && response.statusCode === 200) {
                log.debug('[chimp][browserstack-session-manager]', 'received data', body);
                callback(null, JSON.parse(body));
              } else {
          Severity: Major
          Found in src/lib/browserstack-manager.js and 3 other locations - About 2 hrs to fix
          src/lib/browserstack-manager.js on lines 99..107
          src/lib/saucelabs-manager.js on lines 67..75
          src/lib/testingbot-manager.js on lines 55..63

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

          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

              it('parses https URLs', function () {
                var url = new DDP()._getUrl('https://somewhere:3000');
                expect(url.hostname).toEqual('somewhere');
                expect(url.port).toEqual('3000');
                expect(url.protocol).toEqual('https:');
          Severity: Major
          Found in src/__tests__/ddp-spec.js and 1 other location - About 2 hrs to fix
          src/__tests__/ddp-spec.js on lines 53..58

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

          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

              it('parses http URLs', function () {
                var url = new DDP()._getUrl('http://somewhere:3000');
                expect(url.hostname).toEqual('somewhere');
                expect(url.port).toEqual('3000');
                expect(url.protocol).toEqual('http:');
          Severity: Major
          Found in src/__tests__/ddp-spec.js and 1 other location - About 2 hrs to fix
          src/__tests__/ddp-spec.js on lines 59..64

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

          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.debugBrkCucumber)) {
                port = parseInt(this.options.debugBrkCucumber, 10);
                if (port > 1) {
                  opts.execArgv = ['--debug-brk=' + port];
                } else {
          Severity: Major
          Found in src/lib/cucumberjs/cucumber.js and 1 other location - About 2 hrs to fix
          src/lib/cucumberjs/cucumber.js on lines 45..52

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

          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