Showing 132 of 502 total issues
Consider simplifying this complex logical expression. Open
if (o.BenefitFrequency) {
switch (o.BenefitFrequency.value) {
case 'OneTime':
b = o.OneTimeBenefit || {}
benefit.Country = (b.Country || {}).value
Consider simplifying this complex logical expression. Open
if (options.requireRelationshipRelativesForeignBornDoc) {
return !!((
isCitizen(attributes)
&& !wasBornInUS(attributes)
&& !isLiving(attributes)
Consider simplifying this complex logical expression. Open
if (value === null
|| value === undefined
|| value === ''
|| (Array.isArray(value) && value.length === 0)
|| (value.constructor === Object && Object.keys(value).length === 0)) {
Function onBranchClick
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
onBranchClick(item, index, values) {
const {
items, valueKey, removable, onUpdate,
} = this.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 render
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
render() {
const klass = `${
this.props.hideMonth && this.props.hideDay ? '' : 'datecontrol'
} ${
this.state.error && !this.props.overrideError ? 'usa-input-error' : ''
- 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 containsRequiredItems
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const containsRequiredItems = (value, options = {}) => {
if (validate.isEmpty(value)) return null // Don't validate if there is no value
const { items } = value
if (!items || (items && items.length < 1)) return MISSING_ITEMS
- 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 login
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function* login({ username, password }) {
try {
const response = yield call(api.login, username, password)
yield put(handleLoginSuccess(response))
- 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 DiplomaSummary
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const DiplomaSummary = (item) => {
if (((item.Diplomas || {}).items || []).length === 0) {
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 Summary
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const Summary = (props = {}) => {
props = {
type: 'Item',
index: -1,
left: '',
- 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 getFormSections
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
(formType, disciplinaryProceduresHidden, selectiveServiceHidden, existingConditionsHidden) => {
// Make a copy b/c we are going to mutate this
// Might want to add & use update here to make this easier
let formTypeSections = formTypeConfig[formType]
- 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 reduceSubsections
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const reduceSubsections = (sections, parentPath, breadcrumbs = [], parentStore) => (
sections.reduce((accumulator, section) => {
if (section.subsections && section.subsections.length) {
const builtPath = parentPath
? `${parentPath}/${section.path}`
- 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 validMiddle
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
validMiddle() {
if (this.hideMiddleName) {
return 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
Method Benefit.Unmarshal
has 14 return statements (exceeds 10 allowed). Open
func (entity *Benefit) Unmarshal(raw []byte) error {
err := json.Unmarshal(raw, entity)
if err != nil {
return err
}
Function componentDidMount
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
componentDidMount() {
if (this.props.children) {
let arr = []
for (let child of this.props.children) {
if (child && child.type === 'option') {
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
func: (value, props) => {
if (props.required) {
if (props.allowNotApplicable && props.noNumber) {
return 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
Avoid deeply nested control flow statements. Open
if saveAgainErr != nil {
// this time, nothing will save you.
service.Log.WarnError(api.EntitySaveError, saveAgainErr, api.LogFields{})
RespondWithStructuredError(w, api.EntitySaveError, http.StatusInternalServerError)
return
Function render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
Education, formType, inReview, errors, data,
} = this.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 validateFields
has a Cognitive Complexity of 23 (exceeds 20 allowed). Consider refactoring. Open
func validateFields(entity *Location, props ...string) ErrorStack {
var stack ErrorStack
for _, prop := range props {
switch strings.ToLower(prop) {
- 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 renderMessage
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const renderMessage = (id, messageString, titleString) => {
const noteId = `${id}.note`
let note = i18n.m(noteId)
if (
Object.prototype.toString.call(note) === '[object 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 validPhoneNumber
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const validPhoneNumber = (phone, opts = { numberType: false }) => {
if (!phone) {
return false
}
if (phone.noNumber) {
- 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"