Showing 220 of 414 total issues
Function it
has 61 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.iterate = function it(fullPath, doc, iterator, callback, parents) {
var paths = fullPath.split('.');
parents = parents || [];
Function injectImages
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
exports.injectImages = function (_app, param) {
var imageConf = injector.config.env.images;
imagePath = imageConf.path;
cachePath = imageConf.cache;
- 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 injectImages
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
exports.injectImages = function (_app, param) {
var imageConf = injector.config.env.images;
imagePath = imageConf.path;
cachePath = imageConf.cache;
- 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 ExpressManager
has a Cognitive Complexity of 18 (exceeds 5 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;
- 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 newdenormalizer.js
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
var utils = require('./utils');
var Q = require('q');
var _ = require('lodash');
var injector = require('../../');
var async = require('async');
Function toDB
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Model.injector()._references.toDB = function (doc, cb) {
var defer = Q.defer();
var self = doc;
var promises = [];
Function getRefField
has 59 lines of code (exceeds 25 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);
Function mainGetFn
has 59 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 propagate
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
RefModel.injector()._references.propagate = function (doc) {
var models = Object.keys(RefModel.injector()._references.propagations);
var promises = [];
async.each(models, function (item, cb) {
Function bargraph
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.bargraph = function (Model, bargraph) {
var groupBy = bargraph.groupBy || "";
var axis = bargraph.xAxisField;
var defaultQuery = bargraph.query || {};
File file-injector.js
has 260 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 fromDB
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Model.injector()._references.fromDB = function (doc, cb) {
var defer = Q.defer();
var promises = [];
var doc2 = doc.toObject();
Function QueryUtils
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
var QueryUtils = /** @class */ (function () {
function QueryUtils() {
}
//TODO: Add population key if present
QueryUtils.findOne = function (operation, model, req, cb) {
ExpressManager
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class ExpressManager {
static logger = Logger.getLogger();
public app = express();
private config;
private pluginRegistry: PluginRegistry;
Function RouteLoader
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
var RouteLoader = /** @class */ (function () {
function RouteLoader(config, pluginRegistry) {
RouteLoader.logger.trace("Creating RouteLoader instance");
this.config = config;
this.pluginRegistry = pluginRegistry;
Function mainGetFn
has 52 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 validate
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.validate = function (Model) {
var config = Model.injector();
var additionalId = (config.id != '_id') ? config.id : undefined;
var shardKey = (config.shard && config.shard.shardKey) ? config.shard.shardKey : undefined;
Function injectImages
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.injectImages = function (_app, param) {
var imageConf = injector.config.env.images;
imagePath = imageConf.path;
cachePath = imageConf.cache;
Function injectImages
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
exports.injectImages = function (_app, param) {
var imageConf = injector.config.env.images;
imagePath = imageConf.path;
cachePath = imageConf.cache;
Function iterate
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
function iterate(path, obj) {
if (matches = path.match(/([^.]+)\.(.*)/)) {
var key = matches[1];
if (!obj[key]) {
// Humanize object title