Showing 132 of 502 total issues
Function getSplitValue
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const getSplitValue = (key, raw, delim1, delim2) => {
const vars = raw.split(delim1)
for (let i = 0; i < vars.length; i += 1) {
const pair = vars[i].split(delim2)
- 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 this.validFields(['city', 'country'])
Avoid too many return
statements within this function. Open
return this.validFields(['city', 'stateZipcode', 'county'])
Function hasValueValidator
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const hasValueValidator = (value, options, key, attributes, globalOptions) => {
if (!value || !value.value) {
return MISSING_VALUE
}
- 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 getBackAndNext
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const getBackAndNext = (state, { currentPath }) => {
const formSections = formSectionsSelector(state, true)
const subsectionIndex = formSections.findIndex(s => s.fullPath === currentPath)
- 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 renderOptions
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
renderOptions() {
const filter = this.props.excludeUnitedStates
? x => {
return x !== 'unitedStates'
}
- 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 addressType
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
addressType() {
let { country } = this.props
if (typeof country === 'object') {
country = countryString(country)
- 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 func
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
func: (value, props) => {
if (props.isRequired) {
return value ? true : false
} else {
return value ? true: null
- 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 render
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
render() {
return (
<div className="military-service">
<Field
title={i18n.t('military.history.heading.service')}
- 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
Method CivilUnion.Unmarshal
has a Cognitive Complexity of 21 (exceeds 20 allowed). Consider refactoring. Open
func (entity *CivilUnion) Unmarshal(raw []byte) error {
err := json.Unmarshal(raw, entity)
if err != nil {
return err
}
- 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 autotab
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const autotab = (event, maxlength, back, next) => {
const input = event.target
// If there is a selection (highlighted text) within the element then we
// need to let normal operations take precedence.
- 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 decimalAdjust
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const decimalAdjust = (type, value, exp) => {
// If the exp is undefined or zero...
if (typeof exp === 'undefined' || +exp === 0) {
return Math[type](value)
}
- 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 getFormSectionStatuses
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const getFormSectionStatuses = (sections = [], store = '', state = {}) => {
const { form } = state
const newSections = sections
.filter(s => s.subsections || s.storeKey)
.map((s) => {
- 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 datetime
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
datetime: (value, attributes, attributeName, options) => {
if (options && (options.earliest || options.latest)) {
const { earliest, latest } = options
const constraints = {}
- 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
update(values, delay = null, blur = false) {
// Get the next values
const next = {
street: this.props.street,
street2: this.props.street2,
- 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 render
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
requireRelationshipRelativesForeignBornDoc,
requireRelationshipRelativesUSResidenceDoc,
requireRelationshipRelativesForeignGovtAffExplanation,
- 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 durationCoverageValidator
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const durationCoverageValidator = (value, options, key, attributes, globalOptions) => {
if (validate.isEmpty(value)) return null // Don't validate if there is no value
const { requiredDuration } = options
if (!requiredDuration) return INVALID_DURATION
- 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 handleError
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
handleError(value, arr) {
arr = arr.map(err => {
return {
code: `country.${err.code}`,
valid: err.valid,
- 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 configureStore
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const configureStore = (params) => {
const middleware = [
sagaMiddleware,
thunk,
]
- 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 sort
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const sort = (a, b) => {
// Helper to find the date value or default it to 0
const getOptionalDate = obj => (((obj || {}).Item || {}).Dates || {}).to
const first = extractDate(getOptionalDate(a)) || 0
- 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"