Showing 502 of 502 total issues

Function componentDidMount has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  componentDidMount() {
    if (this.props.children) {
      let arr = []
      for (let child of this.props.children) {
        if (child && child.type === 'option') {
Severity: Minor
Found in src/components/Form/Dropdown/Dropdown.jsx - About 45 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

      if (errors.length && errors.some(err => err.valid === false)) {
        this.scrollIntoView(this.errorMessagesRef)
      }
Severity: Minor
Found in src/components/Form/Field/Field.jsx and 1 other location - About 45 mins to fix
src/components/Form/Field/Field.jsx on lines 138..140

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

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

      if (errors.length && errors.some(err => err.valid === false)) {
        this.scrollIntoView(this.errorMessagesRef)
      }
Severity: Minor
Found in src/components/Form/Field/Field.jsx and 1 other location - About 45 mins to fix
src/components/Form/Field/Field.jsx on lines 118..120

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

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

Consider simplifying this complex logical expression.
Open

      if (props.required) {
        const country = countryString(props.country)
        switch (country) {
          case 'United States':
          case 'POSTOFFICE':
Severity: Major
Found in src/components/Form/Location/Address.jsx - About 40 mins to fix

    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
    Severity: Major
    Found in src/components/Section/History/Employment/Employment.jsx - About 40 mins to fix

      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'
      Severity: Major
      Found in src/config/environment.js - About 40 mins to fix

        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{}) {
        Severity: Minor
        Found in api/postgresql/db.go - About 35 mins to fix

          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{}) {
          Severity: Minor
          Found in api/mock/database.go - About 35 mins to fix

            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{}) {
            Severity: Minor
            Found in api/postgresql/db.go - About 35 mins to fix

              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{}) {
              Severity: Minor
              Found in api/mock/database.go - About 35 mins to fix

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

                    try {
                      this.supportsBlobs = !!new window.Blob()
                    } catch (e) {
                      this.supportsBlobs = false
                    }
                Severity: Minor
                Found in src/components/Section/Package/Print/index.jsx and 1 other location - About 35 mins to fix
                src/components/Section/Package/Attachments.jsx on lines 16..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 47.

                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

                    try {
                      this.supportsBlobs = !!new window.Blob()
                    } catch (e) {
                      this.supportsBlobs = false
                    }
                Severity: Minor
                Found in src/components/Section/Package/Attachments.jsx and 1 other location - About 35 mins to fix
                src/components/Section/Package/Print/index.jsx on lines 54..58

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

                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

                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)
                
                
                Severity: Minor
                Found in api/http/save.go - 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 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))
                Severity: Minor
                Found in api/xml/xml.go - 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 sectionTitle has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                const sectionTitle = (el) => {
                  const content = closest(el, '.section-content')
                
                  if (!content) {
                    return null
                Severity: Minor
                Found in src/components/ErrorList/ErrorList.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 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
                Severity: Minor
                Found in src/sagas/initialize.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

                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) {
                Severity: Minor
                Found in src/components/Form/Country/Country.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 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)
                Severity: Minor
                Found in src/services/api.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

                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) {
                Severity: Minor
                Found in src/components/Form/Dropdown/Dropdown.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 AddressSummary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export const AddressSummary = (props, unknown = '') => {
                  if (!props) {
                    return unknown
                  }
                
                
                Severity: Minor
                Found in src/components/Summary/AddressSummary.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

                Severity
                Category
                Status
                Source
                Language