Showing 37 of 80 total issues
File ArrowApplication.js
has 758 lines of code (exceeds 250 allowed). Consider refactoring. Open
'use strict';
/**
* Module dependencies.
*/
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 {
- Read upRead up
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;
Function getRawConfig
has 128 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports.getRawConfig = function getRawConfig() {
let conf = {};
//get config.js
try {
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;
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) {
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'),
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;
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'),
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
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;
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) {
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);
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";
- Read upRead up
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") {
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';
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 {
- Read upRead up
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"));
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";
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") {