arrowjs/ArrowjsCore

View on GitHub

Showing 37 of 80 total issues

File ArrowApplication.js has 758 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

/**
 * Module dependencies.
 */
Severity: Major
Found in libs/ArrowApplication.js - About 1 day to fix

    Function getRawConfig has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
    Open

    module.exports.getRawConfig = function getRawConfig() {
        let conf = {};
    
        //get config.js
        try {
    Severity: Minor
    Found in libs/global_function.js - About 7 hrs 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 start has 168 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        start(setting) {
            let self = this;
    
            self.arrowSettings = setting;
            let stackBegin;
    Severity: Major
    Found in libs/ArrowApplication.js - About 6 hrs to fix

      Function getRawConfig has 128 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      module.exports.getRawConfig = function getRawConfig() {
          let conf = {};
      
          //get config.js
          try {
      Severity: Major
      Found in libs/global_function.js - About 5 hrs to fix

        Function loadComponents has 105 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            loadComponents() {
                let self = this;
                //See /config/structure.js and /lib/buildStructure.js
                let struc = self._app.structure[self.name];
                let _base = self._app.arrFolder;
        Severity: Major
        Found in manager/SystemManager.js - About 4 hrs to fix

          Function handleError has 103 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function handleError(app) {
              /** Assume 'not found' in the error msg is a 404.
               * This is somewhat silly, but valid, you can do whatever you like, set properties, use instanceof etc.
               */
              app.use(function (err, req, res, next) {
          Severity: Major
          Found in libs/ArrowApplication.js - About 4 hrs to fix

            File global_function.js has 328 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            'use strict';
            
            const _ = require('lodash'),
                glob = require('glob'),
                fs = require('fs'),
            Severity: Minor
            Found in libs/global_function.js - About 3 hrs to fix

              Function handleComponentRouteSetting has 81 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function handleComponentRouteSetting(arrow, componentRouteSetting, defaultRouteConfig, key, setting, componentKey) {
                  let component = arrow[key][componentKey];
                  let componentName = arrow[key][componentKey].name;
                  let viewInfo = arrow[key][componentKey].views;
                  //Handle Route Path;
              Severity: Major
              Found in libs/ArrowApplication.js - About 3 hrs to fix

                File SystemManager.js has 298 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                "use strict";
                const __ = require('../libs/global_function'),
                    events = require('events'),
                    path = require('path'),
                    _ = require('lodash'),
                Severity: Minor
                Found in manager/SystemManager.js - About 3 hrs to fix

                  Function arrayMethod has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          let arrayMethod = Object.keys(componentRouteSetting[path_name]).filter(function (method) {
                              if (componentRouteSetting[path_name][method].name) {
                                  arrow._arrRoutes[componentRouteSetting[path_name][method].name] = path.normalize(prefix + routePath);
                              }
                              //handle function
                  Severity: Major
                  Found in libs/ArrowApplication.js - About 2 hrs to fix

                    Function parseConfig_Structure has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    function parseConfig_Structure(obj, key, level) {
                        let newObj = {};
                        let wrapArray = [];
                        if (_.isArray(obj)) {
                            wrapArray = obj;
                    Severity: Major
                    Found in libs/buildStructure.js - About 2 hrs to fix

                      Function getAllFunction has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      exports.getAllFunction = function (env, viewSetting, app) {
                          let self = this;
                          let basePath = path.resolve(__dirname, '..', 'templateExtends/function');
                          let baseFunctionLinks = self.getGlobbedFiles(path.normalize(basePath + "/*.js"));
                          baseFunctionLinks.map(function (link) {
                      Severity: Minor
                      Found in libs/global_function.js - About 2 hrs to fix

                        Function handlePath has 44 lines of code (exceeds 25 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 1 hr to fix

                          Function getViewFiles has a Cognitive Complexity of 14 (exceeds 5 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

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

                          module.exports = function actionAttribute(setting, fatherPath, component, application) {
                              application.actions = application.actions || {};
                              application.actions[component.name] = {};
                              let files = getListFile(setting, fatherPath, application);
                              if (files.type === "single") {
                          Severity: Minor
                          Found in manager/handleAttribute/action.js - About 1 hr to fix

                            Function constructor has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                constructor(setting) {
                                    //if NODE_ENV does not exist, use development by default
                                    /* istanbul ignore next */
                                    process.env.NODE_ENV = process.env.NODE_ENV || 'development';
                            
                            
                            Severity: Minor
                            Found in libs/ArrowApplication.js - About 1 hr to fix

                              Function handleRole has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function handleRole(application, permissions, componentName, key) {
                                  let arrayPermissions = [];
                                  if (_.isArray(permissions)) {
                                      arrayPermissions = permissions
                                  } else {
                              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 getAllCustomFilter has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              exports.getAllCustomFilter = function (env, viewSetting, app) {
                                  let self = this;
                              
                                  let basePath = path.resolve(__dirname, '..', 'templateExtends/filter');
                                  let baseFilterLinks = self.getGlobbedFiles(path.normalize(basePath + "/*.js"));
                              Severity: Minor
                              Found in libs/global_function.js - About 1 hr to fix

                                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
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language