18F/e-QIP-prototype

View on GitHub

Showing 132 of 502 total issues

Function func has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    func: (value, props) => {
      if (!props.required) {
        return true
      }

Severity: Minor
Found in src/components/Form/Location/ToggleableLocation.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 CivilUnion.Unmarshal has 22 return statements (exceeds 10 allowed).
Open

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

    Function render has 266 lines of code (exceeds 255 allowed). Consider refactoring.
    Open

      render() {
        const { prefix } = this.props
        return (
          <div className="interest">
            <Field

      Function flattenObject has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      export const flattenObject = obj => {
        let s = ''
        let what = Object.prototype.toString.call(obj)
        switch (what) {
          case '[object Object]':
      Severity: Minor
      Found in src/components/Form/ValidationElement/helpers.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 TelephoneSummary has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      export const TelephoneSummary = (props, unknown = '') => {
        if (!props) {
          return unknown
        }
      
      
      Severity: Minor
      Found in src/components/Summary/TelephoneSummary.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 render has 265 lines of code (exceeds 255 allowed). Consider refactoring.
      Open

        render() {
          const { requireExpirationDate } = this.props
          return (
            <div className="foreign-born-documents">
              <Field
      Severity: Major
      Found in src/components/Form/ForeignBornDocuments/ForeignBornDocuments.jsx - About 1 hr to fix

        Function appropriateValue has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          appropriateValue(value, multiple = false) {
            if (!value) {
              if (multiple) {
                return []
              }
        Severity: Minor
        Found in src/components/Form/Country/Country.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 CitizenshipStatus.Unmarshal has a Cognitive Complexity of 26 (exceeds 20 allowed). Consider refactoring.
        Open

        func (entity *CitizenshipStatus) Unmarshal(raw []byte) error {
            err := json.Unmarshal(raw, entity)
            if err != nil {
                return err
            }
        Severity: Minor
        Found in api/citizenship.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

        Method applicationPackager.locationOverrideLayout has 19 return statements (exceeds 10 allowed).
        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))
        Severity: Major
        Found in api/xml/xml.go - About 1 hr to fix

          Function populateCurrentAddress has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

          export const populateCurrentAddress = history => {
            const items = (((history || {}).Residence || {}).List || {}).items || []
            if (items.length === 0) {
              return history
            }
          Severity: Minor
          Found in src/reducers/history.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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            render() {
              const { prefix } = this.props
              const klass = [
                `name ${this.props.className || ''}`.trim(),
                this.props.disabled ? 'disabled' : '',
          Severity: Minor
          Found in src/components/Form/Name/Name.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 InjectGaps has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          export const InjectGaps = (list = [], start) => {
            // Let us just make sure we clear any previous gaps
            list = list.filter(item => !item.type || (item.type && item.type !== 'Gap'))
          
            const hasDates = (item) => {
          Severity: Minor
          Found in src/components/Section/History/summaries.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 arrayValidator has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          const arrayValidator = (value, options, key, attributes, globalOptions) => {
            if (validate.isEmpty(value)) return null // Don't validate if there is no value
          
            const { values } = value
            if (!values) return MISSING_ITEMS
          Severity: Minor
          Found in src/models/validators/array.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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            render() {
              if (!this.allowed()) {
                return null
              }
          
          
          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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            render() {
              const children = React.Children.map(this.props.children, checkbox => {
                let checked = null
          
                // Handle empty array case so that .find() doesn't error
          Severity: Minor
          Found in src/components/Form/CheckboxGroup/CheckboxGroup.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 Benefit.Unmarshal has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
          Open

          func (entity *Benefit) Unmarshal(raw []byte) error {
              err := json.Unmarshal(raw, entity)
              if err != nil {
                  return err
              }
          Severity: Minor
          Found in api/benefit.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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

            render() {
              const { selectedValue } = this.props;
              const name = this.props.name ? `${this.state.uid}-${this.props.name}` : null
              const children = React.Children.map(this.props.children, child => {
                // If type is not Radio, stop
          Severity: Minor
          Found in src/components/Form/RadioGroup/RadioGroup.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 letters has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

          const letters = obj => {
            if (!obj) {
              return 0
            }
          
          
          Severity: Minor
          Found in src/components/Summary/Summary.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 CitizenshipStatus.Marshal has a Cognitive Complexity of 25 (exceeds 20 allowed). Consider refactoring.
          Open

          func (entity *CitizenshipStatus) Marshal() Payload {
              if entity.CitizenshipStatus != nil {
                  entity.PayloadCitizenshipStatus = entity.CitizenshipStatus.Marshal()
              }
              if entity.AbroadDocumentation != nil {
          Severity: Minor
          Found in api/citizenship.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

          Consider simplifying this complex logical expression.
          Open

            if (options.requireRelationshipRelativesForeignBornDoc) {
              return !!((
                isCitizen(attributes)
                && !wasBornInUS(attributes)
                && !isLiving(attributes)
          Severity: Major
          Found in src/models/relative.js - About 1 hr to fix
            Severity
            Category
            Status
            Source
            Language