arrowjs/ArrowjsCore

View on GitHub

Showing 37 of 80 total issues

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

    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

        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

        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

          Function handleAuthenticate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          function handleAuthenticate(application, name) {
              let passport = application.passport;
              if (_.isString(name)) {
                  if (application.passportSetting[name]) {
                      let strategy = application.passportSetting[name].strategy || name;
          Severity: Minor
          Found in libs/ArrowApplication.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

          Function render has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                          self.render = function (view, options, callback) {
                              let application = self;
                              var done = callback;
          
                              var opts = options || {};
          Severity: Minor
          Found in libs/ArrowApplication.js - About 1 hr to fix

            Function makeRender has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function makeRender(req, res, application, componentView, componentName, component) {
            Severity: Minor
            Found in libs/ArrowApplication.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                          if (!data[key].path.singleton) {
                                              data[key].path.singleton = true;
                                          }
              Severity: Major
              Found in libs/buildStructure.js - About 45 mins to fix

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

                function handlePath(pathInfo, attribute, level) {
                    /* istanbul ignore else */
                    if (pathInfo) {
                        let singleton = handleSingleton(pathInfo.singleton);
                        let folderName = handleFolder(pathInfo.folder);
                Severity: Minor
                Found in libs/buildStructure.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

                Function handleComponentRouteSetting has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function handleComponentRouteSetting(arrow, componentRouteSetting, defaultRouteConfig, key, setting, componentKey) {
                Severity: Minor
                Found in libs/ArrowApplication.js - About 45 mins to fix

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

                      start(setting) {
                          let self = this;
                  
                          self.arrowSettings = setting;
                          let stackBegin;
                  Severity: Minor
                  Found in libs/ArrowApplication.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

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

                  function overrideViewRender(application, componentView, componentName, component, key) {
                  Severity: Minor
                  Found in libs/ArrowApplication.js - About 35 mins to fix

                    Avoid too many return statements within this function.
                    Open

                                                    return 0
                    Severity: Major
                    Found in libs/ArrowApplication.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                                      return 1
                      Severity: Major
                      Found in libs/ArrowApplication.js - About 30 mins to fix

                        Function associateModels has a Cognitive Complexity of 6 (exceeds 5 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 25 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

                        Function getPermissions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Open

                            getPermissions(name) {
                                let self = this;
                                let privateName = "_" + self.name;
                                let result = {};
                                if (name) {
                        Severity: Minor
                        Found in manager/SystemManager.js - About 25 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

                        Severity
                        Category
                        Status
                        Source
                        Language