arrowjs/ArrowjsCore

View on GitHub

Showing 80 of 80 total issues

Function getViewFiles has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    getViewFiles(componentName, name) {
        let self = this;
        let privateName = "_" + self.name;
        /* istanbul ignore next */
        let extension = self._app._config.viewExtension || "html";
Severity: Minor
Found in manager/SystemManager.js - About 1 hr to fix

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

    module.exports = function routeAttribute(setting, fatherPath, component, application) {
        let files = getListFile(setting, fatherPath, application);
        if (files.type === "single") {
            Object.keys(files).map(function (key) {
                if (key !== "type") {
    Severity: Minor
    Found in manager/handleAttribute/route.js - About 1 hr to fix

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

      module.exports = function controllerAttribute(setting, fatherPath, component, application) {
          let files = getListFile(setting, fatherPath, application);
          if (files.type === "single") {
              Object.keys(files).map(function (key) {
                  if (key !== "type") {
      Severity: Minor
      Found in manager/handleAttribute/controller.js - About 1 hr to fix

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

                        if (components[name]._structure.model) {
                            let data = actionByAttribute("model", components[name], paths[name].path, _app);
                            _.assign(components[name], data);
                        }
        Severity: Major
        Found in manager/SystemManager.js and 5 other locations - About 1 hr to fix
        manager/SystemManager.js on lines 151..154
        manager/SystemManager.js on lines 161..164
        manager/SystemManager.js on lines 166..169
        manager/SystemManager.js on lines 171..174
        manager/SystemManager.js on lines 176..179

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

        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 6 locations. Consider refactoring.
        Open

                        if (components[name]._structure.controller) {
                            let data = actionByAttribute("controller", components[name], paths[name].path, _app);
                            _.assign(components[name], data);
                        }
        Severity: Major
        Found in manager/SystemManager.js and 5 other locations - About 1 hr to fix
        manager/SystemManager.js on lines 151..154
        manager/SystemManager.js on lines 156..159
        manager/SystemManager.js on lines 161..164
        manager/SystemManager.js on lines 171..174
        manager/SystemManager.js on lines 176..179

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

        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 6 locations. Consider refactoring.
        Open

                        if (components[name]._structure.action) {
                            let data = actionByAttribute("action", components[name], paths[name].path, _app);
                            _.assign(components[name], data);
                        }
        Severity: Major
        Found in manager/SystemManager.js and 5 other locations - About 1 hr to fix
        manager/SystemManager.js on lines 151..154
        manager/SystemManager.js on lines 156..159
        manager/SystemManager.js on lines 166..169
        manager/SystemManager.js on lines 171..174
        manager/SystemManager.js on lines 176..179

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

        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 6 locations. Consider refactoring.
        Open

                        if (components[name]._structure.extend) {
                            let data = actionByAttribute("extend", components[name], paths[name].path, _app);
                            _.assign(components[name], data);
                        }
        Severity: Major
        Found in manager/SystemManager.js and 5 other locations - About 1 hr to fix
        manager/SystemManager.js on lines 156..159
        manager/SystemManager.js on lines 161..164
        manager/SystemManager.js on lines 166..169
        manager/SystemManager.js on lines 171..174
        manager/SystemManager.js on lines 176..179

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

        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 6 locations. Consider refactoring.
        Open

                        if (components[name]._structure.route) {
                            let data = actionByAttribute("route", components[name], paths[name].path, _app);
                            _.assign(components[name], data);
                        }
        Severity: Major
        Found in manager/SystemManager.js and 5 other locations - About 1 hr to fix
        manager/SystemManager.js on lines 151..154
        manager/SystemManager.js on lines 156..159
        manager/SystemManager.js on lines 161..164
        manager/SystemManager.js on lines 166..169
        manager/SystemManager.js on lines 171..174

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

        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 6 locations. Consider refactoring.
        Open

                        if (components[name]._structure.view) {
                            let data = actionByAttribute("view", components[name], paths[name].path, _app);
                            _.assign(components[name], data);
                        }
        Severity: Major
        Found in manager/SystemManager.js and 5 other locations - About 1 hr to fix
        manager/SystemManager.js on lines 151..154
        manager/SystemManager.js on lines 156..159
        manager/SystemManager.js on lines 161..164
        manager/SystemManager.js on lines 166..169
        manager/SystemManager.js on lines 176..179

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

        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 configRenderLayout has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    .then(function configRenderLayout() {
                        let viewEngineSetting = _.assign(self._config.nunjuckSettings || {}, {express: self._expressApplication});
                        let applicationView = ViewEngine(self.arrFolder, viewEngineSetting, self);
                        self.applicationENV = applicationView;
        
        
        Severity: Minor
        Found in libs/ArrowApplication.js - About 1 hr to fix

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

          module.exports.getGlobbedFiles = function (globPatterns, removeRoot) {
              // For context switching
              let _this = this;
          
              // URL paths regex
          Severity: Minor
          Found in libs/global_function.js - About 1 hr to fix

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

                            if (self[privateName][componentName][name] && self[privateName][componentName][name].views) {
                                self[privateName][componentName][name].views.map(function (obj) {
                                    let miniPath = handleView(obj, self, componentName);
                                    pathFolder.push(miniPath);
                                })
            Severity: Major
            Found in manager/SystemManager.js and 1 other location - About 1 hr to fix
            manager/SystemManager.js on lines 311..316

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

            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

                                Object.keys(self[privateName][componentName].views).map(function (key) {
                                    self[privateName][componentName].views[key].map(function (obj) {
                                        let miniPath = handleView(obj, self, componentName);
                                        pathFolder.push(miniPath);
                                    })
            Severity: Major
            Found in manager/SystemManager.js and 1 other location - About 1 hr to fix
            manager/SystemManager.js on lines 298..303

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

            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 getGlobbedFiles has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            module.exports.getGlobbedFiles = function (globPatterns, removeRoot) {
                // For context switching
                let _this = this;
            
                // URL paths regex
            Severity: Minor
            Found in libs/global_function.js - About 1 hr 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

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

                        if (!_.isEmpty(arrow.beforeAuth)) {
                            arrow.beforeAuth.map(function (func) {
                                arrayHandler.splice(0, 0, func)
                            })
                        }
            Severity: Major
            Found in libs/ArrowApplication.js and 1 other location - About 1 hr to fix
            libs/ArrowApplication.js on lines 600..604

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

            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 (!_.isEmpty(arrow.afterAuth)) {
                            arrow.afterAuth.map(function (func) {
                                arrayHandler.splice(0, 0, func)
                            })
                        }
            Severity: Major
            Found in libs/ArrowApplication.js and 1 other location - About 1 hr to fix
            libs/ArrowApplication.js on lines 614..618

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

            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 associateModels has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function associateModels(arrow) {
                let defaultDatabase = require('./database').db();
                if (arrow.models && Object.keys(arrow.models).length > 0) {
                    /* istanbul ignore next */
                    let defaultQueryResolve = function () {
            Severity: Minor
            Found in libs/ArrowApplication.js - About 1 hr to fix

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

                      Object.keys(userVariable).map(function (name) {
                          if (typeof userVariable[name] !== "function") {
                              env.addGlobal(name, userVariable[name]);
                          }
                      })
              Severity: Major
              Found in libs/global_function.js and 1 other location - About 1 hr to fix
              libs/global_function.js on lines 47..51

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

              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

                              arrayKey.map(function (name) {
                                  if (self[name]) {
                                      result = self[name];
                                      self = result;
                                  } else {
              Severity: Major
              Found in manager/ConfigManager.js and 1 other location - About 1 hr to fix
              libs/ArrowApplication.js on lines 988..995

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

              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

                          arrayKey.map(function (name) {
                              if (self[name]) {
                                  result = self[name];
                                  self = result;
                              } else {
              Severity: Major
              Found in libs/ArrowApplication.js and 1 other location - About 1 hr to fix
              manager/ConfigManager.js on lines 30..37

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

              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

              Severity
              Category
              Status
              Source
              Language