TheBrainFamily/chimpy

View on GitHub

Showing 136 of 136 total issues

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

    request(options, function (error, response) {
      if (!error && response.statusCode === 200) {
        log.debug('[chimp][saucelabs-session-manager]', 'updated session to passing state');
        callback();
      } else {
Severity: Major
Found in src/lib/saucelabs-manager.js and 2 other locations - About 2 hrs to fix
src/lib/browserstack-manager.js on lines 137..145
src/lib/testingbot-manager.js on lines 103..111

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

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

      request(options, function (error, response) {
        if (!error && response.statusCode === 200) {
          log.debug('[chimp][testingbot-session-manager]', 'updated session to passing state');
          callback();
        } else {
Severity: Major
Found in src/lib/testingbot-manager.js and 2 other locations - About 2 hrs to fix
src/lib/browserstack-manager.js on lines 137..145
src/lib/saucelabs-manager.js on lines 111..119

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

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

                this._startBrowserDriver(startBrowserOptions, () => {
                    this._getBrowserVersion(startBrowserOptions, (err, browserVersion) => {
                        this._stopBrowserDriver((err) => {
                            if (err) {
                                log.warn(err);
Severity: Major
Found in src/lib/versions.js and 1 other location - About 2 hrs to fix
src/lib/versions.js on lines 107..116

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

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

                        this._startBrowserDriver(startBrowserOptions, () => {
                            this._getBrowserVersion(startBrowserOptions, (err, browserVersion) => {
                                this._stopBrowserDriver((err) => {
                                    if (err) {
                                        log.warn(err);
Severity: Major
Found in src/lib/versions.js and 1 other location - About 2 hrs to fix
src/lib/versions.js on lines 130..139

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

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

SessionManager.prototype._monkeyPatchBrowserSessionManagement = function (browser, sessions) {

  log.debug('[chimp][session-manager]', 'monkey patching the browser object');

  var callbacker = function () {
Severity: Major
Found in src/lib/session-manager.js - About 2 hrs to fix

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

          Chimp.prototype.watch = function () {
          
            var self = this;
          
            var watchDirectories = [];
          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

                  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

            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

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

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

              Function _setupRoutes has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Chimp.prototype._setupRoutes = function (server) {
                var 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 start has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                  start(callback) {
                    const args = this._getExecOptions(this.options);
                
                    if (!fs.existsSync(this.options.path)) {
                      const infoMessage = `[chimp][cucumber] Directory ${this.options.path} does not exist. Not running`;
                Severity: Minor
                Found in src/lib/cucumberjs/cucumber.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 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                Selenium.prototype.start = function (callback) {
                  var self = this;
                  var port = self.options.port;
                
                  log.debug('[chimp][selenium]', 'Start');
                Severity: Minor
                Found in src/lib/selenium.js - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language