Showing 39 of 148 total issues
Function softDelete
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function softDelete(callback) {
if(this[this.primaryKey]) {
flowsync.series([
(next) => {
this[symbols.callDeep]("delete", (associationDetails) => {
Function toString
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
toString() {
const _ = privateData(this);
let chainString = _.ModelConstructor.name;
Function performValidationsForAttribute
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const performValidationsForAttribute = (attributeName, done) => {
const attributeValidations = _.validations[attributeName];
const performValidation = (validation, returnValue) => {
const validator = validation.validator;
Function callDatabase
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
[callDatabase](callback) {
const _ = privateData(this);
this[validateDependencies]();
Function results
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
results(callbackOrMockValue) {
const _ = privateData(this);
if (_.isMockDefinition) {
const mockValue = callbackOrMockValue;
- 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 fetch
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
fetch(callback) {
function processWhereCondition(value) {
if (typeof value === "string") {
const snakeCasedValue = inflect(value).snake.toString();
return snakeCasedValue;
- 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 argumentsEqual
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
[argumentsEqual](argumentsA, argumentsB) {
if (argumentsA === argumentsB) {
return true;
} else {
if (argumentsA.length === argumentsB.length) {
Function save
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function save(callback) {
flowsync.series([
(next) => {
this.beforeValidation(next);
},
Function equalTo
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
equalTo(query) {
const ourChain = this.chain;
const theirChain = query.chain;
let isEqual = true;
Function push
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
push(...models) {
models.forEach(model => {
if (this.indexOf(model) === -1) {
if(this.association) {
super.push(model);
Avoid deeply nested control flow statements. Open
if (this[argumentsEqual](ourArguments, theirArguments)) {
hasMatchingLink = true;
break;
}
Function fetchWhere
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function fetchWhere(modelClass, key, conditionType, ids, target, callback) {
Function fetchByHasOne
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function fetchByHasOne(associationName, associations, callback) {
const modelFinder = new ModelFinder(this.database);
const association = associations[associationName];
const ModelClass = association.constructor;
- 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 (attributeName !== this.primaryKey) {
updateAttributes[attributeName] = attributes[attributeName];
}
Avoid deeply nested control flow statements. Open
if (argumentA instanceof RegExp) {
if (argumentB.toString().match(argumentA) === null) {
return false;
}
} else if (argumentB instanceof RegExp) {
Function fetch
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function fetch(...options) {
switch(options.length) {
case 0:
fetchBy.call(this);
break;
- 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 countAssociationHasMany
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function countAssociationHasMany(model, associationModel, association, resultDetails, callback) {
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return true;