Showing 220 of 414 total issues
Function getNDocumentsPost
has 148 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.getNDocumentsPost = function (Model) {
return function (req, res) {
if (!req.body) req.body = {};
if (!req.body.query) req.body.query = {};
Function getByField
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
module.exports.getByField = function (Model) {
return function (req, res) {
var gConfig = Model.injector();
var isTypeBack = (req.query.type && req.query.type == "back"); //Special for filter normalizations
- 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 jsonform
has 147 lines of code (exceeds 25 allowed). Consider refactoring. Open
var jsonform = function (schema, options) {
var shardKey = undefined;
if (schema.statics.injector) {
var injector = schema.statics.injector();
Function export
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
module.exports.export = function (Model) {
/*var doc = new Model({});
var schema = doc.jsonform({});
var validFields = [];
- 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 mainPutFn
has 142 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mainPutFn() {
//ID CHECKING
if (gConfig.id == "_id" && !mongoose.Types.ObjectId.isValid(req.params[gConfig.id])) {
res.statusCode = statusCode.NOT_FOUND;
res.json("Document not found. Invalid mongoose id");
Function FSUtils
has 142 lines of code (exceeds 25 allowed). Consider refactoring. Open
var FSUtils = /** @class */ (function () {
function FSUtils() {
}
/**
* Get the directories from the existing src path
File new-image-injector.js
has 398 lines of code (exceeds 250 allowed). Consider refactoring. Open
var mkdirp = require('mkdirp');
var fs = require('fs');
var glob = require('glob');
var async = require('async');
var path = require('path');
Function mainGetNPostFn
has 137 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mainGetNPostFn() {
var query = req.body.query;
function validateOID(q) {
_.forOwn(q, function (value, key) {
Function insertImage
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
function insertImage(param) {
return function (req, res) {
var outDirectory = param.out;
if (req.files.image != undefined) {
//ext includes '.'
Function ModelsLoader
has 116 lines of code (exceeds 25 allowed). Consider refactoring. Open
var ModelsLoader = /** @class */ (function () {
function ModelsLoader(config, pluginRegistry) {
this._models = {};
ModelsLoader.logger.trace("Creating ModelsLoader instance");
this.config = config;
Function insertFile
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
function insertFile(param) {
return function (req, res) {
var outDirectory = param.out;
if (req.files.file != undefined) {
//ext includes '.'
Function insertImage
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
function insertImage(param) {
return function (req, res) {
var outDirectory = param.out;
if (req.files.image != undefined) {
//ext includes '.'
Function GalleryInjector
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
var GalleryInjector = /** @class */ (function () {
function GalleryInjector(routeInjector) {
var _this = this;
this.fileExistsMiddleware = function (req, res, next) {
var reqPath = req.params.path;
- 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 typeBased.js
has 357 lines of code (exceeds 250 allowed). Consider refactoring. Open
var utils = require('../utils');
var statusCode = require('http-status-codes');
var confs = utils.getModels();
var Q = require('q');
Function PermissionsLoader
has 114 lines of code (exceeds 25 allowed). Consider refactoring. Open
var PermissionsLoader = /** @class */ (function () {
function PermissionsLoader(config, modelsLoader) {
this.roles = [];
this.holder = {
routes: {}
Function getNDocumentsPost
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
module.exports.getNDocumentsPost = function (Model) {
return function (req, res) {
if (!req.body) req.body = {};
if (!req.body.query) req.body.query = {};
- 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 getFormConfig
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
module.exports.getFormConfig = function (req, res) {
var modelName = req.params.modelname;
try {
var Model = mongoose.model(modelName);
var minjector = Model.injector();
- 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 utils.js
has 350 lines of code (exceeds 250 allowed). Consider refactoring. Open
var async = require('async');
var statusCode = require('http-status-codes');
var _ = require('lodash');
var Q = require('q');
Function deleteByField
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
module.exports.deleteByField = function (Model) {
return function (req, res) {
var gConfig = Model.injector();
var field = gConfig.id;
var config = utils.getConfigByProfile(gConfig.delete, 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 deleteByField
has 96 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.deleteByField = function (Model) {
return function (req, res) {
var gConfig = Model.injector();
var field = gConfig.id;
var config = utils.getConfigByProfile(gConfig.delete, req);