TheBrainFamily/chimpy

View on GitHub

Showing 136 of 136 total issues

Function killCurrentSession has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

SauceLabsSessionManager.prototype.killCurrentSession = function (callback) {

  var self = this;
  var killSession = function (job) {
    // This will stop the session, causing a 'User terminated' error.
Severity: Minor
Found in src/lib/saucelabs-manager.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 constructor has 39 lines of code (exceeds 25 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

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

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

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 66.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

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

    Duplicated Code

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

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

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

    Tuning

    This issue has a mass of 66.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Function report has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    SimianReporter.prototype.report = function report(jsonCucumberResult, callback) {
      const query = {
        accessToken: this.options.simianAccessToken,
      };
      if (this.options.simianRepositoryId) {
    Severity: Minor
    Found in src/lib/simian-reporter.js - About 1 hr to fix

      Function setupDdp has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var setupDdp = function () {
            log.debug('[chimp][helper] setup DDP');
            if (process.env['chimp.ddp0']) {
              try {
                log.debug('[chimp][helper] connecting via DDP to', process.env['chimp.ddp0']);
      Severity: Minor
      Found in src/lib/chimp-helper.js - About 1 hr to fix

        Function killCurrentSession has 36 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        SessionManager.prototype.killCurrentSession = function (callback) {
        
        
          if (this.options.browser === 'phantomjs') {
            log.debug('[chimp][session-manager] browser is phantomjs, not killing session');
        Severity: Minor
        Found in src/lib/session-manager.js - About 1 hr to fix

          Function _monkeyPatchBrowserSessionManagement has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          SessionManager.prototype._monkeyPatchBrowserSessionManagement = function (browser, sessions) {
          
            log.debug('[chimp][session-manager]', 'monkey patching the browser object');
          
            var callbacker = function () {
          Severity: Minor
          Found in src/lib/session-manager.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 start has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

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

              it('sets the options on the instance when no exceptions are thrown', function () {
                var SessionFactory = require('../lib/session-factory');
                var options = {port: 1234, browser: 'something'};
          
                var session = new SessionFactory(options);
          Severity: Major
          Found in src/__tests__/session-factory-spec.js and 1 other location - About 1 hr to fix
          src/__tests__/session-manager-spec.js on lines 12..19

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

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

          SessionManager.prototype._configureRemote = function (webdriverOptions, remote, callback) {
            var self = this;
          
            log.debug('[chimp][session-manager] creating webdriver remote ');
          
          
          Severity: Minor
          Found in src/lib/session-manager.js - About 1 hr to fix

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

                it('sets the options on the instance when no exceptions are thrown', function () {
                  var SessionManager = require('../lib/session-manager');
                  var options = {port: 1234, browser: 'something'};
            
                  var sessionManager = new SessionManager(options);
            Severity: Major
            Found in src/__tests__/session-manager-spec.js and 1 other location - About 1 hr to fix
            src/__tests__/session-factory-spec.js on lines 8..15

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

            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 35 lines of code (exceeds 25 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

              Function _conditionMessage has 34 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                _conditionMessage(message) {
                  if (this.options.debug) {
                    log.debug(message);
                    return;
                  }
              Severity: Minor
              Found in src/lib/cucumberjs/cucumber.js - About 1 hr to fix

                Function exports has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                module.exports = function (wallaby) {
                
                  var fs = require('fs');
                  var path = require('path');
                  var babel = require('babel-core');
                Severity: Minor
                Found in wallaby.js - About 1 hr to fix

                  Function kill has 34 lines of code (exceeds 25 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

                    Function install has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    Selenium.prototype.install = function (callback) {
                      var ProgressBar = require('progress');
                      var bar;
                      var firstProgress = true;
                    
                    
                    Severity: Minor
                    Found in src/lib/selenium.js - About 1 hr to fix

                      Function killCurrentSession has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      TestingBotSessionManager.prototype.killCurrentSession = function (callback) {
                      
                        this._getJobs(function (err, jobs) {
                          if (jobs && jobs.length) {
                            var job = jobs[0];
                      Severity: Minor
                      Found in src/lib/testingbot-manager.js - About 1 hr to fix

                        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

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

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language