Showing 162 of 258 total issues

File query.js has 877 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: Major
Found in lib/dispatch/query.js - About 2 days to fix

    Function start has 424 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    webserver.start = function(options, callback) {
      var self = webserver;
    
      if (options.webserver_app) {
        joola.logger.warn('Using an external WebServer application.');
    Severity: Major
    Found in lib/webserver/index.js - About 2 days to fix

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

        _route: function(req, res) {
          var _token = req.token;
          var lastQueryEndDate;
          var timestampDimension;
          var _params = {
      Severity: Minor
      Found in lib/dispatch/query.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 start has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
      Open

      webserver.start = function(options, callback) {
        var self = webserver;
      
        if (options.webserver_app) {
          joola.logger.warn('Using an external WebServer application.');
      Severity: Minor
      Found in lib/webserver/index.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

      File auth.js has 544 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /**
       *  @title joola/lib/common/auth
       *  @overview Provides authentication functionality across the framework.
       *  @description
       *  The `auth` module and middleware manages the entire flow relating to authentication, for example: login and token validation.
      Severity: Major
      Found in lib/common/auth.js - About 1 day to fix

        File index.js has 540 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: Major
        Found in lib/dispatch/index.js - About 1 day to fix

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

          dispatch.init = function (callback) {
            try {
              var self = dispatch;
          
              self.namespace = 'dispatch';
          Severity: Major
          Found in lib/dispatch/index.js - About 7 hrs to fix

            File index.js has 474 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/webserver/index.js - About 7 hrs to fix

              Function translateTimeframe has 178 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              manager.translateTimeframe = function(timeframe, interval) {
                var _enddate = new Date();
                //_enddate.setMilliseconds(0);
                //_enddate.setSeconds(_enddate.getSeconds() - 1);
                var _startdate = new Date(_enddate);
              Severity: Major
              Found in lib/dispatch/query.js - About 7 hrs to fix

                Function run has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
                Open

                  run: function (context, workspace, collection, document, callback) {
                    callback = callback || function () {
                    };
                
                    if (context.user.workspace !== workspace && context.user.permissions.indexOf('superuser') === -1) {
                Severity: Minor
                Found in lib/dispatch/collections.js - About 6 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 _route has 152 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  _route: function(req, res) {
                    var _token = req.token;
                    var lastQueryEndDate;
                    var timestampDimension;
                    var _params = {
                Severity: Major
                Found in lib/dispatch/query.js - About 6 hrs to fix

                  Function verify has 145 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  etl.verify = function(context, workspace, collection, documents, callback) {
                    var _document;
                    if (!Array.isArray(documents))
                      documents = [documents];
                  
                  
                  Severity: Major
                  Found in lib/dispatch/beacon.js - About 5 hrs to fix

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

                    joola.init = function (options, callback) {
                      /* istanbul ignore if */
                      if (typeof callback !== 'function')
                        callback = function () {
                        };
                    Severity: Major
                    Found in lib/joola.js - About 5 hrs to fix

                      File beacon.js has 370 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/beacon.js - About 4 hrs to fix

                        Function formatResults has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        manager.formatResults = function(results, callback) {
                          var query = results.queryplan.query;
                          results.documents = results.documents || [];
                        
                          results.dimensions = results.dimensions || query.dimensions;
                        Severity: Major
                        Found in lib/dispatch/query.js - About 4 hrs to fix

                          File collections.js has 361 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          /**
                           *  @title joola.collections
                           *  @description
                           *  joola uses the concept of `collections` to organize documents into logical sections.
                           *  [[Collections]] include definitions on metrics, dimensions and other attributes. that instruct joola on how to
                          Severity: Minor
                          Found in lib/dispatch/collections.js - About 4 hrs to fix

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

                              run: function (context, workspace, collection, document, callback) {
                                callback = callback || function () {
                                };
                            
                                if (context.user.workspace !== workspace && context.user.permissions.indexOf('superuser') === -1) {
                            Severity: Major
                            Found in lib/dispatch/collections.js - About 4 hrs to fix

                              Function startHTTPS has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                var startHTTPS = function(callback) {
                                  var secureOptions;
                              
                                  joola.logger.debug('Loading SSL certificates: ' + self.options.keyfile + ', ' + self.options.certfile);
                                  /* istanbul ignore if */
                              Severity: Major
                              Found in lib/webserver/index.js - About 4 hrs to fix

                                File users.js has 347 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                /**
                                 *  @title joola/lib/dispatch/users
                                 *  @overview Provides user management functionality across the framework.
                                 *  @description
                                 *  The `users` dispatch manages the entire flow relating to users, for example: listing or adding a user.
                                Severity: Minor
                                Found in lib/dispatch/users.js - About 4 hrs to fix

                                  Function middleware has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  auth.middleware = function (req, res, next) {
                                    var debug = {};
                                    var parts = url.parse(req.url);
                                  
                                    //TODO: Add header to SDK
                                  Severity: Major
                                  Found in lib/common/auth.js - About 4 hrs to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language