Showing 220 of 414 total issues
Function PermissionsLoader
has a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring. Open
var PermissionsLoader = /** @class */ (function () {
function PermissionsLoader(config, modelsLoader) {
this.roles = [];
this.holder = {
routes: {}
- 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 a Cognitive Complexity of 73 (exceeds 5 allowed). Consider refactoring. Open
module.exports.pruneDocument = function (indoc) {
return prune(indoc);
function prune(doc) {
if (doc instanceof Array) {
- 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 __generator
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
- 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 __generator
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
- 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 __generator
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
- 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 GalleryInjector
has 222 lines of code (exceeds 25 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;
Function processAllPermissionsByRole
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
private processAllPermissionsByRole() {
var result = {};
var allModels = Object.keys(this.holder.routes);
var verbs = ["get", "post", "delete", "search", "put", "export", "import", "menu"];
- 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 post
has a Cognitive Complexity of 54 (exceeds 5 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);
- 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 denormalize
has 204 lines of code (exceeds 25 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);
Function ExpressManager
has 193 lines of code (exceeds 25 allowed). Consider refactoring. Open
var ExpressManager = /** @class */ (function () {
function ExpressManager(config, pluginRegistry, pageLoader) {
this.app = express();
ExpressManager.logger.trace("Creating ExpressManager instance");
this.config = config;
Function export
has 180 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.export = function (Model) {
/*var doc = new Model({});
var schema = doc.jsonform({});
var validFields = [];
Function transform
has a Cognitive Complexity of 42 (exceeds 5 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;
- 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 postArrayElementAt
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
module.exports.postArrayElementAt = function (Model, key) {
return function (req, res) {
var gConfig = Model.injector();
var field = gConfig.id;
- 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 RouteInjector
has 159 lines of code (exceeds 25 allowed). Consider refactoring. Open
var RouteInjector = /** @class */ (function () {
//private middlewareRegistry:MiddlewareRegistry;
function RouteInjector() {
this.version = require('../../package.json').version;
this.cache = { middlewares: {} };
Function exports
has 157 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function (app) {
var config = injector.config;
var prefix = config.routes.prefix;
var exprConfig = config.express || {};
Function appendArrayElement
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
module.exports.appendArrayElement = function (Model, key) {
return function (req, res) {
var gConfig = Model.injector();
var field = gConfig.id;
- 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 image-injector.js
has 424 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 genDenorm
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
function genDenorm(dest, src, denormalized, confRid, plain, doc, path) {
if (src) {
dest = {};
var target;
if (plain == true) {
- 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 AuthManager
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
var AuthManager = /** @class */ (function () {
function AuthManager(config, models) {
var _this = this;
this.checkRole = function (role) { return ({
name: 'checkRole(' + role + ')',
- 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 putByField
has 152 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.putByField = function (Model) {
var documentDb = {};
var originalDoc = {};
return function (req, res) {
var gConfig = Model.injector();