RouteInjector/route-injector

View on GitHub

Showing 414 of 414 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

        for (let i in config.mongo.query) {
            //COPY the object
            query[i] = config.mongo.query[i];
        }
Severity: Minor
Found in lib/utils/QueryUtils.ts and 1 other location - About 40 mins to fix
lib/utils/QueryUtils.ts on lines 56..59

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 48.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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 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 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 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 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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                                    } else if (md5(hash) != result[aconf.login.password]) {
                                        log.debug("Incorrect username or password");
                                        loginInfo.statusCode = statusCode.METHOD_NOT_ALLOWED;
                                        loginInfo.json = {error: "Incorrect username or password"};
                                    } else {
                Severity: Minor
                Found in lib/engine/routeinjector/routes/auth.js and 1 other location - About 35 mins to fix
                lib/engine/routeinjector/routes/auth.js on lines 79..97

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                                    if (result == null) {
                                        log.debug("User not found");
                                        loginInfo.statusCode = statusCode.NOT_FOUND;
                                        loginInfo.json = {error: "User not found"};
                                    } else if (md5(hash) != result[aconf.login.password]) {
                Severity: Minor
                Found in lib/engine/routeinjector/routes/auth.js and 1 other location - About 35 mins to fix
                lib/engine/routeinjector/routes/auth.js on lines 83..97

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 47.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                                                req.url = req.url.split(".").slice(0, -1).join(".") + ".webp";
                Severity: Minor
                Found in lib/engine/routeinjector/images/GalleryInjector.ts and 1 other location - About 35 mins to fix
                lib/engine/routeinjector/images/GalleryInjector.ts on lines 183..183

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 46.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                                    req.url = req.url.split(".").slice(0, -1).join(".") + ".webp";
                Severity: Minor
                Found in lib/engine/routeinjector/images/GalleryInjector.ts and 1 other location - About 35 mins to fix
                lib/engine/routeinjector/images/GalleryInjector.ts on lines 233..233

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 46.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                                for (var i in config.mongo.query) {
                                    //COPY the object
                                    query[i] = config.mongo.query[i];
                                }
                Severity: Minor
                Found in lib/engine/routeinjector/typeBased/typeBased.js and 1 other location - About 35 mins to fix
                lib/engine/routeinjector/typeBased/typeBased.js on lines 417..420

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 46.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                                for (var i in config.mongo.query) {
                                    //COPY the object
                                    query[i] = config.mongo.query[i];
                                }
                Severity: Minor
                Found in lib/engine/routeinjector/typeBased/typeBased.js and 1 other location - About 35 mins to fix
                lib/engine/routeinjector/typeBased/typeBased.js on lines 511..514

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 46.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                                        req.url = req.url.split(".").slice(0, -1).join(".") + ".webp";
                Severity: Minor
                Found in lib/engine/routeinjector/images/GalleryInjector.js and 1 other location - About 35 mins to fix
                lib/engine/routeinjector/images/GalleryInjector.js on lines 184..184

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 46.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Identical blocks of code found in 2 locations. Consider refactoring.
                Open

                                    req.url = req.url.split(".").slice(0, -1).join(".") + ".webp";
                Severity: Minor
                Found in lib/engine/routeinjector/images/GalleryInjector.js and 1 other location - About 35 mins to fix
                lib/engine/routeinjector/images/GalleryInjector.js on lines 227..227

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 46.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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 kick();
                  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

                                            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