Showing 7 of 23 total issues
Function updateLocation
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function updateLocation(req, res, next) {
var MIATARU = req.MIATARU;
var requestConfig = MIATARU.config;
var locations = MIATARU.locations;
Function getLocationHistory
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function getLocationHistory(req, res, next) {
var locationRequest = req.MIATARU.request;
var requestConfig = req.MIATARU.config;
var key = kb.build(locationRequest.device(), KEY_HISTORY);
Function load
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
function load(baseDir, cliArgs) {
cliArgs = cliArgs || {};
if(Object.keys(cliArgs).length > 0) {
delete cliArgs['_'];
- Read upRead up
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
Open
function getLocation(req, res, next) {
var chain = seq();
var requestConfig = req.MIATARU.config;
var response = new models.ResponseLocation();
Function load
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function load(baseDir, cliArgs) {
cliArgs = cliArgs || {};
if(Object.keys(cliArgs).length > 0) {
delete cliArgs['_'];
Function exports
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function(req, res, next) {
req.MIATARU = req.MIATARU || {};
var nextError;
Function RequestConfig
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
function RequestConfig(data) {
data = data || {};
this._enableLocationHistory = data.EnableLocationHistory || null;
this._locationDataRetentionTime = data.LocationDataRetentionTime || null;
- Read upRead up
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"