Showing 156 of 357 total issues
Function forgeStageTwoQuery
has a Cognitive Complexity of 231 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function forgeStageTwoQuery(query, orm) {
// if (process.env.NODE_ENV !== 'production') {
// console.time('forgeStageTwoQuery');
// }
- 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 normalizeConstraint
has a Cognitive Complexity of 188 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function normalizeConstraint (constraintRhs, constraintTarget, modelIdentity, orm, meta){
if (_.isUndefined(constraintRhs)) {
throw new Error('Consistency violation: The internal normalizeConstraint() utility must always be called with a first argument (the RHS of the constraint to normalize). But instead, got: '+util.inspect(constraintRhs, {depth:5})+'');
}
if (!_.isString(constraintTarget)) {
- 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 forgeStageTwoQuery
has 708 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function forgeStageTwoQuery(query, orm) {
// if (process.env.NODE_ENV !== 'production') {
// console.time('forgeStageTwoQuery');
// }
Function normalizeValueToSet
has a Cognitive Complexity of 130 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function normalizeValueToSet(value, supposedAttrName, modelIdentity, orm, meta) {
// ================================================================================================
assert(_.isString(supposedAttrName), '`supposedAttrName` must be a string.');
// (`modelIdentity` and `orm` will be automatically checked by calling `getModel()` below)
- 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 normalizeConstraint
has 425 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function normalizeConstraint (constraintRhs, constraintTarget, modelIdentity, orm, meta){
if (_.isUndefined(constraintRhs)) {
throw new Error('Consistency violation: The internal normalizeConstraint() utility must always be called with a first argument (the RHS of the constraint to normalize). But instead, got: '+util.inspect(constraintRhs, {depth:5})+'');
}
if (!_.isString(constraintTarget)) {
Function normalizeCriteria
has 411 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function normalizeCriteria(criteria, modelIdentity, orm, meta) {
// Sanity checks.
// > These are just some basic, initial usage assertions to help catch
// > bugs during development of Waterline core.
Function Waterline
has 385 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Waterline() {
// Start by setting up an array of model definitions.
// (This will hold the raw model definitions that were passed in,
// plus any implicitly introduced models-- but that part comes later)
Function forgeStageThreeQuery
has 380 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function forgeStageThreeQuery(options) {
// ╦ ╦╔═╗╦ ╦╔╦╗╔═╗╔╦╗╔═╗ ┌─┐┌─┐┌┬┐┬┌─┐┌┐┌┌─┐
// ╚╗╔╝╠═╣║ ║ ║║╠═╣ ║ ║╣ │ │├─┘ │ ││ ││││└─┐
// ╚╝ ╩ ╩╩═╝╩═╩╝╩ ╩ ╩ ╚═╝ └─┘┴ ┴ ┴└─┘┘└┘└─┘
if (!_.has(options, 'stageTwoQuery') || !_.isPlainObject(options.stageTwoQuery)) {
Function initialize
has 348 lines of code (exceeds 25 allowed). Consider refactoring. Open
orm.initialize = function initialize(options, done) {
try {
File forge-stage-two-query.js
has 723 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Module dependencies
*/
var assert = require('assert');
Function helpFind
has 332 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function helpFind(WLModel, s2q, omen, done) {
if (!_.isFunction(done)) {
throw new Error('Consistency violation: `done` (4th argument) should be a function');
}
Function normalizeValueToSet
has 301 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function normalizeValueToSet(value, supposedAttrName, modelIdentity, orm, meta) {
// ================================================================================================
assert(_.isString(supposedAttrName), '`supposedAttrName` must be a string.');
// (`modelIdentity` and `orm` will be automatically checked by calling `getModel()` below)
Function forgeStageThreeQuery
has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function forgeStageThreeQuery(options) {
// ╦ ╦╔═╗╦ ╦╔╦╗╔═╗╔╦╗╔═╗ ┌─┐┌─┐┌┬┐┬┌─┐┌┐┌┌─┐
// ╚╗╔╝╠═╣║ ║ ║║╠═╣ ║ ║╣ │ │├─┘ │ ││ ││││└─┐
// ╚╝ ╩ ╩╩═╝╩═╩╝╩ ╩ ╩ ╚═╝ └─┘┴ ┴ ┴└─┘┘└┘└─┘
if (!_.has(options, 'stageTwoQuery') || !_.isPlainObject(options.stageTwoQuery)) {
- 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 replaceCollection
has 241 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function replaceCollection(/* targetRecordIds?, collectionAttrName?, associatedIds?, explicitCbMaybe?, meta? */) {
// Verify `this` refers to an actual Sails/Waterline model.
verifyModelMethodContext(this);
Function destroy
has 233 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function destroy(/* criteria, explicitCbMaybe, metaContainer */) {
// Verify `this` refers to an actual Sails/Waterline model.
verifyModelMethodContext(this);
Function processAllRecords
has 227 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function processAllRecords(records, meta, modelIdentity, orm) {
// console.time('processAllRecords');
if (!_.isArray(records)) {
Function _getPopulatedRecords
has 220 lines of code (exceeds 25 allowed). Consider refactoring. Open
(function _getPopulatedRecords(proceed){
// ┌┬┐┌─┐ ┬ ┬┌─┐ ┌┐┌┌─┐┌─┐┌┬┐ ┌─┐┬ ┬┬┌┬┐┌─┐
// │││ │ │││├┤ │││├┤ ├┤ ││ └─┐├─┤││││ ┌┘
// ─┴┘└─┘ └┴┘└─┘ ┘└┘└─┘└─┘─┴┘ └─┘┴ ┴┴┴ ┴ o
Function _eachParentOrChildRecord
has 215 lines of code (exceeds 25 allowed). Consider refactoring. Open
eachRecordDeep(records, function _eachParentOrChildRecord(record, WLModel){
// First, check the results to verify compliance with the adapter spec.,
// as well as any issues related to stale data that might not have been
// been migrated to keep up with the logical schema (`type`, etc. in
Function getAttribute
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function getAttribute(attrName, modelIdentity, orm) {
// ================================================================================================
// Check that the provided `attrName` is valid.
// (`modelIdentity` and `orm` will be automatically checked by calling `getModel()`)
- 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 normalizeWhereClause
has a Cognitive Complexity of 54 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function normalizeWhereClause(whereClause, 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"