lib/dispatch/query.js

Summary

Maintainability
F
1 wk
Test Coverage

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 _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 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 _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 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

          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 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 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 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 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 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 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 translateTimeframe has a Cognitive Complexity of 14 (exceeds 5 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: Minor
                    Found in lib/dispatch/query.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

                    Avoid deeply nested control flow statements.
                    Open

                                      if (res.socket.disconnected) {
                                        joola.logger.trace('Removing socket [' + res.socket.id + '] due to disconnection from realtime query [' + queryKey + '].');
                                        delete manager.realtimeQueries[queryKey].sockets[res.socket.id];
                                      } else {
                                        result.realtime = realtimeUID;
                    Severity: Major
                    Found in lib/dispatch/query.js - About 45 mins to fix

                      Avoid too many return statements within this function.
                      Open

                          return {
                            start: new Date(_startdate),
                            end: new Date(_enddate)
                          };
                      Severity: Major
                      Found in lib/dispatch/query.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return {
                              last_n_items: parseInt(m[1], 10)
                            };
                        Severity: Major
                        Found in lib/dispatch/query.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                              return {
                                start: new Date(_startdate),
                                end: new Date(_enddate)
                              };
                          Severity: Major
                          Found in lib/dispatch/query.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                return {
                                  start: new Date(_startdate),
                                  end: new Date(_enddate)
                                };
                            Severity: Major
                            Found in lib/dispatch/query.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                  return {
                                    start: new Date(_startdate),
                                    end: new Date(_enddate)
                                  };
                              Severity: Major
                              Found in lib/dispatch/query.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                    return {
                                      start: new Date(_startdate),
                                      end: new Date(_enddate)
                                    };
                                Severity: Major
                                Found in lib/dispatch/query.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                      return {
                                        start: new Date(_startdate),
                                        end: new Date(_enddate)
                                      };
                                  Severity: Major
                                  Found in lib/dispatch/query.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                              return router.responseSuccess(result, headers, req, res);
                                    Severity: Major
                                    Found in lib/dispatch/query.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                          return {
                                            start: new Date(_startdate),
                                            end: new Date(_enddate)
                                          };
                                      Severity: Major
                                      Found in lib/dispatch/query.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                            return {
                                              start: new Date(_startdate),
                                              end: new Date(_enddate)
                                            };
                                        Severity: Major
                                        Found in lib/dispatch/query.js - About 30 mins to fix

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

                                            if (m && m.length > 0) {
                                          
                                              _startdate.setDate(_startdate.getDate() - (m[1]));
                                          
                                              return {
                                          Severity: Major
                                          Found in lib/dispatch/query.js and 4 other locations - About 1 hr to fix
                                          lib/dispatch/query.js on lines 519..526
                                          lib/dispatch/query.js on lines 529..536
                                          lib/dispatch/query.js on lines 539..546
                                          lib/dispatch/query.js on lines 560..567

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

                                          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 5 locations. Consider refactoring.
                                          Open

                                            if (m && m.length > 0) {
                                              _startdate.setMonth(_startdate.getMonth() - (m[1]));
                                          
                                              return {
                                                start: new Date(_startdate),
                                          Severity: Major
                                          Found in lib/dispatch/query.js and 4 other locations - About 1 hr to fix
                                          lib/dispatch/query.js on lines 519..526
                                          lib/dispatch/query.js on lines 529..536
                                          lib/dispatch/query.js on lines 539..546
                                          lib/dispatch/query.js on lines 549..557

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

                                          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 5 locations. Consider refactoring.
                                          Open

                                            if (m && m.length > 0) {
                                              _startdate.setMinutes(_startdate.getMinutes() - (m[1]));
                                          
                                              return {
                                                start: new Date(_startdate),
                                          Severity: Major
                                          Found in lib/dispatch/query.js and 4 other locations - About 1 hr to fix
                                          lib/dispatch/query.js on lines 519..526
                                          lib/dispatch/query.js on lines 539..546
                                          lib/dispatch/query.js on lines 549..557
                                          lib/dispatch/query.js on lines 560..567

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

                                          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 5 locations. Consider refactoring.
                                          Open

                                            if (m && m.length > 0) {
                                              _startdate.setHours(_startdate.getHours() - (m[1]));
                                          
                                              return {
                                                start: new Date(_startdate),
                                          Severity: Major
                                          Found in lib/dispatch/query.js and 4 other locations - About 1 hr to fix
                                          lib/dispatch/query.js on lines 519..526
                                          lib/dispatch/query.js on lines 529..536
                                          lib/dispatch/query.js on lines 549..557
                                          lib/dispatch/query.js on lines 560..567

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

                                          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 5 locations. Consider refactoring.
                                          Open

                                            if (m && m.length > 0) {
                                          
                                              _startdate.setSeconds(_startdate.getSeconds() - (m[1]));
                                              return {
                                                start: new Date(_startdate),
                                          Severity: Major
                                          Found in lib/dispatch/query.js and 4 other locations - About 1 hr to fix
                                          lib/dispatch/query.js on lines 529..536
                                          lib/dispatch/query.js on lines 539..546
                                          lib/dispatch/query.js on lines 549..557
                                          lib/dispatch/query.js on lines 560..567

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

                                          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

                                              results.metrics.forEach(function(m) {
                                                if (m.collection && m.collection.key)
                                                  m.collection = m.collection.key;
                                              });
                                          Severity: Major
                                          Found in lib/dispatch/query.js and 1 other location - About 1 hr to fix
                                          lib/dispatch/query.js on lines 763..766

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

                                          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

                                              results.dimensions.forEach(function(d) {
                                                if (d.collection && d.collection.key)
                                                  d.collection = d.collection.key;
                                              });
                                          Severity: Major
                                          Found in lib/dispatch/query.js and 1 other location - About 1 hr to fix
                                          lib/dispatch/query.js on lines 767..770

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

                                          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

                                                results.queryplan.query.timeframe.end = new Date(results.queryplan.query.timeframe.end).toISOString();
                                          Severity: Minor
                                          Found in lib/dispatch/query.js and 1 other location - About 45 mins to fix
                                          lib/dispatch/query.js on lines 759..759

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

                                          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

                                                      return router.responseError(500, new router.ErrorTemplate('Failed to route action [' + 'fetch' + ']: ' + (typeof(err) === 'object' ? err.message : err)), req, res);
                                          Severity: Minor
                                          Found in lib/dispatch/query.js and 1 other location - About 45 mins to fix
                                          lib/dispatch/beacon.js on lines 314..314

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

                                          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

                                                results.queryplan.query.timeframe.start = new Date(results.queryplan.query.timeframe.start).toISOString();
                                          Severity: Minor
                                          Found in lib/dispatch/query.js and 1 other location - About 45 mins to fix
                                          lib/dispatch/query.js on lines 760..760

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

                                          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 (metric.key.indexOf('.') > -1)
                                                  metric.key = metric.key.replace(/\./ig, '_');
                                          Severity: Minor
                                          Found in lib/dispatch/query.js and 1 other location - About 35 mins to fix
                                          lib/dispatch/query.js on lines 126..127

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

                                          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 (dimension.key.indexOf('.') > -1)
                                                dimension.key = dimension.key.replace(/\./ig, '_');
                                          Severity: Minor
                                          Found in lib/dispatch/query.js and 1 other location - About 35 mins to fix
                                          lib/dispatch/query.js on lines 196..197

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

                                          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 (typeof query.timeframe.end === 'string')
                                                  query.timeframe.end = new Date(query.timeframe.end);
                                          Severity: Minor
                                          Found in lib/dispatch/query.js and 1 other location - About 30 mins to fix
                                          lib/dispatch/query.js on lines 277..278

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

                                          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 (typeof query.timeframe.start === 'string')
                                                  query.timeframe.start = new Date(query.timeframe.start);
                                          Severity: Minor
                                          Found in lib/dispatch/query.js and 1 other location - About 30 mins to fix
                                          lib/dispatch/query.js on lines 279..280

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

                                          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

                                          There are no issues that match your filters.

                                          Category
                                          Status