18F/e-QIP-prototype

View on GitHub

Showing 132 of 502 total issues

File Location.jsx has 767 lines of code (exceeds 750 allowed). Consider refactoring.
Open

import React from 'react'

import { updateApplication } from 'actions/ApplicationActions'
import { i18n, env } from 'config'
import { LocationValidator } from 'validators'
Severity: Major
Found in src/components/Form/Location/Location.jsx - About 2 hrs to fix

    Function render has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

      render() {
        const {
          HomeEmail = {}, WorkEmail = {}, isReview, errors,
        } = this.props
        const klass = `${this.props.className || ''}`.trim()

    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 17 (exceeds 5 allowed). Consider refactoring.
    Open

      render() {
        const {
          requireForeignCounterIntelligence,
          requireForeignExcessiveKnowledge,
          requireForeignSensitiveInformation,
    Severity: Minor
    Found in src/components/Section/Foreign/Travel/TravelQuestions.jsx - About 2 hrs to fix

    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 branchCollectionValidator has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

    const branchCollectionValidator = (value, options, key, attributes, globalOptions) => {
      if (value === undefined) return null // Only validate if there's a value
      if (value === null) return MISSING_ITEMS
    
      const { items } = value
    Severity: Minor
    Found in src/models/validators/branchCollection.js - About 2 hrs to fix

    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 17 (exceeds 5 allowed). Consider refactoring.
    Open

      render() {
        const instateZipcode = this.zipcodeInstate()
    
        const domesticFields = this.props.domesticFields.map((field) => {
          const key = `domestic-${field}`
    Severity: Minor
    Found in src/components/Form/Location/ToggleableLocation.jsx - About 2 hrs to fix

    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 constructor has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      constructor(data = {}, context = null) {
        this.month = data.month
        this.day = data.day
        this.year = data.year
        this.hideMonth = data.hideMonth
    Severity: Minor
    Found in src/validators/datecontrol.js - About 2 hrs to fix

    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 triageErrors has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    export const triageErrors = (section, previous, codes) => {
      let arr = []
    
      // First we need to persist any error messages stored in the same section
      // but not necessarily within the same scope
    Severity: Minor
    Found in src/components/Form/ValidationElement/helpers.js - About 2 hrs to fix

    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 CitizenshipStatus.Unmarshal has 27 return statements (exceeds 10 allowed).
    Open

    func (entity *CitizenshipStatus) Unmarshal(raw []byte) error {
        err := json.Unmarshal(raw, entity)
        if err != nil {
            return err
        }
    Severity: Major
    Found in api/citizenship.go - About 1 hr to fix

      Function validFields has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        validFields(fields) {
          if (!fields || !fields.length) {
            return false
          }
      
      
      Severity: Minor
      Found in src/validators/location.js - About 1 hr to fix

      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 unschema has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      export const unschema = (data) => {
        if (data === undefined || data === null) {
          return null
        }
      
      
      Severity: Minor
      Found in src/schema/schema.js - About 1 hr to fix

      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 DateSummary has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      export const DateSummary = (
        props,
        unknown = i18n.t('history.employment.default.noDate.label'),
        full = false
      ) => {
      Severity: Minor
      Found in src/components/Summary/DateSummary.js - About 1 hr to fix

      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 connectSubsection has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

      const connectSubsection = (Component, {
        key, section, subsection, store,
      }) => {
        class ConnectedSubsection extends React.Component {
          constructor(props) {
      Severity: Minor
      Found in src/components/Section/shared/SubsectionConnector.jsx - About 1 hr to fix

      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 calculateTime has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        calculateTime() {
          const { elapsed } = this.state
      
          // If there has been no time elapsed...
          if (!elapsed) {
      Severity: Minor
      Found in src/components/SavedIndicator/SavedIndicator.jsx - About 1 hr to fix

      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 275 lines of code (exceeds 255 allowed). Consider refactoring.
      Open

        render() {
          const { requireRelationshipMaritalDivorcePhoneNumber } = this.props
          const enteredCivilUnionMinDate = pickDate([this.props.applicantBirthdate, this.props.Birthdate])
          return (
            <div className="divorce">
      Severity: Major
      Found in src/components/Section/Relationships/RelationshipStatus/Divorce.jsx - About 1 hr to fix

        Function ResidenceWrapper has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        const ResidenceWrapper = (props) => {
          const {
            applicantBirthdate, formType, errors, data,
          } = props
        
        
        Severity: Minor
        Found in src/components/Section/History/Residence/ResidenceWrapper.jsx - About 1 hr to fix

        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 Location.Valid has a Cognitive Complexity of 29 (exceeds 20 allowed). Consider refactoring.
        Open

        func (entity *Location) Valid() (bool, error) {
            if entity.Validated {
                return true, nil
            }
        
        
        Severity: Minor
        Found in api/location.go - About 1 hr to fix

        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 dateRangeValidator has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        const dateRangeValidator = (value = {}, options, key, attributes, globalOptions) => {
          if (validate.isEmpty(value)) return null // Don't validate if there is no value
        
          const { from, present } = value
          const to = present
        Severity: Minor
        Found in src/models/validators/daterange.js - About 1 hr to fix

        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 validLocation has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          validLocation() {
            switch (this.layout) {
              case Layouts.BIRTHPLACE:
                if (this.isDomestic()) {
                  return this.validFields(['city', 'state', 'county'])
        Severity: Minor
        Found in src/validators/location.js - About 1 hr to fix

        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 content has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

          content() {
            const {
              items, valueKey, branchName, label, labelSize, help, content, onError,
              branchClassName, appendLabel, appendSize, appendContent, children,
            } = this.props
        Severity: Minor
        Found in src/components/Form/BranchCollection/BranchCollection.jsx - About 1 hr to fix

        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 EmploymentWrapper has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
        Open

        const EmploymentWrapper = (props) => {
          const {
            formType, errors, applicantBirthdate, data,
          } = props
        
        
        Severity: Minor
        Found in src/components/Section/History/Employment/EmploymentWrapper.jsx - About 1 hr to fix

        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

        Severity
        Category
        Status
        Source
        Language