mindjs/mindjs

View on GitHub

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

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

      module.exports = {
        isDevEnvironment,
      
        toArray,
      
      
      Severity: Major
      Found in packages/common/src/utils/index.js and 1 other location - About 2 hrs to fix
      packages/common/utils.js on lines 23..42

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

      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

      module.exports = {
        isDevEnvironment,
      
        toArray,
      
      
      Severity: Major
      Found in packages/common/utils.js and 1 other location - About 2 hrs to fix
      packages/common/src/utils/index.js on lines 26..45

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

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

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

            module.exports = {
              APP_CONFIG,
              APP_INITIALIZER,
              APP_MIDDLEWARE,
              APP_MIDDLEWARE_INITIALIZER,
            Severity: Major
            Found in packages/core/src/lib/framework/index.js and 2 other locations - About 1 hr to fix
            packages/core/index.js on lines 20..31
            packages/core/src/index.js on lines 15..26

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

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

            module.exports = {
              APP_CONFIG,
              APP_INITIALIZER,
              APP_MIDDLEWARE,
              APP_MIDDLEWARE_INITIALIZER,
            Severity: Major
            Found in packages/core/index.js and 2 other locations - About 1 hr to fix
            packages/core/src/index.js on lines 15..26
            packages/core/src/lib/framework/index.js on lines 15..27

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

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

            module.exports = {
              APP_CONFIG,
              APP_INITIALIZER,
              APP_MIDDLEWARE,
              APP_MIDDLEWARE_INITIALIZER,
            Severity: Major
            Found in packages/core/src/index.js and 2 other locations - About 1 hr to fix
            packages/core/index.js on lines 20..31
            packages/core/src/lib/framework/index.js on lines 15..27

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

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

                try {
                  await this.initRouting();
                  this.appRoutingMindInitiated = true;
                } catch (e) {
                  console.error(e);
            Severity: Major
            Found in packages/core/src/lib/framework/core.js and 2 other locations - About 1 hr to fix
            packages/core/src/lib/framework/core.js on lines 417..423
            packages/core/src/lib/framework/core.js on lines 433..439

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

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

                try {
                  await this.startServer();
                  this.appServerMindStarted = true;
                } catch (e) {
                  console.error(e);
            Severity: Major
            Found in packages/core/src/lib/framework/core.js and 2 other locations - About 1 hr to fix
            packages/core/src/lib/framework/core.js on lines 417..423
            packages/core/src/lib/framework/core.js on lines 425..431

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

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

                try {
                  await this.invokeInitializers();
                  this.appServerMindInitializersInvoked = true;
                } catch (e) {
                  console.error(e);
            Severity: Major
            Found in packages/core/src/lib/framework/core.js and 2 other locations - About 1 hr to fix
            packages/core/src/lib/framework/core.js on lines 425..431
            packages/core/src/lib/framework/core.js on lines 433..439

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

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

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

                module.exports = {
                  KOA_HELMET_CONFIG,
                  KOA_BODY_PARSER_CONFIG,
                  KOA_COMPRESS_CONFIG,
                  KOA_CORS_CONFIG,
                Severity: Major
                Found in packages/platform-koa/index.js and 1 other location - About 1 hr to fix
                packages/common/DI.js on lines 13..23

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

                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

                module.exports = {
                  InjectionToken,
                  ReflectiveInjector,
                  _Inject,
                  _Optional,
                Severity: Major
                Found in packages/common/DI.js and 1 other location - About 1 hr to fix
                packages/platform-koa/index.js on lines 20..31

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

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

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

                      if (testPlatform) {
                        testAppInstance = await testPlatform.initApplicationModule(TestApplicationModule); // eslint-disable-line
                      } else {
                        testAppInstance = new Mind(TestApplicationModule);
                        await testAppInstance.initRootModuleDI();
                Severity: Minor
                Found in packages/testing/src/testing.module.js and 1 other location - About 55 mins to fix
                packages/testing/src/testing.module.js on lines 74..79

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

                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

                    if (testPlatform) {
                      testAppInstance = await testPlatform.bootstrapModule(TestApplicationModule);  // eslint-disable-line
                    } else {
                      testAppInstance = new Mind(TestApplicationModule,);
                      await testAppInstance.bootstrap();
                Severity: Minor
                Found in packages/testing/src/testing.module.js and 1 other location - About 55 mins to fix
                packages/testing/src/testing.module.js on lines 250..255

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

                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