miataru/miataru-server

View on GitHub

Showing 7 of 23 total issues

Function updateLocation has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function updateLocation(req, res, next) {
    var MIATARU = req.MIATARU;
    var requestConfig = MIATARU.config;
    var locations = MIATARU.locations;

Severity: Minor
Found in lib/routes/location/v1/location.js - About 1 hr to fix

    Function getLocationHistory has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getLocationHistory(req, res, next) {
        var locationRequest = req.MIATARU.request;
        var requestConfig = req.MIATARU.config;
        var key = kb.build(locationRequest.device(), KEY_HISTORY);
    
    
    Severity: Minor
    Found in lib/routes/location/v1/location.js - About 1 hr to fix

      Function load has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      function load(baseDir, cliArgs) {
          cliArgs = cliArgs || {};
      
          if(Object.keys(cliArgs).length > 0) {
              delete cliArgs['_'];
      Severity: Minor
      Found in lib/utils/configurationLoader.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 getLocation has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getLocation(req, res, next) {
          var chain = seq();
              var requestConfig = req.MIATARU.config;
          var response = new models.ResponseLocation();
      
      
      Severity: Minor
      Found in lib/routes/location/v1/location.js - About 1 hr to fix

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

        function load(baseDir, cliArgs) {
            cliArgs = cliArgs || {};
        
            if(Object.keys(cliArgs).length > 0) {
                delete cliArgs['_'];
        Severity: Minor
        Found in lib/utils/configurationLoader.js - About 1 hr to fix

          Function exports has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          module.exports = function(req, res, next) {
              req.MIATARU = req.MIATARU || {};
          
              var nextError;
          
          
          Severity: Minor
          Found in lib/routes/location/v1/inputParser.js - About 1 hr to fix

            Function RequestConfig has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            function RequestConfig(data) {
                data = data || {};
            
                this._enableLocationHistory = data.EnableLocationHistory || null;
                this._locationDataRetentionTime = data.LocationDataRetentionTime || null;
            Severity: Minor
            Found in lib/models/RequestConfig.js - About 35 mins 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