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)
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) {
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',
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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',
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (this.option.urlPrefix) {
appConfig.prefix = this.option.urlPrefix + '/' + appConfig.prefix
}
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (this.option.urlPrefix) {
appConfig.prefix = this.option.urlPrefix + '/' + appConfig.name
}
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Avoid too many return
statements within this function. Open
return new Promise((resolve, reject) => {
LoaderHelper.loadAllAssetsByUrl(app.appConfig).then(resolve, reject)
})
Avoid too many return
statements within this function. Open
return app
Avoid too many return
statements within this function. Open
return new Promise((resolve, reject) => {
resolve()
})