Showing 220 of 414 total issues
Function walkSchema
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
function walkSchema(app, Model, schema, parentName, fromArray, rawPath) {
var modelConfig = utils.getModels()[Model.modelName];
for (var key in schema) {
var field = schema[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 process
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
function process() {
var outFile = path.join(outDirectory, fileName);//path.basename(req.files.image.path));
var fileToDb = {
Function post
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.post = function (Model) {
return function (req, res) {
var gConfig = Model.injector();
var returnField = Model.injector().id;
var config = utils.getConfigByProfile(gConfig.post, req);
Function login
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.login = function (req, res) {
var loginValue = req.body.login;
var hash = req.body.password;
var token = req.body.token;
Function PluginRegistry
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
var PluginRegistry = /** @class */ (function () {
function PluginRegistry(config) {
this._plugins = {};
PluginRegistry.logger.trace("Creating ModelsLoader instance");
this.config = config;
Function process
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
function process() {
var outFile = path.join(outDirectory, fileName);//path.basename(req.files.image.path));
log.debug('File: ', outFile);
Function process
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
function process() {
var outFile = path.join(outDirectory, fileName);//path.basename(req.files.file.path));
log.debug('File: ', outFile);
Function transform
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
function transform(Model, key, fullKey, modelConfig, field) {
/*var sc = getElementSchema(Model.schema.paths, fullKey);
if(sc){
sc.options["x-schema-form"] = sc.options["x-schema-form"] || {};
sc.options["x-schema-form"]["disableSuccessState"] = true;
Function mainDeleteFn
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mainDeleteFn() {
//ID CHECKING
if (gConfig.id == "_id" && !mongoose.Types.ObjectId.isValid(req.params[gConfig.id]) && !isTypeRaw) {
res.statusCode = statusCode.NOT_FOUND;
res.json("Document not found. Invalid mongoose id");
Function expressSetup
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
function expressSetup(app, config) {
app.set('views', FSUtils.join(config.appPath, 'views'));
app.set('view engine', config.application.view_engine || 'ejs');
logger.token('body', function getUrlToken(req) {
return req.__body || "";
- 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 expressSetup
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
export function expressSetup(app:Express, config:any) {
app.set('views', FSUtils.join(config.appPath, 'views'));
app.set('view engine', config.application.view_engine || 'ejs');
- 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 getByField
has 84 lines of code (exceeds 25 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
Function TypeBased
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
var TypeBased = /** @class */ (function () {
function TypeBased() {
}
//TODO: Add hooks and middlewares
TypeBased.directReference = function (model, field, refModel, refField) {
Function AuthManager
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
var AuthManager = /** @class */ (function () {
function AuthManager(config, models) {
var _this = this;
this.checkRole = function (role) { return ({
name: 'checkRole(' + role + ')',
Function handleGetImage
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
GalleryInjector.prototype.handleGetImage = function () {
var _this = this;
var IMGR = require('imgr').IMGR;
var config = this.routeInjector.config.env.images.imgrConfig || {};
if (config.optimisation == undefined) {
Function PageLoader
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
var PageLoader = /** @class */ (function () {
function PageLoader(config, pluginRegistry) {
this.directories = [];
this._pages = {};
PageLoader.logger.trace("Creating PageLoader instance");
Function denormalize
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
module.exports.denormalize = function (field, rkey, Model, isArray, fullPath) {
var needsFromDBhook = true;
var denormalizedFields = field.denormalize;
log.debug("Adding denormalized params :\"" + denormalizedFields + "\" to field " + fullPath + " in model " + Model.modelName);
- 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 mainPostFn
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mainPostFn() {
var documentDB;
var newModel = {};
//Check incoming body has value
if (req.body != undefined && req.body) {
Function punchgraph
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.punchgraph = function (Model, punchcard) {
var dateField = punchcard.dateField;
var groupBy = punchcard.groupBy || "";
var defaultQuery = punchcard.query || {};
Function getElementSchema
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
module.exports.getElementSchema = function (paths, element) {
var sc = paths[element];
if (sc) {
return sc;
} 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"