Showing 132 of 502 total issues
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
Consider simplifying this complex logical expression. Open
if (
a.Item && a.Item.Dates && validDate(a.Item.Dates.to)
&& b.Item && b.Item.Dates && validDate(b.Item.Dates.to)
) {
const aDateObj = a.Item.Dates.to
Consider simplifying this complex logical expression. Open
if (props.required) {
const country = countryString(props.country)
switch (country) {
case 'United States':
case 'POSTOFFICE':
Consider simplifying this complex logical expression. Open
if (url === '' && window) {
const loc = window.location || {}
const protocol = loc.protocol || 'http:'
const hostname = loc.hostname || 'localhost'
const port = loc.port || '8080'
Method Service.CountExpr
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func (service *Service) CountExpr(model interface{}, expr string, retval interface{}, condition string, params ...interface{}) {
Method DatabaseService.Array
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func (service *DatabaseService) Array(model interface{}, expr string, retval interface{}, condition string, params ...interface{}) {
Method Service.Array
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func (service *Service) Array(model interface{}, expr string, retval interface{}, condition string, params ...interface{}) {
Method DatabaseService.CountExpr
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
func (service *DatabaseService) CountExpr(model interface{}, expr string, retval interface{}, condition string, params ...interface{}) {
Function EducationSummaryProgress
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const EducationSummaryProgress = (props) => {
const { items, errors } = props
const validSchoolItems = items.filter((i) => {
if (!i.Item) return false
- 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 countryString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const countryString = (country) => {
if (validate.isHash(country)) {
if (country.value === null) return null
if (country.value === undefined) return undefined
- 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 SaveHandler.ServeHTTP
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
func (service SaveHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
// Get account information
account, _ := AccountAndSessionFromRequestContext(r)
- 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 handleInitSuccess
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function* handleInitSuccess(action, path = '/form/identification/intro') {
const { response } = action
if (response && response.data) {
const { Status, Hash } = response.data
- 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 errorReducer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const errorReducer = function(sectionName) {
return function(state = defaultState, action) {
// Check that section matches intended section reducer. This is to prevent
// merging of everything every time an action is dispatched. We only
// perform for the relevant section
- 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 componentWillReceiveProps
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
componentWillReceiveProps(next) {
const updates = {}
if (next.receiveProps) {
if (next.value !== this.state.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 updateSingleCountry
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
updateSingleCountry(values) {
const { value } = values
let arr
let capitalizedCountry
if (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
Method Service.validate
has 11 return statements (exceeds 10 allowed). Open
func (service *Service) validate(response *saml.Response, original string) error {
if response.Version != "2.0" {
return errors.New("unsupported SAML Version")
}
Function AddressSummary
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const AddressSummary = (props, unknown = '') => {
if (!props) {
return unknown
}
- 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 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
Method applicationPackager.locationOverrideLayout
has a Cognitive Complexity of 22 (exceeds 20 allowed). Consider refactoring. Open
func (p applicationPackager) locationOverrideLayout(data map[string]interface{}, override string) (template.HTML, error) {
// Deserialize the initial payload from a JSON structure
payload := &api.Payload{}
// entity, err := payload.UnmarshalEntity(getInterfaceAsBytes(data))
entity, err := payload.UnmarshalEntity(getInterfaceAsBytes(data))
- 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"