18F/e-QIP-prototype

View on GitHub

Showing 502 of 502 total issues

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

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

      OtherNames: (value, attributes) => {
        const dateLimits = { latest: DEFAULT_LATEST }
        if (attributes.Birthdate) dateLimits.earliest = attributes.Birthdate
    
        return {
    Severity: Major
    Found in src/models/cohabitant.js and 1 other location - About 1 hr to fix
    src/models/civilUnion.js on lines 120..131

    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 71.

    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

      ForeignBornDocument: (value, attributes) => {
        if (attributes.BirthPlace
          && attributes.BirthPlace.country
          && countryString(attributes.BirthPlace.country) !== 'United States') {
          return {
    Severity: Major
    Found in src/models/civilUnion.js and 1 other location - About 1 hr to fix
    src/models/cohabitant.js on lines 69..80

    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 71.

    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

      constructor(data = {}) {
        const state = store.getState()
        const { formType } = state.application.Settings
        this.data = data
        this.formType = formType
    Severity: Major
    Found in src/validators/sentence.js and 1 other location - About 1 hr to fix
    src/validators/foreignborndocument.js on lines 17..23

    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 71.

    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

      constructor(data = {}) {
        const state = store.getState()
        const { formType } = state.application.Settings
    
        this.data = data
    Severity: Major
    Found in src/validators/foreignborndocument.js and 1 other location - About 1 hr to fix
    src/validators/sentence.js on lines 21..26

    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 71.

    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

      OtherNames: (value, attributes) => {
        const dateLimits = { latest: DEFAULT_LATEST }
        if (attributes.Birthdate) dateLimits.earliest = attributes.Birthdate
    
        return {
    Severity: Major
    Found in src/models/civilUnion.js and 1 other location - About 1 hr to fix
    src/models/cohabitant.js on lines 39..50

    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 71.

    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

      ForeignBornDocument: (value, attributes = {}) => {
        if (attributes.BirthPlace
          && attributes.BirthPlace.country
          && countryString(attributes.BirthPlace.country) !== 'United States') {
          return {
    Severity: Major
    Found in src/models/cohabitant.js and 1 other location - About 1 hr to fix
    src/models/civilUnion.js on lines 132..143

    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 71.

    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 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 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 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 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

    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

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

        const showGapError = branch
          && branch.value === 'No'
          && gaps.length > 0
          && errors.filter(e => e.indexOf(INCOMPLETE_DURATION) > -1).length > 0
    Severity: Major
    Found in src/components/Section/Relationships/People/People.jsx and 2 other locations - About 1 hr to fix
    src/components/Section/History/Employment/Employment.jsx on lines 122..125
    src/components/Section/History/Residence/Residence.jsx on lines 85..88

    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 69.

    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

        const showGapError = branch
          && branch.value === 'No'
          && gaps.length > 0
          && errors.filter(e => e.indexOf(INCOMPLETE_DURATION) > -1).length > 0
    Severity: Major
    Found in src/components/Section/History/Residence/Residence.jsx and 2 other locations - About 1 hr to fix
    src/components/Section/History/Employment/Employment.jsx on lines 122..125
    src/components/Section/Relationships/People/People.jsx on lines 115..118

    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 69.

    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

        const showGapError = branch
          && branch.value === 'No'
          && gaps.length > 0
          && errors.filter(e => e.indexOf(INCOMPLETE_DURATION) > -1).length > 0
    Severity: Major
    Found in src/components/Section/History/Employment/Employment.jsx and 2 other locations - About 1 hr to fix
    src/components/Section/History/Residence/Residence.jsx on lines 85..88
    src/components/Section/Relationships/People/People.jsx on lines 115..118

    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 69.

    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 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

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

        constructor(props) {
          super(props)
          this.handleUpdate = this.handleUpdate.bind(this)
          this.handleError = this.handleError.bind(this)
        }
      Severity: Major
      Found in src/components/Form/Sex/Sex.jsx and 1 other location - About 1 hr to fix
      src/components/Form/MaidenName/MaidenName.jsx on lines 7..12

      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 64.

      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

        constructor(props) {
          super(props)
      
          this.handleUpdate = this.handleUpdate.bind(this)
          this.handleError = this.handleError.bind(this)
      Severity: Major
      Found in src/components/Form/MaidenName/MaidenName.jsx and 1 other location - About 1 hr to fix
      src/components/Form/Sex/Sex.jsx on lines 9..13

      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 64.

      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

      Severity
      Category
      Status
      Source
      Language