Showing 162 of 258 total issues

Function handleSocketIOConnection has 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var handleSocketIOConnection = function(socket) {
    joola.connectCounter++;

    socket.on('error', function(err) {
      joola.events.emit('event_end');
Severity: Major
Found in lib/webserver/index.js - About 3 hrs to fix

    Function _route has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

      _route: function(req, res) {
        var _params = {}; //req.parsed;
        var context = {};
        context.user = req.user;
        _params.workspace = context.user.workspace;
    Severity: Minor
    Found in lib/dispatch/beacon.js - About 3 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

    Function parse has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
    Open

    manager.parse = function(context, options, callback) {
      var query = joola.common.extend({}, options);
    
      if (!query.dimensions)
        query.dimensions = [];
    Severity: Minor
    Found in lib/dispatch/query.js - About 3 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

    Function onevent has 87 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        socket.onevent = function(packet) {
          var d = domain.create();
          var req = {};
          var res = {};
    
    
    Severity: Major
    Found in lib/webserver/index.js - About 3 hrs to fix

      Function startHTTP has 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var startHTTP = function(callback) {
          self.http = http.createServer(app).listen(self.options.port, self.options.bind || '0.0.0.0', function(err) {
            /* istanbul ignore if */
            if (err)
              return callback(err);
      Severity: Major
      Found in lib/webserver/index.js - About 3 hrs to fix

        Function init has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        config.init = function(callback) {
          var self = this;
          config.initialized = false;
          //base config object, following the require config has been parsed and available for the local node. May differ from central.
          config._config = require('config');
        Severity: Major
        Found in lib/discovery/index.js - About 3 hrs to fix

          Function init has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

          dispatch.init = function (callback) {
            try {
              var self = dispatch;
          
              self.namespace = 'dispatch';
          Severity: Minor
          Found in lib/dispatch/index.js - About 3 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

          Function request has 80 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var request = function(firstRun, callback) {
                //_params.options.timeframe.end.setMilliseconds(0);
                if (!firstRun && lastQueryEndDate && timestampDimension) {
                  _params.options[0].timeframe_force_start = lastQueryEndDate;
          
          
          Severity: Major
          Found in lib/dispatch/query.js - About 3 hrs to fix

            Function parse has 78 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            manager.parse = function(context, options, callback) {
              var query = joola.common.extend({}, options);
            
              if (!query.dimensions)
                query.dimensions = [];
            Severity: Major
            Found in lib/dispatch/query.js - About 3 hrs to fix

              Function sanitize has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

              common.sanitize = function (obj, proto, leavePrivate) {
                var cleanup = function (elem) {
                  var result = {};
                  Object.keys(elem).forEach(function (key) {
                    if (!leavePrivate) {
              Severity: Minor
              Found in lib/common/index.js - About 3 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

              File system.js has 294 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              /**
               *  @title joola
               *  @overview the open-source data analytics framework
               *  @copyright Joola Smart Solutions, Ltd. <info@joo.la>
               *  @license GPL-3.0+ <http://spdx.org/licenses/GPL-3.0+>
              Severity: Minor
              Found in lib/dispatch/system.js - About 3 hrs to fix

                Function router has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.router = function(req, res, next) {
                  //check the request should be terminated, signaled by prior middleware
                  /* istanbul ignore if */
                  if (req.terminate)
                    return res.end();
                Severity: Major
                Found in lib/webserver/routes/index.js - About 2 hrs to fix

                  Function walkObject has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        var walkObject = function (_shadow, obj) {
                          try {
                            Object.keys(obj).forEach(function (key) {
                  
                              var elem = obj[key];
                  Severity: Major
                  Found in lib/dispatch/collections.js - About 2 hrs to fix

                    Function stompConnect has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          var stompConnect = function () {
                            var stompArgs = {
                              host: stompSettings.host,
                              port: stompSettings.port,
                              login: stompSettings.user,
                    Severity: Major
                    Found in lib/dispatch/index.js - About 2 hrs to fix

                      Function validateToken has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                      auth.validateToken = function (req, token, APIToken, callback) {
                        if (!callback) {
                          callback = APIToken;
                          APIToken = token;
                          token = req;
                      Severity: Minor
                      Found in lib/common/auth.js - About 2 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

                      Function parseMetric has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                      Open

                      manager.parseMetric = function(context, m, callback) {
                        var col;
                        var metric = {};
                        var metricIndex = m.index;
                      
                      
                      Severity: Minor
                      Found in lib/dispatch/query.js - About 2 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

                      Function validateToken has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      auth.validateToken = function (req, token, APIToken, callback) {
                        if (!callback) {
                          callback = APIToken;
                          APIToken = token;
                          token = req;
                      Severity: Major
                      Found in lib/common/auth.js - About 2 hrs to fix

                        Function parseMetric has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        manager.parseMetric = function(context, m, callback) {
                          var col;
                          var metric = {};
                          var metricIndex = m.index;
                        
                        
                        Severity: Major
                        Found in lib/dispatch/query.js - About 2 hrs to fix

                          Function middleware has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                          Open

                          auth.middleware = function (req, res, next) {
                            var debug = {};
                            var parts = url.parse(req.url);
                          
                            //TODO: Add header to SDK
                          Severity: Minor
                          Found in lib/common/auth.js - About 2 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

                          Function flatGetSet has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                          Open

                          common.flatGetSet = function (obj, is, value) {
                            if (typeof is == 'string') {
                              return common.flatGetSet(obj, is.split('.'), value);
                            }
                            else if (is.length == 1 && value !== undefined) {
                          Severity: Minor
                          Found in lib/common/index.js - About 2 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

                          Severity
                          Category
                          Status
                          Source
                          Language