TheBrainFamily/chimpy

View on GitHub
src/lib/chimp-helper.js

Summary

Maintainability
D
2 days
Test Coverage

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

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

            var initSingleBrowser = function (browser) {
              log.debug('[chimp][helper] init browser');
              log.debug('[chimp][helper] init browser callback');
        
              browser.screenshotsCount = 0;
        Severity: Minor
        Found in src/lib/chimp-helper.js - About 1 hr to fix

          Function setupGlobals has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            setupGlobals: function () {
              global.wrapAsync = wrapAsync;
              global.wrapAsyncObject = wrapAsyncObject;
          
              // give users access the request module
          Severity: Minor
          Found in src/lib/chimp-helper.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 addServerExecute has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var addServerExecute = function (ddpInstance) {
                ddpInstance.execute = function (func) {
                  var args = Array.prototype.slice.call(arguments, 1);
                  var result;
                  var timeout = parseInt(process.env['chimp.serverExecuteTimeout']) || 10000;
          Severity: Minor
          Found in src/lib/chimp-helper.js - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status