Showing 220 of 414 total issues
Function getConfigByProfile
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.getConfigByProfile = function (gConfig, req) {
var profile = req.query.profile || req.headers.profile;
var config = {};
if (profile == undefined) {
Function validateItem
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function validateItem(Model, id, cb) {
Model.findOne({_id: id}, function (err, r) {
if (err) {
log.error(err);
res.statusCode = statusCode.INTERNAL_SERVER_ERROR;
Function checkSetup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
module.exports.checkSetup = function (Model) {
var mConf = Model.injector();
//Limit shards based on the environment!
if (mConf.shard && mConf.shard.shardValues) {
- 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 PageLoader
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
var PageLoader = /** @class */ (function () {
function PageLoader(config, pluginRegistry) {
this.directories = [];
this._pages = {};
PageLoader.logger.trace("Creating PageLoader instance");
- 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 QueryUtils
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
var QueryUtils = /** @class */ (function () {
function QueryUtils() {
}
//TODO: Add population key if present
QueryUtils.findOne = function (operation, model, req, cb) {
- 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 endOK
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function endOK(_result) {
res.statusCode = statusCode.OK;
var sendObj = {};
sendObj.status = {};
sendObj.status.count = totalCount;
Function optimiseImage
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
GalleryInjector.prototype.optimiseImage = function (image, callback) {
GalleryInjector.logger.debug("OPTIMIZING ", image);
if (/\.png$/i.test(image)) {
GalleryInjector.logger.debug("PNG", image);
image = image.replace("$", "\\$");
Function MongooseFunction
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function MongooseFunction () {
var arg = arguments[0];
var type = typeof arg;
var toFunc = custom || toFunction;
var fn;
Function login
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.login = function (req, res) {
var loginValue = req.body.login;
var hash = req.body.password;
var token = req.body.token;
- 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 select
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
exports.select = function(Model){
return function(req, res){
var config = Model.injector();
var graphs = config.graphs;
- 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 getConfigByProfile
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports.getConfigByProfile = function (gConfig, req) {
var profile = req.query.profile || req.headers.profile;
var config = {};
if (profile == undefined) {
- 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 getRefField
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports.getRefField = function (Model, field, refModel, key) {
return function (req, res) {
var gConfig = Model.injector();
var config = utils.getConfigByProfile(gConfig.get, req);
- 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 getQueriedRefField
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
module.exports.getQueriedRefField = function (Model, field, refModel, key) {
return function (req, res) {
var gConfig = Model.injector();
var config = utils.getConfigByProfile(gConfig.get, req);
- 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 RouteLoader
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
var RouteLoader = /** @class */ (function () {
function RouteLoader(config, pluginRegistry) {
RouteLoader.logger.trace("Creating RouteLoader instance");
this.config = config;
this.pluginRegistry = pluginRegistry;
- 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 rejectIfErrorOrDocumentNotFound
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
TypeBased.rejectIfErrorOrDocumentNotFound = function (operation, model, err, doc, req, res, cb) {
Function genDenorm
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function genDenorm(dest, src, denormalized, confRid, plain, doc, path) {
Function walkSchema
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function walkSchema(app, Model, schema, parentName, fromArray, rawPath) {
Avoid deeply nested control flow statements. Open
for (let field of Model.schema.paths[key].options.denormalize)
validFields.push(key + "." + field);
Avoid deeply nested control flow statements. Open
if (e) {
log.error(e);
res.json(e);
res.statusCode = statusCode.INTERNAL_SERVER_ERROR;
return res.end();
Avoid deeply nested control flow statements. Open
if (i == 0) {
fileName = sourceFileName;
} else {
fileName = addStringBeforeExtension(sourceFileName, '_' + i);
}