Showing 42 of 42 total issues

Function performAppChanges has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    async function performAppChanges() {
      customEvent(MOOA_EVENT.ROUTING_BEFORE)
      const unloadPromises = StatusHelper.getAppsToUnload().map(toUnloadPromise)

      const unmountUnloadPromises = StatusHelper.getAppsToUnmount(apps)
Severity: Minor
Found in src/mooa.ts - About 1 hr to fix

    Function registerApplicationByLink has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      registerApplicationByLink(
        appName: string,
        link?: string,
        activeWhen?: {},
        customProps: object = {}
    Severity: Minor
    Found in src/mooa.ts - About 1 hr to fix

      Function unloadApplication has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      export function unloadApplication(
        appName: any,
        opts = { waitForUnmount: false }
      ) {
        if (typeof appName !== 'string') {
      Severity: Minor
      Found in src/lifecycles/unmount.ts - 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 toUnloadPromise has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export async function toUnloadPromise(app: any, mooaInstance?: any) {
        const unloadInfo = appsToUnload[app.name]
      
        if (app.status === StatusEnum.NOT_LOADED) {
          unloadingApp(app, unloadInfo)
      Severity: Minor
      Found in src/lifecycles/unload.ts - About 1 hr to fix

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

        function loadAllAssetsForIframeAndUrl(opts: any) {
          const iframeId = generateIFrameID(opts.name)
          let iframeEl: any = document.getElementById(iframeId)
          if (!iframeEl) {
            return new Promise((resolve, reject) => {
        Severity: Minor
        Found in src/helper/loader.helper.ts - About 1 hr to fix

          Function maybeTimingOut has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function maybeTimingOut(shouldError: any) {
                if (!finished) {
                  if (shouldError === true) {
                    errored = true
                    if (timeoutConfig.dieOnTimeout) {
          Severity: Minor
          Found in src/helper/timeouts.ts - About 1 hr to fix

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

            export enum MOOA_EVENT {
              LOADING = 'mooa.loading',
              BOOTSTRAPPING = 'mooa.bootstrapping',
              MOUNTING = 'mooa.mounting',
              UNLOADING = 'mooa.unloading',
            Severity: Major
            Found in src/model/constants.ts and 1 other location - About 1 hr to fix
            src/model/constants.ts on lines 1..12

            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

            export enum StatusEnum {
              NOT_LOADED = 'NOT_LOADED',
              LOADING_SOURCE_CODE = 'LOADING_SOURCE_CODE',
              NOT_BOOTSTRAPPED = 'NOT_BOOTSTRAPPED',
              BOOTSTRAPPING = 'BOOTSTRAPPING',
            Severity: Major
            Found in src/model/constants.ts and 1 other location - About 1 hr to fix
            src/model/constants.ts on lines 14..25

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

              registerApplication(
                appName: string,
                appConfig?: any,
                activeWhen?: {},
                customProps: object = {}
            Severity: Minor
            Found in src/mooa.ts - About 1 hr to fix

              Function unmount has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                unmount(module: any) {
                  if (this.isSingleSpaApp()) {
                    customEvent(MOOA_EVENT.CHILD_UNMOUNT, { name: this.name })
                    window.mooa[this.name].unmount = () => {
                      if (module) {
              Severity: Minor
              Found in src/platform/platform.ts - About 45 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 createApplicationContainer has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

              export function createApplicationContainer(mooaApp: MooaApp) {
                const opts = mooaApp.appConfig
                let el: any = document.querySelector(opts.selector)
                if (mooaApp.switchMode === 'coexist') {
                  if (el) {
              Severity: Minor
              Found in src/helper/dom.utils.ts - About 45 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 removeApplicationContainer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              export function removeApplicationContainer(app: MooaApp) {
                const opts = app.appConfig
                let el: any = document.querySelector(opts.selector)
                if (!el) {
                  return
              Severity: Minor
              Found in src/helper/dom.utils.ts - 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

              Function removeApplicationIframeContainer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              export function removeApplicationIframeContainer(app: MooaApp) {
                const iframeId = generateIFrameID(app.appConfig.name)
                let iframeEl = document.getElementById(iframeId)
                if (!iframeEl) {
                  return
              Severity: Minor
              Found in src/helper/dom.utils.ts - 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

              Function createApplicationIframeContainer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

              export function createApplicationIframeContainer(mooaApp: MooaApp) {
                const opts = mooaApp.appConfig
                if (mooaApp.switchMode === 'coexist') {
                  let iframeElement: any = isIframeElementExist(mooaApp)
                  if (iframeElement) {
              Severity: Minor
              Found in src/helper/dom.utils.ts - 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

              Function reRouter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                reRouter(eventArguments?: any) {
                  const that = this
                  async function performAppChanges() {
                    customEvent(MOOA_EVENT.ROUTING_BEFORE)
                    const unloadPromises = StatusHelper.getAppsToUnload().map(toUnloadPromise)
              Severity: Minor
              Found in src/mooa.ts - 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

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

                  if (this.option.urlPrefix) {
                    appConfig.prefix = this.option.urlPrefix + '/' + appConfig.prefix
                  }
              Severity: Minor
              Found in src/mooa.ts and 1 other location - About 35 mins to fix
              src/mooa.ts on lines 101..103

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

              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 (this.option.urlPrefix) {
                    appConfig.prefix = this.option.urlPrefix + '/' + appConfig.name
                  }
              Severity: Minor
              Found in src/mooa.ts and 1 other location - About 35 mins to fix
              src/mooa.ts on lines 49..51

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

              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

              Avoid too many return statements within this function.
              Open

                  return new Promise((resolve, reject) => {
                    LoaderHelper.loadAllAssets(app.appConfig).then(resolve, reject)
                  })
              Severity: Major
              Found in src/loader/mooa.loader.ts - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                  return app
                Severity: Major
                Found in src/lifecycles/unload.ts - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                      return app
                  Severity: Major
                  Found in src/lifecycles/unload.ts - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language