TheBrainFamily/chimpy

View on GitHub

Showing 131 of 131 total issues

Function watch has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

AutoupdateWatcher.prototype.watch = function (trigger) {
  var self = this;
  self._trigger = trigger;
  self._ddpClient = new DDPClient({
    // All properties optional, defaults shown
Severity: Major
Found in src/lib/ddp-watcher.js - About 2 hrs to fix

    Function getCurrentBrowserVersion has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      this.getCurrentBrowserVersion = (callback) => {
        if (booleanHelper.isTruthy(this.options.browser)) {
          const seleniumOptions = _.clone(this.options.seleniumStandaloneOptions);
          seleniumOptions.port = 1;
    
    
    Severity: Major
    Found in src/lib/versions.js - About 2 hrs to fix

      Function killCurrentSession has 51 lines of code (exceeds 25 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: Major
      Found in src/lib/browserstack-manager.js - About 2 hrs to fix

        Function setupBrowser has 50 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            var setupBrowser = function () {
              log.debug('[chimp][helper] getting browser');
        
              const webdriverioConfigOptions = JSON.parse(process.env['chimp.webdriverio']);
              const webdriverioOptions = merge(
        Severity: Minor
        Found in src/lib/chimp-helper.js - About 2 hrs to fix

          Function watch has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Chimp.prototype.watch = function () {
            const self = this;
          
            let watchDirectories = [];
            if (self.options.watchSource) {
          Severity: Minor
          Found in src/lib/chimp.js - About 1 hr to fix

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

            if (argv.host && ((argv.host.indexOf('sauce') !== -1 || argv.host.indexOf('browserstack') !== -1) || argv.host.indexOf('testingbot') !== -1)) {
              argv.noSessionReuse = true;
            }
            Severity: Major
            Found in src/bin/chimp.js and 1 other location - About 1 hr to fix
            src/lib/session-factory.js on lines 31..47

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

            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

            after(function () {
              if (process.env['chimp.browser'] !== 'phantomjs') {
                log.debug('[chimp][mocha-helper] Ending browser session');
                global.wrapAsync(global.sessionManager.killCurrentSession, global.sessionManager)();
                log.debug('[chimp][mocha-helper] Ended browser sessions');
            Severity: Major
            Found in src/lib/mocha/mocha-helper.js and 1 other location - About 1 hr to fix
            src/lib/jasmine/jasmine-helpers.js on lines 10..16

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

            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

            afterAll(function chimpTeardown() {
              if (process.env['chimp.browser'] !== 'phantomjs') {
                log.debug('[chimp][jasmine-helpers] Ending browser session');
                global.wrapAsync(global.sessionManager.killCurrentSession, global.sessionManager)();
                log.debug('[chimp][jasmine-helpers] Ended browser sessions');
            Severity: Major
            Found in src/lib/jasmine/jasmine-helpers.js and 1 other location - About 1 hr to fix
            src/lib/mocha/mocha-helper.js on lines 14..20

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

            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 (options.host && (options.host.indexOf('browserstack') > -1 || options.host.indexOf('saucelabs') > -1 || options.host.indexOf('testingbot') > -1)) {
            
                      if (!options.user || !options.key) {
                          throw new Error('[chimp][session-manager-factory] options.user and options.key are required');
                    }
            Severity: Major
            Found in src/lib/session-factory.js and 1 other location - About 1 hr to fix
            src/bin/chimp.js on lines 55..57

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

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

            Chimp.prototype.run = function (callback) {
              log.info('\n[chimp] Running...'[DEFAULT_COLOR]);
            
              const self = this;
            
            
            Severity: Minor
            Found in src/lib/chimp.js - About 1 hr to fix

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

              function Chromedriver(options) {
                  if (!options) {
                      throw new Error('options is required');
                  }
              
              
              Severity: Major
              Found in src/lib/chromedriver.js and 1 other location - About 1 hr to fix
              src/lib/phantom.js on lines 11..23

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

              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

              function Phantom(options) {
                if (!options) {
                  throw new Error('options is required');
                }
              
              
              Severity: Major
              Found in src/lib/phantom.js and 1 other location - About 1 hr to fix
              src/lib/chromedriver.js on lines 12..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 71.

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

              Chimp.prototype._setupRoutes = function (server) {
                const self = this;
                server.route({
                  method: 'GET',
                  path: '/run',
              Severity: Minor
              Found in src/lib/chimp.js - About 1 hr to fix

                Function SessionManagerFactory has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                function SessionManagerFactory(options) {
                
                      log.debug('[chimp][session-manager-factory] options are', options);
                
                      if (!options) {
                Severity: Minor
                Found in src/lib/session-factory.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 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

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

                  SimianReporter.prototype.report = function report(jsonCucumberResult, callback) {
                    SimianReporter.reportCallback = callback;
                    const query = {
                      accessToken: this.options.simianAccessToken,
                    };
                  Severity: Minor
                  Found in src/lib/simian-reporter.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 636..640

                    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 614..618

                    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 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
                      Severity
                      Category
                      Status
                      Source
                      Language