Showing 156 of 357 total issues
Avoid deeply nested control flow statements. Open
if (_.isNull(item)){
throw flaverr('E_CONSTRAINT_NOT_USABLE', new Error(
'Got unsupported value (`null`) in a `nin` ("not in") modifier array. Please use `or: [{ '+constraintTarget+': { \'!=\': null }, ...]` instead.'
));
}//-•
Avoid deeply nested control flow statements. Open
switch (e.code) {
case 'E_VALUE_NOT_USABLE': throw flaverr('E_CONSTRAINT_NOT_USABLE', new Error('Invalid item within `nin` ("not in") modifier array. '+e.message));
default: throw e;
}
Avoid deeply nested control flow statements. Open
if (!ThroughWLModel.attributes[attrDef.via].model) {
throw new Error('Consistency violation: The referenced attribute (`'+attrName+'`, from model `'+modelIdentity+'`) is a "through" association, but its specified `via` ('+attrDef.via+'`) corresponds with an unexpected attribute on the junction model (`'+attrDef.through+'`). The attribute referenced by `via` should be a singular ("model") association, but instead, got: '+util.inspect(ThroughWLModel.attributes[attrDef.via],{depth: 5})+'');
}
Avoid deeply nested control flow statements. Open
if (process.env.NODE_ENV === 'production') {
console.warn('\n'+
'Warning: Attempting to populate `'+populateAttrName+'` with the specified subcriteria,\n'+
'but this MAY NOT BE SAFE, depending on the number of records stored in your models.\n'+
'Since this association does not support optimized populates (i.e. it spans multiple '+'\n'+
Avoid deeply nested control flow statements. Open
if (_.isNull(value)) {
// We allow `null` for singular associations UNLESS they are required.
if (correspondingAttrDef.required) {
throw flaverr('E_REQUIRED', new Error(
Avoid deeply nested control flow statements. Open
if (_.isUndefined(record[attrName])) {
}
// If the value for this singular association came back as an array, then
// that might be ok too-- it probably means that the association was populated.
else if (_.isArray(record[attrName])) {
Function isExclusive
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function isExclusive(attrName, modelIdentity, orm) {
if (!_.isString(attrName)) {
throw new Error('Consistency violation: Must specify `attrName` as a string. But instead, got: '+util.inspect(attrName, {depth:5})+'');
}
- 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
Consider simplifying this complex logical expression. Open
else if (correspondingAttrDef.model) {
// If `null` was specified, then it _might_ be OK.
if (_.isNull(value)) {
Consider simplifying this complex logical expression. Open
if (s3Q.method === 'find' || s3Q.method === 'findOne') {
s3Q.method = 'find';
// ╔╗ ╦ ╦╦╦ ╔╦╗ ┬┌─┐┬┌┐┌ ┬┌┐┌┌─┐┌┬┐┬─┐┬ ┬┌─┐┌┬┐┬┌─┐┌┐┌┌─┐
// ╠╩╗║ ║║║ ║║ ││ │││││ ││││└─┐ │ ├┬┘│ ││ │ ││ ││││└─┐
Function exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function forgeAdapterError(err, omen, adapterMethodName, modelIdentity, orm){
Function exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function normalizeValueToSet(value, supposedAttrName, modelIdentity, orm, meta) {
Function exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function normalizeConstraint (constraintRhs, constraintTarget, modelIdentity, orm, meta){
Function exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function normalizeNewRecord(newRecord, modelIdentity, orm, currentTimestamp, meta) {
Function normalizeNewRecord
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function normalizeNewRecord(newRecord, modelIdentity, orm, currentTimestamp, meta) {
// Tolerate this being left undefined by inferring a reasonable default.
// Note that we can't bail early, because we need to check for more stuff
// (there might be required attrs!)
- 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 normalizeSortClause
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function normalizeSortClause(sortClause, modelIdentity, orm, meta) {
// Look up the Waterline model for this query.
// > This is so that we can reference the original model definition.
var WLModel = getModel(modelIdentity, orm);
- 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
} catch (e) { return done(e); }
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return proceed(undefined, transformedRecords);
Avoid too many return
statements within this function. Open
if (query.targetRecordIds.length === 0) { return proceed(new Error('Consistency violation: No target record ids-- should never have been possible, because this query should have been halted when it was being forged at stage 2.')); }
Avoid too many return
statements within this function. Open
} catch (e) { return done(e); }