RouteInjector/route-injector

View on GitHub

Showing 220 of 414 total issues

Function walkSchema has 36 lines of code (exceeds 25 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];
Severity: Minor
Found in lib/engine/routeinjector/typeBased.js - About 1 hr to fix

    Function getFileNameFromFile has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function getFileNameFromFile(outDirectory, sourceFileName, cb) {
        var fileName = null;
        sourceFileName = sourceFileName.toLowerCase();
    
        if (!fs.existsSync(outDirectory)) {
    Severity: Minor
    Found in lib/engine/routeinjector/images/new-image-injector.js - About 1 hr to fix

      Function DBConnection has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var DBConnection = /** @class */ (function () {
          function DBConnection(config) {
              DBConnection.logger.trace("Creating DBConnection instance");
              this.config = config;
              this.debug(this.config.env.database.debug || false);
      Severity: Minor
      Found in lib/app/internals/DBConnection.js - About 1 hr to fix

        Function getFileNameFromFile has 35 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function getFileNameFromFile(outDirectory, sourceFileName,cb){
            var fileName=null;
            sourceFileName=sourceFileName.toLowerCase();
        
            if (!fs.existsSync(outDirectory)){
        Severity: Minor
        Found in lib/engine/routeinjector/images/image-injector.js - About 1 hr to fix

          Function getFileNameFromFile has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function getFileNameFromFile(outDirectory, sourceFileName, cb) {
              var fileName = null;
              sourceFileName = sourceFileName.toLowerCase();
          
              if (!fs.existsSync(outDirectory)) {
          Severity: Minor
          Found in lib/engine/routeinjector/files/file-injector.js - About 1 hr to fix

            Function checkRole has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function checkRole(role) {
            
                return function (req, res, next) {
                    var injector = require('../../../../');
                    var config = injector.config;
            Severity: Minor
            Found in lib/engine/routeinjector/routes/auth/utils.js - About 1 hr to fix

              Function save has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                              function save(doc) {
                                  var defer = Q.defer();
                                  //Create the Model object from the json received
                                  if (Model.injector()._references) {
                                      if (Model.injector()._references.toDB) {
              Severity: Minor
              Found in lib/engine/routeinjector/rest/put.js - About 1 hr to fix

                Function uploadFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function uploadFile(item, cb) {
                            fs.exists(item.path, function (exists) {
                                if (exists) {
                                    //TODO pass as setting paramter
                                    if (1 == 0) {//Get file name as randoom
                Severity: Minor
                Found in lib/engine/routeinjector/images/new-image-injector.js - About 1 hr to fix

                  Function endOK has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                                          function endOK() {
                                              var refConf = confs[refModel.modelName];
                  
                                              if (refConf.search.disable === true) {
                                                  res.statusCode = statusCode.UNAUTHORIZED;
                  Severity: Minor
                  Found in lib/engine/routeinjector/typeBased/typeBased.js - About 1 hr to fix

                    Function uploadFile has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            function uploadFile(item, cb) {
                                fs.exists(item.path, function (exists) {
                                    if (exists) {
                                        //TODO pass as setting paramter
                                        if(1==0) {//Get file name as randoom
                    Severity: Minor
                    Found in lib/engine/routeinjector/images/image-injector.js - About 1 hr to fix

                      Function expressSetup has 33 lines of code (exceeds 25 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 || "";
                      Severity: Minor
                      Found in lib/app/internals/express/ExpressMiddlewares.js - About 1 hr to fix

                        Function expressSetup has 33 lines of code (exceeds 25 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');
                        
                        
                        Severity: Minor
                        Found in lib/app/internals/express/ExpressMiddlewares.ts - About 1 hr to fix

                          Function Logger has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          var Logger = /** @class */ (function () {
                              function Logger() {
                              }
                              /**
                               * Get a logger to log your application
                          Severity: Minor
                          Found in lib/app/internals/Logger.js - About 1 hr to fix

                            Function clearCache has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                FSUtils.clearCache = function (cfg, relativePath) {
                                    var e_1, _a;
                                    return __awaiter(this, void 0, void 0, function () {
                                        var dirName, baseNameNoExt, globPath, stream, stream_1, stream_1_1, entry, e_1_1;
                                        return __generator(this, function (_b) {
                            Severity: Minor
                            Found in lib/utils/FSUtils.js - About 1 hr to fix

                              Function MiddlewareRegistry has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              var MiddlewareRegistry = /** @class */ (function () {
                                  function MiddlewareRegistry(config) {
                                      this._middlewares = {};
                                      this.config = config;
                                      MiddlewareRegistry.logger.trace("Creating MiddlewareRegistry instance");
                              Severity: Minor
                              Found in lib/app/internals/MiddlewareRegistry.js - About 1 hr to fix

                                Function doLogin has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    function doLogin(model, cbk) {
                                        if (loginInfo.found == undefined) {
                                            model.findOne(loginCondition, null).lean().exec(function (err, result) {
                                                //var logModels = config.login.model;
                                                if (err) {
                                Severity: Minor
                                Found in lib/engine/routeinjector/routes/auth.js - About 1 hr to fix

                                  Function checkToken has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  exports.checkToken = function (req, res, cb) {
                                      var token = req.params.token;
                                      jwt.verify(token, aconf["token.secret"], function (unauthorized, decoded) {
                                          if (unauthorized) {
                                              if(cb) return cb(false);
                                  Severity: Minor
                                  Found in lib/engine/routeinjector/routes/auth.js - About 1 hr to fix

                                    Function getImage has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    function getImage(param) {
                                        return function (req, res) {
                                    
                                            var conf = param.model.injector();
                                    
                                    Severity: Minor
                                    Found in lib/engine/routeinjector/images/image-injector.js - About 1 hr to fix

                                      Function configureForm has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      module.exports.configureForm = function (Model) {
                                          var inj = Model.injector();
                                          if (inj.form && inj.form.tabs) {
                                              for (var t in inj.form.tabs) {
                                                  var tab = inj.form.tabs[t];
                                      Severity: Minor
                                      Found in lib/engine/routeinjector/utils.js - About 1 hr to fix

                                        Function logout has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                        exports.logout = function (req, res) {
                                            log.info(req.user);
                                            if (aconf.login.stateless) {
                                                res.statusCode = statusCode.BAD_REQUEST;
                                                res.json({result: 'auth mode is stateless'});
                                        Severity: Minor
                                        Found in lib/engine/routeinjector/routes/auth.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language