RouteInjector/route-injector

View on GitHub

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 || [];
Severity: Major
Found in lib/engine/routeinjector/utils.js - About 2 hrs to fix

    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;
    Severity: Minor
    Found in lib/engine/routeinjector/images/new-image-injector.js - About 2 hrs to fix

    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;
    Severity: Minor
    Found in lib/engine/routeinjector/images/image-injector.js - About 2 hrs to fix

    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;
    Severity: Minor
    Found in lib/app/internals/ExpressManager.js - About 2 hrs to fix

    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');
    Severity: Minor
    Found in lib/engine/routeinjector/newdenormalizer.js - About 2 hrs to fix

      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 = [];
      
      Severity: Major
      Found in lib/engine/routeinjector/newdenormalizer.js - About 2 hrs to fix

        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);
        Severity: Major
        Found in lib/engine/routeinjector/typeBased/typeBased.js - About 2 hrs to fix

          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];
          Severity: Major
          Found in lib/engine/routeinjector/typeBased/typeBased.js - About 2 hrs to fix

            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) {
            Severity: Major
            Found in lib/engine/routeinjector/newdenormalizer.js - About 2 hrs to fix

              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 || {};
              Severity: Major
              Found in lib/engine/routeinjector/graphs/bargraph.js - About 2 hrs to fix

                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');
                Severity: Minor
                Found in lib/engine/routeinjector/files/file-injector.js - About 2 hrs to fix

                  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();
                  
                  Severity: Major
                  Found in lib/engine/routeinjector/newdenormalizer.js - About 2 hrs to fix

                    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) {
                    Severity: Major
                    Found in lib/utils/QueryUtils.js - About 2 hrs to fix

                      ExpressManager has 21 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class ExpressManager {
                          static logger = Logger.getLogger();
                          public app = express();
                          private config;
                          private pluginRegistry: PluginRegistry;
                      Severity: Minor
                      Found in lib/app/internals/ExpressManager.ts - About 2 hrs to fix

                        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;
                        Severity: Major
                        Found in lib/app/internals/RouteLoader.js - About 2 hrs to fix

                          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];
                          Severity: Major
                          Found in lib/engine/routeinjector/typeBased/typeBased.js - About 2 hrs to fix

                            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;
                            Severity: Major
                            Found in lib/engine/routeinjector/rest/validate.js - About 2 hrs to fix

                              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;
                              Severity: Minor
                              Found in lib/engine/routeinjector/images/new-image-injector.js - About 1 hr to fix

                                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;
                                Severity: Minor
                                Found in lib/engine/routeinjector/images/image-injector.js - About 1 hr to fix

                                  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
                                  Severity: Minor
                                  Found in lib/mongoose-plugins/mongoose-jsonform/lib/mongoose-jsonform.js - About 1 hr to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language