TheBrainFamily/chimpy

View on GitHub

Showing 131 of 131 total issues

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

    it('should reuse a session if one has already started in watch mode', function () {

      var wd = require('xolvio-sync-webdriverio');
      var SessionManager = require('../lib/session-manager');

Severity: Major
Found in src/__tests__/session-manager-spec.js and 1 other location - About 2 days to fix
src/__tests__/session-manager-spec.js on lines 123..153

Duplicated Code

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

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

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

Tuning

This issue has a mass of 370.

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('should reuse a session if one has already started in server mode', function () {

      var wd = require('xolvio-sync-webdriverio');
      var SessionManager = require('../lib/session-manager');

Severity: Major
Found in src/__tests__/session-manager-spec.js and 1 other location - About 2 days to fix
src/__tests__/session-manager-spec.js on lines 91..121

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

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 chimp-spec.js has 642 lines of code (exceeds 250 allowed). Consider refactoring.
Open

jest.dontMock('../lib/chimp.js');
jest.dontMock('../lib/boolean-helper');
jest.dontMock('underscore');
jest.dontMock('async');
jest.dontMock('wrappy');
Severity: Major
Found in src/__tests__/chimp-spec.js - About 1 day to fix

    Function setupBrowserAndDDP has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring.
    Open

      setupBrowserAndDDP: function () {
    
        var setupBrowser = function () {
          log.debug('[chimp][helper] getting browser');
    
    
    Severity: Minor
    Found in src/lib/chimp-helper.js - About 1 day 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 3 locations. Consider refactoring.
    Open

        it('returns cucumber results when run handler is called successfully', () => {
          const Hapi = require('hapi');
          const Chimp = require('../lib/chimp.js');
          const chimp = new Chimp({serverHost: 'localhost', serverPort: 1234});
    
    
    Severity: Major
    Found in src/__tests__/chimp-spec.js and 2 other locations - About 1 day to fix
    src/__tests__/chimp-spec.js on lines 457..473
    src/__tests__/chimp-spec.js on lines 475..491

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

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

        it('returns "done" when interrupt handler is called successfully', () => {
          const Hapi = require('hapi');
          const Chimp = require('../lib/chimp.js');
          const chimp = new Chimp({serverHost: 'localhost', serverPort: 1234});
    
    
    Severity: Major
    Found in src/__tests__/chimp-spec.js and 2 other locations - About 1 day to fix
    src/__tests__/chimp-spec.js on lines 417..434
    src/__tests__/chimp-spec.js on lines 475..491

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

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

        it('returns cucumber results when runAll handler is called successfully', () => {
          const Hapi = require('hapi');
          const Chimp = require('../lib/chimp.js');
          const chimp = new Chimp({serverHost: 'localhost', serverPort: 1234});
    
    
    Severity: Major
    Found in src/__tests__/chimp-spec.js and 2 other locations - About 1 day to fix
    src/__tests__/chimp-spec.js on lines 417..434
    src/__tests__/chimp-spec.js on lines 457..473

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

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

        setupBrowserAndDDP: function () {
      
          var setupBrowser = function () {
            log.debug('[chimp][helper] getting browser');
      
      
      Severity: Major
      Found in src/lib/chimp-helper.js - About 7 hrs to fix

        Function Versions has 175 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function Versions(options) {
          this.options = options;
        
          this.appDir = '../..';
          this.chromeDriverExec = chromedriver.path;
        Severity: Major
        Found in src/lib/versions.js - About 7 hrs to fix

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

                  stdout: {
                    on: jest.fn().mockImplementation((event, eventTrigger) => {
                      eventTrigger('blah');
                      expect(event).toBe('data');
                      expect(log.debug.mock.calls.length).toBe(1);
          Severity: Major
          Found in src/__tests__/process-helper-spec.js and 1 other location - About 6 hrs to fix
          src/__tests__/process-helper-spec.js on lines 107..115

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

          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

                  stderr: {
                    on: jest.fn().mockImplementation((event, eventTrigger) => {
                      eventTrigger('blah blah');
                      expect(event).toBe('data');
                      expect(log.debug.mock.calls.length).toBe(2);
          Severity: Major
          Found in src/__tests__/process-helper-spec.js and 1 other location - About 6 hrs to fix
          src/__tests__/process-helper-spec.js on lines 98..106

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

          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

          Jasmine.prototype.interrupt = function (callback) {
          
            log.debug('[chimp][jasmine] interrupting jasmine');
          
            var self = this;
          Severity: Major
          Found in src/lib/jasmine/jasmine.js and 1 other location - About 5 hrs to fix
          src/lib/mocha/mocha.js on lines 129..153

          Duplicated Code

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

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

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

          Tuning

          This issue has a mass of 151.

          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

          Mocha.prototype.interrupt = function (callback) {
          
            log.debug('[chimp][mocha] interrupting mocha');
          
            var self = this;
          Severity: Major
          Found in src/lib/mocha/mocha.js and 1 other location - About 5 hrs to fix
          src/lib/jasmine/jasmine.js on lines 103..127

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

          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 _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

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

          Phantom.prototype.stop = function (callback) {
            var self = this;
          
            if (self.child) {
              log.debug('[chimp][phantom] stopping process');
          Severity: Major
          Found in src/lib/phantom.js and 1 other location - About 5 hrs to fix
          src/lib/chromedriver.js on lines 65..86

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

          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

          Chromedriver.prototype.stop = function (callback) {
              var self = this;
          
              if (self.child) {
                  log.debug('[chimp][chromedriver] stopping process');
          Severity: Major
          Found in src/lib/chromedriver.js and 1 other location - About 5 hrs to fix
          src/lib/phantom.js on lines 57..78

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

          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', 'xit', 'fit',
              'beforeEach', 'afterEach',
              'beforeAll', 'afterAll',
            ].forEach(function (method) {
          Severity: Major
          Found in src/lib/jasmine/jasmine-fiberized-api.js and 1 other location - About 4 hrs to fix
          src/lib/jasmine/jasmine-fiberized-api.js on lines 5..14

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

          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

            ['describe', 'xdescribe', 'fdescribe'].forEach(function (method) {
              const original = context[method];
              context[method] = _.wrap(original, function (fn) {
                const args = Array.prototype.slice.call(arguments, 1);
                if (_.isFunction(_.last(args))) {
          Severity: Major
          Found in src/lib/jasmine/jasmine-fiberized-api.js and 1 other location - About 4 hrs to fix
          src/lib/jasmine/jasmine-fiberized-api.js on lines 16..29

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

          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('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

          Severity
          Category
          Status
          Source
          Language