Showing 12 of 42 total issues
Function requireUniversalModule
has a Cognitive Complexity of 71 (exceeds 5 allowed). Consider refactoring. Open
export default function requireUniversalModule<Props: Props>(
universalConfig: Config | ConfigFunc,
options: ModuleOptions,
props: Props,
prevProps?: Props
- 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 universal
has 221 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function universal<Props: Props>(
asyncModule: Config | ConfigFunc,
opts: ComponentOptions = {}
) {
const {
File index.js
has 530 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @noflow
import path from 'path'
import React from 'react'
import renderer from 'react-test-renderer'
Function universal
has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring. Open
export default function universal<Props: Props>(
asyncModule: Config | ConfigFunc,
opts: ComponentOptions = {}
) {
const {
- 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 requireUniversalModule
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function requireUniversalModule<Props: Props>(
universalConfig: Config | ConfigFunc,
options: ModuleOptions,
props: Props,
prevProps?: Props
File requireUniversalModule.js
has 307 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @noflow
import path from 'path'
import { createPath, waitFor, normalizePath } from '../__test-helpers__'
import req, {
File index.js
has 255 lines of code (exceeds 250 allowed). Consider refactoring. Open
// @flow
import React from 'react'
import PropTypes from 'prop-types'
import hoist from 'hoist-non-react-statics'
import req from './requireUniversalModule'
Function init
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
init(props) {
const { addModule, requireSync, requireAsync, asyncOnly } = req(
asyncModule,
options,
props
Function requireAsync
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
const requireAsync = (props: Object): Promise<?any> => {
const exp = loadFromCache(chunkName, props, modCache)
if (exp) return Promise.resolve(exp)
const cachedPromise = loadFromPromiseCache(chunkName, props, promCache)
Function componentDidUpdate
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
componentDidUpdate(prevProps: Props) {
if (isDynamic || this._asyncOnly) {
const { requireSync, requireAsync, shouldUpdate } = req(
asyncModule,
options,
Function getConfig
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const getConfig = (
isDynamic: ?boolean,
universalConfig: Config | ConfigFunc,
options: ModuleOptions,
props: Props
- 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 __handleAfter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const __handleAfter = (props, state, isMount, isSync, isServer) => {
const { mod, error } = state
if (mod && !error) {
hoist(UniversalComponent, mod, {
- 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"