Fannon/cacheur

View on GitHub

Showing 28 of 38 total issues

Function onRetrieval has a Cognitive Complexity of 107 (exceeds 5 allowed). Consider refactoring.
Open

exports.onRetrieval = function(err, data, settings, time) {

    var id = settings.id;

    // Overwrite log function to additionally log to file
Severity: Minor
Found in src/fetch.js - About 2 days 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 simplifiedAskCollection has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
Open

exports.simplifiedAskCollection = function(obj, settings) {

    var result = [];
    var index = 0;
    var transformSettings = settings.transformers.simplifiedAskCollection;
Severity: Minor
Found in src/transform.js - About 5 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 onRetrieval has 125 lines of code (exceeds 25 allowed). Consider refactoring.
Open

exports.onRetrieval = function(err, data, settings, time) {

    var id = settings.id;

    // Overwrite log function to additionally log to file
Severity: Major
Found in src/fetch.js - About 5 hrs to fix

    File fetch.js has 364 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    //////////////////////////////////////////
    // REQUIREMENTS                         //
    //////////////////////////////////////////
    
    var _ = require('lodash');
    Severity: Minor
    Found in src/fetch.js - About 4 hrs to fix

      Function registerRoutes has 115 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      exports.registerRoutes = function() {
      
          var ws = exports.webserver;
          var ds = exports.dataStore;
      
      
      Severity: Major
      Found in src/webServer.js - About 4 hrs to fix

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

        exports.read = function(dir) {
        
            var fileList = fs.readdirSync(dir);
        
            var returnObj = {
        Severity: Minor
        Found in src/readProject.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 objDiff has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

        exports.objDiff = function(settings, oldData, newData) {
        
            var diff = {
                startTime: settings.startTime,
                lastChange: settings.statistics.lastChange || null,
        Severity: Minor
        Found in src/fetch.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 exports has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        module.exports = function(grunt) {
        
            // Show elapsed time at the end
            require('time-grunt')(grunt);
            // Load all grunt tasks
        Severity: Major
        Found in Gruntfile.js - About 2 hrs to fix

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

          exports.objDiff = function(settings, oldData, newData) {
          
              var diff = {
                  startTime: settings.startTime,
                  lastChange: settings.statistics.lastChange || null,
          Severity: Major
          Found in src/fetch.js - About 2 hrs to fix

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

            exports.simplifiedAsk = function(obj, settings) {
            
                var result = {};
                var transformSettings = settings.transformers.simplifiedAsk;
            
            
            Severity: Minor
            Found in src/transform.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 fetchAskQuery has 49 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            exports.fetchAskQuery = function(settings, callback) {
            
                var id = settings.id;
            
                // Overwrite log function to additionally log to file
            Severity: Minor
            Found in src/fetch.js - About 1 hr to fix

              Function simplifiedAskCollection has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              exports.simplifiedAskCollection = function(obj, settings) {
              
                  var result = [];
                  var index = 0;
                  var transformSettings = settings.transformers.simplifiedAskCollection;
              Severity: Minor
              Found in src/transform.js - About 1 hr to fix

                Function getCacheInfo has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                exports.getCacheInfo = function(id, host) {
                
                    var ds = exports.dataStore;
                    var r = exports.requestSettings[id];
                
                
                Severity: Minor
                Found in src/webServer.js - About 1 hr to fix

                  Function getCacheInfo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                  exports.getCacheInfo = function(id, host) {
                  
                      var ds = exports.dataStore;
                      var r = exports.requestSettings[id];
                  
                  
                  Severity: Minor
                  Found in src/webServer.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 processRequests has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                  exports.processRequests = function(requestSettings) {
                  
                      // Iterate over all requests, calculate their settings and run them in the defined intervals
                      for (var requestName in requestSettings) {
                  
                  
                  Severity: Minor
                  Found in src/main.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 read has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  exports.read = function(dir) {
                  
                      var fileList = fs.readdirSync(dir);
                  
                      var returnObj = {
                  Severity: Minor
                  Found in src/readProject.js - About 1 hr to fix

                    Function processRequests has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    exports.processRequests = function(requestSettings) {
                    
                        // Iterate over all requests, calculate their settings and run them in the defined intervals
                        for (var requestName in requestSettings) {
                    
                    
                    Severity: Minor
                    Found in src/main.js - About 1 hr to fix

                      Function sync has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      exports.sync = function(settings, diff) {
                      
                          var i;
                          var id;
                          var bulkJobs = '';
                      Severity: Minor
                      Found in src/target/elasticsearchTarget.js - About 1 hr to fix

                        Function fetchGeneric has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        exports.fetchGeneric = function(settings, callback) {
                        
                            // Overwrite log function to additionally log to file
                            log = function(msg) {
                                semlog.log(msg);
                        Severity: Minor
                        Found in src/fetch.js - About 1 hr to fix

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

                          exports.init = function(settings, callback) {
                          
                              var indexId = 'cacheur_' + settings.id.toLowerCase();
                          
                              var elSettings = {
                          Severity: Minor
                          Found in src/target/elasticsearchTarget.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language