Showing 220 of 414 total issues
Function PassportLocal
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
var PassportLocal = /** @class */ (function () {
//TODO: Use IAuthConfig when defining strategies on a next steps of this refactor
function PassportLocal(config) {
var _this = this;
this.tokens = require('../../../engine/routeinjector/routes/auth/tokens');
Function mainGetFn
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mainGetFn() {
//ID CHECKING
if(gConfig.id == "_id" && !mongoose.Types.ObjectId.isValid(req.params[gConfig.id])){
res.statusCode = statusCode.NOT_FOUND;
Function getInvRefField
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.getInvRefField = function (Model, refModel, field) {
return function (req, res) {
var gConfig = Model.injector();
var config = utils.getConfigByProfile(gConfig.get, req);
(config.pre) ? utils.runPreCallbacks(config.pre, Model, req, res, mainGetFn) : mainGetFn();
Function HooksUtils
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
var HooksUtils = /** @class */ (function () {
function HooksUtils() {
}
HooksUtils.funcMerge = function (funcArray) {
return function (doc, cb, state) { return __awaiter(_this, void 0, void 0, function () {
Function jsonform
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
schema.methods.jsonform = function (opt) {
var self = this;
var jf = {};
if (!opt) opt = {excluded: [], includes: '*', setDefaults: false};
if (!opt.includes) opt.includes = '*';
Function postArrayElementAt
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.postArrayElementAt = function (Model, key) {
return function (req, res) {
var gConfig = Model.injector();
var field = gConfig.id;
Function appendArrayElement
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.appendArrayElement = function (Model, key) {
return function (req, res) {
var gConfig = Model.injector();
var field = gConfig.id;
Function getFormConfig
has 71 lines of code (exceeds 25 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();
Function handleGetImage
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
private handleGetImage() {
let IMGR = require('imgr').IMGR;
let config = this.routeInjector.config.env.images.imgrConfig || {};
if (config.optimisation == undefined) {
config.optimisation = this.optimiseImage;
Function mongoConfigurationCheck
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function mongoConfigurationCheck(config, gConfig, method) {
if (config.profiles == undefined) {
config.profiles = {};
}
- 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 mainGetFn
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mainGetFn() {
var query = {};
for (var i in config.mongo.query) {
//COPY the object
query[i] = config.mongo.query[i];
Function getQueriedRefField
has 66 lines of code (exceeds 25 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);
Function jsonform
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
var jsonform = function (schema, options) {
var shardKey = undefined;
if (schema.statics.injector) {
var injector = schema.statics.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
Function FSUtils
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
var FSUtils = /** @class */ (function () {
function FSUtils() {
}
/**
* Get the directories from the existing src 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
Function pruneDocument
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.pruneDocument = function (indoc) {
return prune(indoc);
function prune(doc) {
if (doc instanceof Array) {
File GalleryInjector.js
has 273 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
Function mainPutFn
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mainPutFn() {
//Check incoming Model
if (req.body == undefined || req.body.element == undefined) {
res.statusCode = statusCode.BAD_REQUEST;
res.json("The body must containt the \"element\" key");
Function mainPutFn
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mainPutFn() {
//Check incoming Model
if (req.body == undefined || req.body.element == undefined) {
res.statusCode = statusCode.BAD_REQUEST;
res.json("The body must containt the \"element\" key");
Function parseSchema
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseSchema(subschema, out, fullPath) {
subschema.eachPath(function (pathString, pathO) {
var include = excludedPaths.indexOf(pathString) === -1;
if (include && opt.includes != '*')
Function prune
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
function prune(doc) {
if (doc instanceof Array) {
var objDoc = {};
//CAREFUL!!! --> Strictly necessary iterate over the plain object