Showing 43 of 63 total issues
Function _buildIndexes
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Document.prototype._buildIndexes = function _buildIndexes() {
var self = this;
Object.keys(this.schema).forEach(function(key) {
var columnName = self.schema[key].columnName ? self.schema[key].columnName : key;
Function waterlineReady
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
}, function waterlineReady (err, ontology){
if (err) throw err;
console.log('\nWaterline initialized\n');
Function rewriteIds
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.rewriteIds = function rewriteIds(models, schema) {
var self = this;
var isModelsArray = _.isArray(models);
var modelsAux = isModelsArray ? models : [models];
Function genericJoin
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Associations.prototype.genericJoin = function genericJoin(collectionName, criteria, cb) {
var self = this;
// Ignore `select` from waterline core
if ( typeof criteria === 'object') {
Function describe
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Connection.prototype.describe = function describe(collectionName, cb) {
var self = this;
if(self._collectionSync.itemsToProcess[collectionName]){
delete self._collectionSync.itemsToProcess[collectionName];
Function cleanOrientAttributes
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.cleanOrientAttributes = function cleanOrientAttributes(model, schema) {
if (!model || !_.isObject(model))
return;
Object.keys(model).forEach(function(key) {
- 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 deleteEdges
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
deleteEdges : function(connection, collection, from, to, options, cb) {
Function find
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
Edge.prototype.find = function find(criteria, cb) {
var self = this;
var _query, query;
try {
- 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 createEdge
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
createEdge : function(connection, collection, from, to, options, cb) {
Function increment
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
increment : function(connection, collection, criteria, field, amount, cb) {
Function reduceNestedObjects
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
exports.reduceNestedObjects = function reduceNestedObjects(collection,
callback,
accumulator,
rootKey,
processedObjects) {
Function update
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
update : function(connection, collection, options, values, cb) {
Function addAttribute
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
addAttribute: function(connection, collection, attrName, attrDef, cb) {
Function query
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
query : function(connection, collection, query, options, cb) {
Function increment
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Connection.prototype.increment = function(collection, criteria, field, amount, cb) {
Function rewriteIdsRecursive
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.rewriteIdsRecursive = function rewriteIdsRecursive(models, schema, accumulator) {
var self = this;
var isModelsArray = _.isArray(models);
var modelsAux = isModelsArray ? models : [models];
accumulator = accumulator || {};
- 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 normalizeId
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Record.prototype.normalizeId = function normalizeId(values) {
if(!values.hasOwnProperty('id') && !values.hasOwnProperty('@rid')) return;
var id = values.id || values['@rid'];
- 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 getVerticesFromEdges
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Associations.prototype.getVerticesFromEdges = function getVerticesFromEdges(edges, side) {
if(!_.isArray(edges)){
if(_.isString(edges)) { return []; } // only carries ID of edge
var vertex = _.isString(edges[side]) ? { id: edges[side] } : edges[side];
return [ vertex ];
- 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 decode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Query.prototype.decode = function decode(idValue) {
var self = this;
if(! idValue || !self.decodeURIComponent) { return idValue; }
- 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
return idValue;