Showing 10 of 36 total issues
Function withState
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const withState = (WrappedComponent) => {
class StateWrapper extends PureComponent {
constructor (props) {
super(props)
Function getDerivedStateFromProps
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
static getDerivedStateFromProps (props, state) {
const newIdProp = !!props.id && props.id !== state.idReference
const buildRecord = !props.id && props.id !== state.idReference
const newRecord = !!props.moon && (props.moon !== state.recordReference)
const recordNotFoundInCache = props.id && !props.moon
Function getDerivedStateFromProps
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
static getDerivedStateFromProps (props, state) {
const newIdProp = !!props.id && props.id !== state.idReference
const buildRecord = !props.id && props.id !== state.idReference
const newRecord = !!props.planet && (props.planet !== state.recordReference)
const recordNotFoundInCache = props.id && !props.planet
Function getDerivedStateFromProps
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
static getDerivedStateFromProps (props, state) {
const newIdProp = !!props.id && props.id !== state.idReference
const buildRecord = !props.id && props.id !== state.idReference
const newRecord = !!props._entity && (props._entity !== state.recordReference)
const recordNotFoundInCache = props.id && !props._entity
Avoid too many return
statements within this function. Open
return null
Avoid too many return
statements within this function. Open
return null
Avoid too many return
statements within this function. Open
return null
Function getDerivedStateFromProps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static getDerivedStateFromProps (props, state) {
const newIdProp = !!props.id && props.id !== state.idReference
const buildRecord = !props.id && props.id !== state.idReference
const newRecord = !!props.moon && (props.moon !== state.recordReference)
const recordNotFoundInCache = props.id && !props.moon
- 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 getDerivedStateFromProps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static getDerivedStateFromProps (props, state) {
const newIdProp = !!props.id && props.id !== state.idReference
const buildRecord = !props.id && props.id !== state.idReference
const newRecord = !!props.planet && (props.planet !== state.recordReference)
const recordNotFoundInCache = props.id && !props.planet
- 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 getDerivedStateFromProps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static getDerivedStateFromProps (props, state) {
const newIdProp = !!props.id && props.id !== state.idReference
const buildRecord = !props.id && props.id !== state.idReference
const newRecord = !!props._entity && (props._entity !== state.recordReference)
const recordNotFoundInCache = props.id && !props._entity
- 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"