Showing 6 of 10 total issues
File jsondb.js
has 279 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
var _ = require('lodash');
var utils = require('./utils');
var file = require('./file');
Function save
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
JsonDB.prototype.save = function(objs, identical, write){
if(!_.isBoolean(write)) write = true;
if(!_.isBoolean(identical)) identical = false;
if(_.isFunction(objs)) objs = objs();
- 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 _updateMany
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
JsonDB.prototype._updateMany = function(query, update, identical, write){
if(this.object.data === undefined) return false;
if(!_.isBoolean(write)) write = true;
if(_.isPlainObject(query)){
Function _updateMany
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
JsonDB.prototype._updateMany = function(query, update, identical, write){
if(this.object.data === undefined) return false;
if(!_.isBoolean(write)) write = true;
if(_.isPlainObject(query)){
- 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 _updateOne
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
JsonDB.prototype._updateOne = function(query, update, identical, write){
if(this.object.data === undefined) return false;
if(!_.isBoolean(write)) write = true;
if(_.isNumber(query)) query = {id: query};
- 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 setProp
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
JsonDB.prototype.setProp = function(prop, value){
var deepAccess = this.object;
var propArr = prop.split(".");
while(propArr.length){
var deepProp = propArr.shift();
- 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"