Showing 502 of 502 total issues

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

Severity: Minor
Found in src/validators/location.js - About 35 mins 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 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")
    }

Severity: Major
Found in api/saml/saml.go - About 35 mins to fix

    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
    Severity: Minor
    Found in src/components/Section/History/Education/EducationSummaryProgress.jsx - About 35 mins 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 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
    Severity: Minor
    Found in src/reducers/error.js - About 35 mins 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

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        this.state = {
          uid: `${props.name}-${super.guid()}`,
          error: false
        }
    Severity: Minor
    Found in src/components/Form/RadioGroup/RadioGroup.jsx and 1 other location - About 35 mins to fix
    src/components/Form/CheckboxGroup/CheckboxGroup.jsx on lines 7..10

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Identical blocks of code found in 2 locations. Consider refactoring.
    Open

        this.state = {
          uid: `${props.name}-${super.guid()}`,
          error: false
        }
    Severity: Minor
    Found in src/components/Form/CheckboxGroup/CheckboxGroup.jsx and 1 other location - About 35 mins to fix
    src/components/Form/RadioGroup/RadioGroup.jsx on lines 8..11

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 46.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Avoid too many return statements within this function.
    Open

            return this.validFields(['city', 'country'])
    Severity: Major
    Found in src/validators/location.js - About 30 mins to fix

      Identical blocks of code found in 3 locations. Consider refactoring.
      Open

          this.state = {
            uid: `${this.props.name}-${super.guid()}`
          }
      Severity: Minor
      Found in src/components/Form/MultipleDropdown/MultipleDropdown.jsx and 2 other locations - About 30 mins to fix
      src/components/Form/Name/Name.jsx on lines 14..16
      src/components/Form/SSN/SSN.jsx on lines 18..20

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 45.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Avoid too many return statements within this function.
      Open

                return this.validFields(['city', 'stateZipcode', 'county'])
      Severity: Major
      Found in src/validators/location.js - About 30 mins to fix

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            this.state = {
              uid: `${this.props.name}-${super.guid()}`
            }
        Severity: Minor
        Found in src/components/Form/SSN/SSN.jsx and 2 other locations - About 30 mins to fix
        src/components/Form/MultipleDropdown/MultipleDropdown.jsx on lines 9..11
        src/components/Form/Name/Name.jsx on lines 14..16

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Identical blocks of code found in 3 locations. Consider refactoring.
        Open

            this.state = {
              uid: `${this.props.name}-${super.guid()}`,
            }
        Severity: Minor
        Found in src/components/Form/Name/Name.jsx and 2 other locations - About 30 mins to fix
        src/components/Form/MultipleDropdown/MultipleDropdown.jsx on lines 9..11
        src/components/Form/SSN/SSN.jsx on lines 18..20

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 45.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        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)
        
        
        Severity: Minor
        Found in src/helpers/navigation.js - About 25 mins 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 branchValue has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        const branchValue = (value) => {
          let country = value
        
          if (typeof country === 'object') {
            country = countryString(value)
        Severity: Minor
        Found in src/components/Form/Location/ToggleableLocation.jsx - About 25 mins 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 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,
        Severity: Minor
        Found in src/components/Form/Location/Address.jsx - About 25 mins 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 renderOptions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          renderOptions() {
            const filter = this.props.excludeUnitedStates
              ? x => {
                  return x !== 'unitedStates'
                }
        Severity: Minor
        Found in src/components/Form/Country/Country.jsx - About 25 mins 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 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)
          }
        Severity: Minor
        Found in src/components/Section/History/dateranges.js - About 25 mins 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 ApiBaseURL has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          ApiBaseURL() {
            let url = process.env.API_BASE_URL || ''
        
            if (url === '' && window) {
              const loc = window.location || {}
        Severity: Minor
        Found in src/config/environment.js - About 25 mins 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 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
            }
        Severity: Minor
        Found in api/civilunion.go - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
        Open

          render() {
            const option = this.state.options
              .filter(v => {
                return [v.text.toLowerCase(), v.value.toLowerCase()].includes(
                  this.state.value.toLowerCase()
        Severity: Minor
        Found in src/components/Form/Dropdown/Dropdown.jsx - About 25 mins 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 name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          name(formatted = true) {
            if ((this.props.Name || {}).value) {
              return formatted ? (
                <span className="title-case">{this.props.Name.value}</span>
              ) : (
        Severity: Minor
        Found in src/components/Section/Package/Signature.jsx - About 25 mins 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