Showing 48 of 73 total issues
Function exports
has 136 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(grunt) {
var databaseUrl;
var paths = {
js: ['*.js', 'api/**/*.js', 'lib/*.js', '!test/coverage/**', '!bower_components/**', '!newrelic.js']
Function recursionReduce
has 134 lines of code (exceeds 25 allowed). Consider refactoring. Open
function recursionReduce(req, Model, Entity, Property, Fields, callback){
var subObject = Entity[Property];
if(_.isArray(subObject)){
var tasks = [];
Function iterationParse
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
function iterationParse(req, param, entity, property) {
var subObject = null;
if (!property) {
subObject = entity;
} else {
- 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
File controllerHelper.js
has 340 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright (c) 2014 TopCoder, Inc. All rights reserved.
*/
/**
* Helper methods for controller logic.
File partialResponseHelper.js
has 296 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* Copyright (c) 2014 TopCoder, Inc. All rights reserved.
*/
/**
* Helper methods for controller logic.
Function iterationParse
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function iterationParse(req, param, entity, property) {
var subObject = null;
if (!property) {
subObject = entity;
} else {
Function exports
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(sequelize, DataTypes) {
var Message = sequelize.define('Message', {
id: {
type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true,
Function parseOrderBy
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.parseOrderBy = function(model, req, filters, orderParam) {
if (!orderParam) {
routeHelper.addValidationError(req, 'Value of orderBy parameter is empty');
return;
}
Function exports
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(config) {
var fse = require('fs-extra');
var path = require('path');
var Sequelize = require('sequelize');
var _ = require('lodash');
Function findRightBracket
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
function findRightBracket(req, string) {
var count = 0;
for (var i = 0; i < string.length; i += 1) {
if (string[i] === ')') {
if (i === 0) {
- 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 parseOrderBy
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
exports.parseOrderBy = function(model, req, filters, orderParam) {
if (!orderParam) {
routeHelper.addValidationError(req, 'Value of orderBy parameter is empty');
return;
}
- 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 _buildReferenceFilter
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _buildReferenceFilter(referenceModels, req, callback) {
var filters = { where: {} }; // start with emtpty filter
if (!referenceModels) {
callback(null, filters);
} else {
Function updateEntity
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function updateEntity(model, referenceModels, options, req, funcCallback) {
async.waterfall([
function(callback) {
_checkExtraParameters(req, callback);
},
Function exports
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(sequelize, DataTypes) {
var Discussion = sequelize.define('Discussion', {
id: {
type: DataTypes.BIGINT, primaryKey: true, autoIncrement: true,
Function parseFilter
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.parseFilter = function(model, req, filters, filterParam) {
if (!filterParam) {
routeHelper.addValidationError(req, 'Value of filter parameter is empty');
return;
}
Function tcUser
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.tcUser = function(req, res, next) {
if (req.user) {
var options = {
url: config.get('app.tcUser') + '/user',
headers: {
Function _setFilter
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _setFilter(req, filters, operator, field, value) {
switch (operator) {
case '=':
var matched = value.match(/^in\s*\((.*)\)/);
if (matched && matched.length === 2) { // in operator
Function renderJson
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.renderJson = function(req, res) {
if (req.error) {
if (req.error.errors) { // validation errors
res.status(req.error.code).json({
result: {
Function _setFilter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
function _setFilter(req, filters, operator, field, value) {
switch (operator) {
case '=':
var matched = value.match(/^in\s*\((.*)\)/);
if (matched && matched.length === 2) { // in operator
- 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 deleteEntity
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function deleteEntity(model, referenceModels, options, req, funcCallback) {
async.waterfall([
function(callback) {
_checkExtraParameters(req, callback);
},