Showing 156 of 357 total issues
Function findOne
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function findOne( /* criteria?, populates?, explicitCbMaybe?, meta? */ ) {
// Verify `this` refers to an actual Sails/Waterline model.
verifyModelMethodContext(this);
Function _afterPotentiallyLookingUpRecordsToCascade
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
})(function _afterPotentiallyLookingUpRecordsToCascade(err, idsOfRecordsBeingDestroyedMaybe) {
if (err) { return done(err); }
// Now we'll actually perform the `destroy`.
Function _beginBatchMaybe
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _beginBatchMaybe(next) {
// 0 => 15
// 15 => 15
// 30 => 15
Function _afterTalkingToAdapter
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
adapter.destroy(WLModel.datastore, query, function _afterTalkingToAdapter(err, rawAdapterResult) {
if (err) {
err = forgeAdapterError(err, omen, 'destroy', modelIdentity, orm);
return done(err);
}//-•
File get-query-modifier-methods.js
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Module dependencies
*/
var assert = require('assert');
Function avg
has 106 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function avg( /* numericAttrName?, criteria?, explicitCbMaybe?, meta?, moreQueryKeys? */ ) {
// Verify `this` refers to an actual Sails/Waterline model.
verifyModelMethodContext(this);
File help-find.js
has 341 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Module dependencies
*/
var util = require('util');
Function customizations
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var customizations = (function(){
// ███╗ ██╗ ██████╗ ████████╗ █████╗ ███╗ ██╗ ███████╗██████╗ ██████╗ ██████╗ ██████╗
// ████╗ ██║██╔═══██╗╚══██╔══╝ ██╔══██╗████╗ ██║ ██╔════╝██╔══██╗██╔══██╗██╔═══██╗██╔══██╗
// ██╔██╗ ██║██║ ██║ ██║ ███████║██╔██╗ ██║ █████╗ ██████╔╝██████╔╝██║ ██║██████╔╝
Function find
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function find( /* criteria?, populates?, explicitCbMaybe?, meta? */ ) {
// Verify `this` refers to an actual Sails/Waterline model.
verifyModelMethodContext(this);
Function normalizeComparisonValue
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function normalizeComparisonValue (value, attrName, modelIdentity, orm){
if (!_.isString(attrName)) { throw new Error('Consistency violation: This internal utility must always be called with a valid second argument (the attribute name). But instead, got: '+util.inspect(attrName, {depth:5})+''); }
if (!_.isString(modelIdentity)) { throw new Error('Consistency violation: This internal utility must always be called with a valid third argument (the model identity). But instead, got: '+util.inspect(modelIdentity, {depth:5})+''); }
if (!_.isObject(orm)) { throw new Error('Consistency violation: This internal utility must always be called with a valid fourth argument (the orm instance). But instead, got: '+util.inspect(orm, {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
Function sum
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function sum( /* numericAttrName?, criteria?, explicitCbMaybe?, meta?, moreQueryKeys? */ ) {
// Verify `this` refers to an actual Sails/Waterline model.
verifyModelMethodContext(this);
Function archive
has 95 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function archive(/* criteria, explicitCbMaybe, metaContainer */) {
// Verify `this` refers to an actual Sails/Waterline model.
verifyModelMethodContext(this);
Function _afterPotentiallyRunningBeforeLC
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
})(function _afterPotentiallyRunningBeforeLC(err, query) {
if (err) {
return done(err);
}
Function helpFind
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
Open
module.exports = function helpFind(WLModel, s2q, omen, done) {
if (!_.isFunction(done)) {
throw new Error('Consistency violation: `done` (4th argument) should be a function');
}
- 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 findOrCreate
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function findOrCreate( /* criteria?, newRecord?, explicitCbMaybe?, meta? */ ) {
// Verify `this` refers to an actual Sails/Waterline model.
verifyModelMethodContext(this);
File normalize-value-to-set.js
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/**
* Module dependencies
*/
var util = require('util');
Function updateOne
has 87 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function updateOne(criteria, valuesToSet, explicitCbMaybe, metaContainer) {
// Verify `this` refers to an actual Sails/Waterline model.
verifyModelMethodContext(this);
Function _afterGettingPopulatedPhysicalRecords
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
}) (function _afterGettingPopulatedPhysicalRecords (err, populatedRecords){
if (err) { return done(err); }
//
Function _makeCallOrCallsToAppropriateIteratee
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
(function _makeCallOrCallsToAppropriateIteratee(proceed){
// Check if the iteratee declares a callback parameter
var seemsToExpectCallback = (function(){
var fn = query.eachBatchFn || query.eachRecordFn;
Function normalizeComparisonValue
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function normalizeComparisonValue (value, attrName, modelIdentity, orm){
if (!_.isString(attrName)) { throw new Error('Consistency violation: This internal utility must always be called with a valid second argument (the attribute name). But instead, got: '+util.inspect(attrName, {depth:5})+''); }
if (!_.isString(modelIdentity)) { throw new Error('Consistency violation: This internal utility must always be called with a valid third argument (the model identity). But instead, got: '+util.inspect(modelIdentity, {depth:5})+''); }
if (!_.isObject(orm)) { throw new Error('Consistency violation: This internal utility must always be called with a valid fourth argument (the orm instance). But instead, got: '+util.inspect(orm, {depth:5})+''); }