RouteInjector/route-injector

View on GitHub

Showing 220 of 414 total issues

Avoid deeply nested control flow statements.
Open

                        for (var v in verbs) {
                            var verb:string = verbs[v];
                            if (this.holder.routes[model][verb].indexOf(role) == -1) {
                                if (!result[role][model]) {
                                    result[role][model] = {};
Severity: Major
Found in lib/app/internals/auth/PermissionsLoader.ts - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                                        if (type.type == 'date') {
                                            pathO.options.default = pathO.options.default.toISOString();
                                        }
    Severity: Major
    Found in lib/mongoose-plugins/mongoose-jsonform/lib/mongoose-jsonform.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if (route.hasOwnProperty(role)) {
                                  var userRole = route[role];
                                  if (!result[userRole])
                                      result[userRole] = {};
                                  if (!result[userRole][modelName])
      Severity: Major
      Found in lib/app/internals/auth/PermissionsLoader.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                        if (type.items.type == 'object') {
                                            // TODO: Pass to the the parseSchema the current path
                                            parseSchema(pathO.schema, obj[path].items.properties, pathO.path);
                                        } else {
                                            type = getType(pathString, pathO.caster.instance);
        Severity: Major
        Found in lib/mongoose-plugins/mongoose-jsonform/lib/mongoose-jsonform.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  for (var v in verbs) {
                                      var verb = verbs[v];
                                      if (this.holder.routes[model][verb].indexOf(role) == -1) {
                                          if (!result[role][model]) {
                                              result[role][model] = {};
          Severity: Major
          Found in lib/app/internals/auth/PermissionsLoader.js - About 45 mins to fix

            Function Configurations has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

            var Configurations = /** @class */ (function () {
                function Configurations() {
                    if (Configurations.configHolder) {
                        throw new Error("Don't instantiate directly a configuration");
                    }
            Severity: Minor
            Found in lib/app/internals/Configurations.js - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                                    if (route.hasOwnProperty(role)) {
                                        var userRole = route[role];
            
                                        if (!result[userRole])
                                            result[userRole] = {};
            Severity: Major
            Found in lib/app/internals/auth/PermissionsLoader.ts - About 45 mins to fix

              Function denormalize has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              module.exports.denormalize = function (field, rkey, Model, isArray, fullPath) {
              Severity: Minor
              Found in lib/engine/routeinjector/newdenormalizer.js - About 35 mins to fix

                Function runPostCallbacks has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                module.exports.runPostCallbacks = function (config, req, res, value, cbk) {
                Severity: Minor
                Found in lib/engine/routeinjector/utils.js - About 35 mins to fix

                  Function runPreCallbacks has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  module.exports.runPreCallbacks = function (preFnArray, Model, req, res, cbk) {
                  Severity: Minor
                  Found in lib/engine/routeinjector/utils.js - About 35 mins to fix

                    Function iterate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                    module.exports.iterate = function it(fullPath, doc, iterator, callback, parents) {
                    Severity: Minor
                    Found in lib/engine/routeinjector/utils.js - About 35 mins to fix

                      Function runBeforeDatabaseCallbacks has 5 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          TypeBased.runBeforeDatabaseCallbacks = function (operation, model, req, res, cb) {
                      Severity: Minor
                      Found in lib/engine/routeinjector/newTypeBased/TypeBased.js - About 35 mins to fix

                        Function transform has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        function transform(Model, key, fullKey, modelConfig, field) {
                        Severity: Minor
                        Found in lib/engine/routeinjector/typeBased.js - About 35 mins to fix

                          Function findOneWithValue has 5 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              QueryUtils.findOneWithValue = function (operation, model, req, value, cb) {
                          Severity: Minor
                          Found in lib/utils/QueryUtils.js - About 35 mins to fix

                            Function trim has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                            Open

                            function trim (arg) {
                                var match = arg.match(/^function\s*[^\(]*\([^\)]*\)\s*{/);
                                if (!match) throw error(arg);
                            
                                // we included the first "{" in our match
                            Severity: Minor
                            Found in lib/mongoose-plugins/mongoose-injector/lib/button/type.js - About 35 mins 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

                            Avoid too many return statements within this function.
                            Open

                                                    return [4 /*yield*/, util_2.promisify(fs.exists)(outputFile)];
                            Severity: Major
                            Found in lib/engine/routeinjector/images/GalleryInjector.js - About 30 mins to fix

                              Avoid too many return statements within this function.
                              Open

                                              return next();
                              Severity: Major
                              Found in lib/engine/routeinjector/routes/auth/utils.js - About 30 mins to fix

                                Avoid too many return statements within this function.
                                Open

                                                        return [3 /*break*/, 5];
                                Severity: Major
                                Found in lib/engine/routeinjector/images/GalleryInjector.js - About 30 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                                          return [3 /*break*/, 13];
                                  Severity: Major
                                  Found in lib/engine/routeinjector/images/GalleryInjector.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                            if (!!(_b.sent())) return [3 /*break*/, 4];
                                    Severity: Major
                                    Found in lib/engine/routeinjector/images/GalleryInjector.js - About 30 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language