Showing 162 of 258 total issues

Function http has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    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 2 hrs to fix

    Function setup has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    exports.setup = function(app) {
      //main entry point
    
      app.get('/ip', function(req, res) {
        res.setHeader('Content-Type', 'application/javascript');
    Severity: Major
    Found in lib/webserver/routes/index.js - About 2 hrs to fix

      Function https has 62 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          self.https = https.createServer(secureOptions, app).listen(self.options.secureport, 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 2 hrs to fix

        Function parseDimension has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

        manager.parseDimension = function(context, d, callback) {
          var col;
          var dimension = {};
        
          if (!d)
        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 run has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          run: function (context, workspace, collection, callback) {
            if (typeof collection === 'function') {
              callback = collection;
              collection = null;
            }
        Severity: Major
        Found in lib/dispatch/metrics.js - About 2 hrs to fix

          Function run has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            run: function (context, workspace, collection, callback) {
              if (typeof collection === 'function') {
                callback = collection;
                collection = null;
              }
          Severity: Major
          Found in lib/dispatch/dimensions.js - About 2 hrs to fix

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

            datastore.init = function(callback) {
              //find out what datastores we have in config
              var stores = joola.config.get('store:datastore');
              if (!stores)
                return callback(null);
            Severity: Major
            Found in lib/common/datastore.js - About 2 hrs to fix

              Function checkRateLimits has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              auth.checkRateLimits = function (req, res, callback) {
                var limitKey;
                if (!req.user) {
                  limitKey = req.connection.remoteAddress;
                  req.limits = {
              Severity: Major
              Found in lib/common/auth.js - About 2 hrs to fix

                Function validateAction has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                auth.validateAction = function (action, req, res, callback) {
                  if (req.method == 'OPTIONS')
                    return process.nextTick(function () {
                      return callback(null, true);
                    });
                Severity: Major
                Found in lib/common/auth.js - About 2 hrs to fix

                  Function processRequest has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  dispatch.processRequest = function (message, headers) {
                    message = message[0];
                    message = JSON.parse(message).message;
                  
                    var _result;
                  Severity: Major
                  Found in lib/dispatch/index.js - About 2 hrs to fix

                    Function once has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                    dispatch.once = function (channel, callback, next) {
                      callback = callback || function () {
                      };
                    
                      var exists = _.find(dispatch.listeners, function (listener) {
                    Severity: Minor
                    Found in lib/dispatch/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

                    Function run has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      run: function(context, workspace, collection, documents, options, callback) {
                    
                        if (typeof options === 'function') {
                          callback = options;
                          options = {};
                    Severity: Major
                    Found in lib/dispatch/beacon.js - About 2 hrs to fix

                      Function ZKDiscoveryProvider has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function ZKDiscoveryProvider(options, helpers, callback) {
                        if (!(this instanceof ZKDiscoveryProvider)) return new ZKDiscoveryProvider(options, helpers, callback);
                        callback = callback || function () {
                        };
                        var self = this;
                      Severity: Major
                      Found in lib/discovery/providers/zookeeper.js - About 2 hrs to fix

                        Function generateToken has 55 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        auth.generateToken = function (req, user, callback) {
                          /* istanbul ignore if */
                          if (!callback) {
                            callback = user;
                            user = req;
                        Severity: Major
                        Found in lib/common/auth.js - About 2 hrs to fix

                          File index.js has 258 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/common/index.js - About 2 hrs to fix

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

                            manager.parseDimension = function(context, d, callback) {
                              var col;
                              var dimension = {};
                            
                              if (!d)
                            Severity: Major
                            Found in lib/dispatch/query.js - About 2 hrs to fix

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

                              etl.load = function(context, workspace, collection, documents, options, callback) {
                                joola.dispatch.collections.metadata(context, workspace, collection, ce.clone(documents[0]), function(err, meta, _collection) {
                                  if (err)
                                    return callback(err);
                              
                              
                              Severity: Major
                              Found in lib/dispatch/beacon.js - About 2 hrs to fix

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

                                joola.nodeState = function () {
                                  var hostname = joola.hostname = os.hostname();
                                  var osDetails = {
                                    type: os.type(),
                                    platform: os.platform(),
                                Severity: Major
                                Found in lib/common/globals.js - About 2 hrs to fix

                                  Function run has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    run: function(context, options, callback) {
                                      callback = callback || function() {};
                                      var wasArray = true;
                                      if (!Array.isArray(options)) {
                                        options = [options];
                                  Severity: Major
                                  Found in lib/dispatch/query.js - About 2 hrs to fix

                                    Function getUserByToken has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    auth.getUserByToken = function (token, callback) {
                                      callback = callback || function () {
                                      };
                                      if (!token)
                                        return process.nextTick(function () {
                                    Severity: Major
                                    Found in lib/common/auth.js - About 2 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language