mindjs/mindjs

View on GitHub

Showing 11 of 33 total issues

exports has 30 functions (exceeds 20 allowed). Consider refactoring.
Open

module.exports = class MindPlatform {

  /**
   * @param {{
   *  platformProvidersOverride: Provider|Injectable[], list of providers that should be overridden. Any of platform provider can be overridden by providing it in application module
Severity: Minor
Found in packages/core/src/lib/framework/platform-base.js - About 3 hrs to fix

    File core.js has 314 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    const { flatten, isFunction, every, get } = require('lodash');
    
    const {
      ReflectiveInjector,
    } = require('@mindjs/common/DI');
    Severity: Minor
    Found in packages/core/src/lib/framework/core.js - About 3 hrs to fix

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

        static async initModuleDI(moduleDI, platform = undefined) {
          if (!(moduleDI && moduleDI.module)) {
            return;
          }
      
      
      Severity: Minor
      Found in packages/core/src/lib/framework/core.js - About 2 hrs to fix

        Function initRoutingModulesDI has 38 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static async initRoutingModulesDI(moduleDI) {
            const { rootInjector, injector: parentModuleInjector, module: parentModule } = moduleDI;
        
            const routingModules = await Mind.extractRoutingModules({
              rootInjector,
        Severity: Minor
        Found in packages/core/src/lib/framework/core.js - About 1 hr to fix

          Function _prepareRouteDescriptor has 38 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            async _prepareRouteDescriptor(routeDescriptor, prefix = '') {
              if (!(this.moduleInjector && routeDescriptor)) {
                throw new Error('Invalid input.');
              }
          
          
          Severity: Minor
          Found in packages/routing/src/routing.module.js - About 1 hr to fix

            Function initAndStart has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              async initAndStart() {
                if (!this.rootModuleDI || this.isAppMindInitiated) {
                  return this;
                }
            
            
            Severity: Minor
            Found in packages/core/src/lib/framework/core.js - About 1 hr to fix

              Function invokeInitializers has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                static async invokeInitializers(rootDI = {}, platform) {
                  const { rootInjector, injector } = rootDI;
              
                  if (!rootInjector) {
                    throw new Error(('injector was not provided'));
              Severity: Minor
              Found in packages/core/src/lib/framework/core.js - About 1 hr to fix

                Function _prepareRouteDescriptor has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                  async _prepareRouteDescriptor(routeDescriptor, prefix = '') {
                    if (!(this.moduleInjector && routeDescriptor)) {
                      throw new Error('Invalid input.');
                    }
                
                
                Severity: Minor
                Found in packages/routing/src/routing.module.js - About 55 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 initModuleDI has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  static async initModuleDI(moduleDI, platform = undefined) {
                    if (!(moduleDI && moduleDI.module)) {
                      return;
                    }
                
                
                Severity: Minor
                Found in packages/core/src/lib/framework/core.js - About 35 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

                Avoid too many return statements within this function.
                Open

                  return result;
                Severity: Major
                Found in packages/common/src/utils/invoke.utils.js - About 30 mins to fix

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

                  async function invokeAll(...args) {
                    if (!args.length) {
                      return [];
                    }
                  
                  
                  Severity: Minor
                  Found in packages/common/src/utils/invoke.utils.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