Showing 47 of 72 total issues
Function exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function defaultRelationAccessor(accessor, alias, TargetModel, argOne, argTwo) {
Function defineNestedOperations
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function defineNestedOperations(sourceModel, assocType, targetModel, alias, association) {
Function exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function setRelationAccessor(accessor, alias, TargetModel, associatedObject, options) {
Function exports
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
module.exports = function getRelationAccessor(accessor, alias, TargetModel, findOptions, options) {
Function findTargetModelBeforeCreateSourceModel
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function findTargetModelBeforeCreateSourceModel(as, association, targetModel, values, queryOptions, callback) {
try {
if (values[as] !== undefined && values[as] !== null && values[as].entity === undefined && (typeof values[as] !== 'object' || values[as][targetModel.primaryKey[0]] === undefined)) {
targetModel
.find(typeof values[as] === 'object' ? underscore.clone(values[as]) : { where: { id: values[as] } }, queryOptions)
- 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 hydrateModel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function hydrateModel(findOptions, model, callback) {
var ModelClass = this;
if (model !== null) {
model = new ModelClass(model);
- 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 createTargetModelBeforeSourceModel
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function createTargetModelBeforeSourceModel(as, association, targetModel, instance, values, queryOptions, callback) {
try {
if (values[as] !== undefined && values[as] !== null && values[as].entity === undefined && typeof values[as] === 'object') {
var data = underscore.extend(
typeof values[as] === 'object' ? underscore.clone(values[as]) : { id: values[as] }
- 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"