Showing 24 of 42 total issues

Function bootstrap has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function bootstrap(app: MooaApp) {
  if (!window['mooa']) {
    window.mooa = {}
  }
  window.mooa.isSingleSpa = true
Severity: Major
Found in src/loader/mooa.loader.ts - About 2 hrs to fix

    Function bootstrap has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

    function bootstrap(app: MooaApp) {
      if (!window['mooa']) {
        window.mooa = {}
      }
      window.mooa.isSingleSpa = true
    Severity: Minor
    Found in src/loader/mooa.loader.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 reasonableTime has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function reasonableTime(
      promise: any,
      description: any,
      timeoutConfig: any,
      app?: any
    Severity: Minor
    Found in src/helper/timeouts.ts - About 1 hr to fix

      Function reRouter has 39 lines of code (exceeds 25 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 1 hr to fix

        Function createApplicationIframeContainer has 38 lines of code (exceeds 25 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 1 hr to fix

          Function loadLinkTag has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          const loadLinkTag = (url: string, iframeEl?: any) => {
            return () => {
              return new Promise((resolve, reject) => {
                if (document.getElementById(hashCode(url))) {
                  return resolve()
          Severity: Minor
          Found in src/helper/loader.helper.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 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

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

                      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

                      Avoid too many return statements within this function.
                      Open

                            return new Promise((resolve, reject) => {
                              resolve()
                            })
                      Severity: Major
                      Found in src/loader/mooa.loader.ts - About 30 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language