SumOfUs/Champaign

View on GitHub

Showing 338 of 338 total issues

Method round has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def round(values)
      values.map do |value|
        value = value.to_f

        if value < 20
Severity: Minor
Found in app/lib/donations/utils.rb - 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 csv has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def csv
    rows = @actions.map do |action|
      keys.map do |k|
        value = val(k, action)
        value.is_a?(String) && value.index(COMMA).present? ? "\"#{value}\"" : value
Severity: Minor
Found in app/services/action_collator.rb - 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 round_fundraising_goals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def round_fundraising_goals(values)
      values.map do |value|
        value = value.to_f
        if value.zero?
          value
Severity: Minor
Found in app/lib/donations/utils.rb - 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 member_phone_number_is_valid has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def member_phone_number_is_valid
    return if member_phone_number.blank?

    valid_characters = (/\A[0-9\-\+\(\) \.]+\z/i =~ member_phone_number).present?
    has_at_least_six_numbers = (member_phone_number.scan(/[0-9]/).size > 5)
Severity: Minor
Found in app/models/call.rb - 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

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

      const showDirectDebit = isDirectDebitSupported({
        country: state.form.country || state.formValues.country,
        recurring: data.recurring,
      });
Severity: Minor
Found in app/javascript/state/fundraiser/reducer.js and 1 other location - About 35 mins to fix
app/javascript/state/fundraiser/reducer.js on lines 211..214

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

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

      const showDirectDebit = isDirectDebitSupported({
        country: state.form.country || state.formValues.country,
        recurring: action.payload,
      });
Severity: Minor
Found in app/javascript/state/fundraiser/reducer.js and 1 other location - About 35 mins to fix
app/javascript/state/fundraiser/reducer.js on lines 243..246

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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        <tr>
          <th> Total </th>
          <td> {data.total} </td>
        </tr>
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 9..12
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 13..16
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 9..12
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 17..20
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 25..28

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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        <tr>
          <th> Busy </th>
          <td> {data.busy} </td>
        </tr>
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 9..12
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 13..16
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 21..24
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 9..12
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 25..28

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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        <tr>
          <th> Started </th>
          <td> {data.started} </td>
        </tr>
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 9..12
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 21..24
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 9..12
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 17..20
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 25..28

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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        <tr>
          <th> Failed </th>
          <td> {data.failed} </td>
        </tr>
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 9..12
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 13..16
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 21..24
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 17..20
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 25..28

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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        <tr>
          <th> Unstarted </th>
          <td> {data.unstarted} </td>
        </tr>
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 13..16
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 21..24
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 9..12
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 17..20
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 25..28

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

Similar blocks of code found in 6 locations. Consider refactoring.
Open

        <tr>
          <th> Total </th>
          <td> {data.total} </td>
        </tr>
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 9..12
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 13..16
app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 21..24
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 9..12
app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 17..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 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 {
        ...state,
        recurring: action.payload,
        showDirectDebit,
        localPaymentTypes,
Severity: Major
Found in app/javascript/state/fundraiser/reducer.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

          return {
            ...state,
            ...featuredAmountState(preselectAmount, { donationBands, currency }),
            currency,
            donationBands,
    Severity: Major
    Found in app/javascript/state/fundraiser/reducer.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

            return {
              ...state,
              ...data,
              showDirectDebit,
              localPaymentTypes,
      Severity: Major
      Found in app/javascript/state/fundraiser/reducer.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

              return {
                ...state,
                directDebitOnly: action.payload,
                paymentTypes,
                currentPaymentType,
        Severity: Major
        Found in app/javascript/state/fundraiser/reducer.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                return {
                  ...state,
                  form,
                  formValues,
                  outstandingFields,
          Severity: Major
          Found in app/javascript/state/fundraiser/reducer.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return {
                    ...state,
                    currentPaymentType: safePaymentType(action.payload, state.paymentTypes),
                  };
            Severity: Major
            Found in app/javascript/state/fundraiser/reducer.js - About 30 mins to fix

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

                      <tr>
                        <th> Completed </th>
                        <td> {data.completed}</td>
                      </tr>
              app/javascript/components/CallToolAnalytics/MembersStatusTable.js on lines 17..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

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

                      <tr>
                        <th> Connected </th>
                        <td> {data.connected}</td>
                      </tr>
              app/javascript/components/CallToolAnalytics/TargetsStatusTable.js on lines 21..24

              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

              Severity
              Category
              Status
              Source
              Language