arrowjs/ArrowjsCore

View on GitHub

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

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

        baseFilterLinks.map(function (link) {
            let name = path.basename(link, ".js")
            let filter = require(link);
            /* istanbul ignore else */
            if (typeof filter === 'object' && !_.isEmpty(filter)) {
    Severity: Major
    Found in libs/global_function.js and 1 other location - About 1 day to fix
    libs/global_function.js on lines 183..201

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

    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

        filterLinks.map(function (link) {
            let name = path.basename(link, ".js");
            let filter = require(link);
            /* istanbul ignore else */
            if (typeof filter === 'object' && !_.isEmpty(filter)) {
    Severity: Major
    Found in libs/global_function.js and 1 other location - About 1 day to fix
    libs/global_function.js on lines 162..180

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

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

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

        function handleView(obj, application, componentName) {
            let miniPath = obj.func(application._config, componentName);
            let normalizePath;
            /* istanbul ignore if */
            if (miniPath[0] === path.sep) {
        Severity: Major
        Found in libs/ArrowApplication.js and 1 other location - About 4 hrs to fix
        manager/SystemManager.js on lines 350..360

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

        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

        function handleView(obj, application, componentName) {
            let miniPath = obj.func(application._config, componentName);
            let normalizePath;
            /* istanbul ignore if */
            if (miniPath[0] === path.sep) {
        Severity: Major
        Found in manager/SystemManager.js and 1 other location - About 4 hrs to fix
        libs/ArrowApplication.js on lines 728..738

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

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

            try {
                fs.accessSync(__base + 'config/error.js');
                _.assign(conf, require(__base + 'config/error'));
            } catch (err) {
        
        
        Severity: Major
        Found in libs/global_function.js and 4 other locations - About 4 hrs to fix
        libs/global_function.js on lines 302..315
        libs/global_function.js on lines 333..344
        libs/global_function.js on lines 347..358
        libs/global_function.js on lines 397..408

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

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

            try {
                fs.accessSync(__base + 'config/view.js');
                _.assign(conf, require(__base + 'config/view'));
            } catch (err) {
                /* istanbul ignore else */
        Severity: Major
        Found in libs/global_function.js and 4 other locations - About 4 hrs to fix
        libs/global_function.js on lines 302..315
        libs/global_function.js on lines 318..330
        libs/global_function.js on lines 333..344
        libs/global_function.js on lines 397..408

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

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

            try {
                fs.accessSync(__base + 'config/websocket.js');
                _.assign(conf, require(__base + 'config/websocket'));
            } catch (err) {
        
        
        Severity: Major
        Found in libs/global_function.js and 4 other locations - About 4 hrs to fix
        libs/global_function.js on lines 318..330
        libs/global_function.js on lines 333..344
        libs/global_function.js on lines 347..358
        libs/global_function.js on lines 397..408

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

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

            try {
                fs.accessSync(__base + 'config/database.js');
                _.assign(conf, require(__base + 'config/database'));
            } catch (err) {
                /* istanbul ignore else */
        Severity: Major
        Found in libs/global_function.js and 4 other locations - About 4 hrs to fix
        libs/global_function.js on lines 302..315
        libs/global_function.js on lines 318..330
        libs/global_function.js on lines 333..344
        libs/global_function.js on lines 347..358

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

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

            try {
                fs.accessSync(__base + 'config/redis.js');
                _.assign(conf, require(__base + 'config/redis'));
            } catch (err) {
                /* istanbul ignore else */
        Severity: Major
        Found in libs/global_function.js and 4 other locations - About 4 hrs to fix
        libs/global_function.js on lines 302..315
        libs/global_function.js on lines 318..330
        libs/global_function.js on lines 347..358
        libs/global_function.js on lines 397..408

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

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

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

                      beforeAuthenticate(func) {
                          let self = this;
                          /* istanbul ignore next */
                          return new Promise(function (fulfill, reject) {
                              if (typeof func == "function") {
                  Severity: Major
                  Found in libs/ArrowApplication.js and 1 other location - About 3 hrs to fix
                  libs/ArrowApplication.js on lines 153..164

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

                  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

                      afterAuthenticate(func) {
                          let self = this;
                          /* istanbul ignore next */
                          return new Promise(function (fulfill, reject) {
                              if (typeof func == "function") {
                  Severity: Major
                  Found in libs/ArrowApplication.js and 1 other location - About 3 hrs to fix
                  libs/ArrowApplication.js on lines 135..146

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

                  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