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
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
- Read upRead up
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
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)
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) {
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()
- Read upRead up
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)
Function registerApplicationByLink
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
registerApplicationByLink(
appName: string,
link?: string,
activeWhen?: {},
customProps: object = {}
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') {
- Read upRead up
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)
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) => {
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) {
Function registerApplication
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
registerApplication(
appName: string,
appConfig?: any,
activeWhen?: {},
customProps: object = {}
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) {
- Read upRead up
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) {
- Read upRead up
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)
- Read upRead up
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) {
- Read upRead up
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
- Read upRead up
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
- Read upRead up
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) => {
LoaderHelper.loadAllAssetsByUrl(app.appConfig).then(resolve, reject)
})