Showing 65 of 143 total issues
Avoid deeply nested control flow statements. Open
if ( one ) {
query.limit(1);
}
Avoid deeply nested control flow statements. Open
if ( one ) {
debug("creating just one?", m[0]);
return model._createDocument(m[0]);
}
Function default
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function(type) {
if(!type) {
throw new Error('Type is not defined');
} else if(type.isSchemaType) {
return type;
- 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
Avoid deeply nested control flow statements. Open
if ( one ) {
query.limit(1);
}
Avoid deeply nested control flow statements. Open
if ( one ) {
return Promise.resolve(model._createDocument(m[0]));
}
Function toJSON
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
toJSON(options) {
var json = {};
options = options || {};
- 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
Avoid deeply nested control flow statements. Open
if ( fn ) {
p = p.then(fn);
}
Function _computeClassName
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_computeClassName(data, prop) {
var schemaType = prop.schemaType;
var options = prop.options;
var className = data._className;
var type = schemaType.getDbType(options);
- 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
Avoid deeply nested control flow statements. Open
if ( "link" !== rel.linkType ) {
if ( rel.in ) {
reverseCond = "out";
} else if ( rel.out ) {
reverseCond = "in";
Avoid deeply nested control flow statements. Open
if ( id._id ) {
id = id._id;
}
Function constructor
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
constructor (name, schema, connection, options, callback) {
super()
if(!name) {
throw new Error('Model name is not defined');
}
- 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 index
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
index(properties, options) {
options = options || {};
if(typeof properties === 'string') {
properties = { [properties]: 1 };
- 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 _serialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
_serialize(value) {
var options = this.options;
var val = String(value);
if(options.enum && options.enum.indexOf(val) === -1) {
- 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 condExec
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
condExec(conditions, callback) {
if(typeof conditions === 'function') {
callback = conditions;
conditions = void 0;
}
- 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
Avoid too many return
statements within this function. Open
return this;
Avoid too many return
statements within this function. Open
return BooleanType;
Avoid too many return
statements within this function. Open
return DateType;
Avoid too many return
statements within this function. Open
return data.get(newPath);
Avoid too many return
statements within this function. Open
return NumberType;
Avoid too many return
statements within this function. Open
return propertyName + ' ' + operator + ' ' + param;