SumOfUs/Champaign

View on GitHub

Showing 338 of 338 total issues

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

    case '@@chmp:feature:disable':
      if (Object.keys(s).includes(a.featureName)) {
        return { ...s, [a.featureName]: false };
      }
      break;
Severity: Minor
Found in app/javascript/state/features/index.js and 1 other location - About 40 mins to fix
app/javascript/state/features/index.js on lines 12..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 48.

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

    case '@@chmp:feature:enable':
      if (Object.keys(s).includes(a.featureName)) {
        return { ...s, [a.featureName]: true };
      }
      break;
Severity: Minor
Found in app/javascript/state/features/index.js and 1 other location - About 40 mins to fix
app/javascript/state/features/index.js on lines 17..21

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

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 3 locations. Consider refactoring.
Open

interface ICallToolOptions {
  el: HTMLElement;
  namespace: string;
  config: any; // todo
  store: Store<IAppState>;
Severity: Minor
Found in app/javascript/plugins/call_tool/index.tsx and 2 other locations - About 40 mins to fix
app/javascript/plugins/email_pension/index.tsx on lines 12..17
app/javascript/plugins/email_tool/index.tsx on lines 12..17

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

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 3 locations. Consider refactoring.
Open

interface IEmailPensionOptions {
  el: HTMLElement;
  namespace: string;
  config: any; // todo
  store: Store<IAppState>;
Severity: Minor
Found in app/javascript/plugins/email_pension/index.tsx and 2 other locations - About 40 mins to fix
app/javascript/plugins/call_tool/index.tsx on lines 12..17
app/javascript/plugins/email_tool/index.tsx on lines 12..17

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

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 3 locations. Consider refactoring.
Open

interface IEmailToolOptions {
  el: HTMLElement;
  namespace: string;
  config: any; // todo
  store: Store<IAppState>;
Severity: Minor
Found in app/javascript/plugins/email_tool/index.tsx and 2 other locations - About 40 mins to fix
app/javascript/plugins/call_tool/index.tsx on lines 12..17
app/javascript/plugins/email_pension/index.tsx on lines 12..17

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

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 clone has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def self.clone(page, title = nil, language_id = nil, override_forms = false, exclude_shares = false)
Severity: Minor
Found in app/services/page_cloner.rb - About 35 mins to fix

    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def initialize(bt_result, page_id, member_id, existing_customer, save_customer = true, store_in_vault: false)
    Severity: Minor
    Found in app/models/payment/braintree.rb - About 35 mins to fix

      Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        def initialize(page, title = nil, language_id = nil, override_forms = false, exclude_shares = false)
      Severity: Minor
      Found in app/services/page_cloner.rb - About 35 mins to fix

        Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          def initialize(params, variant_type, page, url = nil, id = nil)
        Severity: Minor
        Found in app/services/share_variant_builder.rb - About 35 mins to fix

          Method write_transaction has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def write_transaction(bt_result, page_id, member_id, existing_customer, save_customer = true, store_in_vault: false)
          Severity: Minor
          Found in app/models/payment/braintree.rb - About 35 mins to fix

            Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              def initialize(plan, page_slug, follow_up_liquid_layout_id, follow_up_page_slug, extra_params = nil)
            Severity: Minor
            Found in app/services/page_follower.rb - About 35 mins to fix

              Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def initialize(bt_customer, bt_payment_method, member_id, existing_customer, store_in_vault)
              Severity: Minor
              Found in app/models/payment/braintree.rb - About 35 mins to fix

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

                  formData: {
                    storeInVault: state.fundraiser.storeInVault,
                    member: {
                      ...state.fundraiser.formValues,
                      ...state.fundraiser.form,
                Severity: Minor
                Found in app/javascript/components/Payment/Payment.js and 1 other location - About 35 mins to fix
                app/javascript/components/ExpressDonation/ExpressDonation.js on lines 369..375

                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

                  formData: {
                    storeInVault: state.fundraiser.storeInVault,
                    member: {
                      ...state.fundraiser.formValues,
                      ...state.fundraiser.form,
                Severity: Minor
                Found in app/javascript/components/ExpressDonation/ExpressDonation.js and 1 other location - About 35 mins to fix
                app/javascript/components/Payment/Payment.js on lines 768..774

                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 create_action has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def create_action
                    action_params = {
                      page: page
                    }.merge(@extra_attrs)
                
                
                Severity: Minor
                Found in app/services/manage_action.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

                Function targets has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                export const targets = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10].map(id => {
                  const country = id < 5 ? 'United States' : 'Canada';
                  let state;
                  if (country === 'United States') {
                    state = id < 3 ? 'California' : 'New York';
                Severity: Minor
                Found in app/javascript/components/CallTool/call_tool_helpers.test.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 parse_interpolation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def parse_interpolation(query)
                    params = {}
                    depth = 0
                    _, translation_key, string_params = /([^,]+)(.*)/.match(query).to_a
                    while string_params.present? && !string_params.empty?
                Severity: Minor
                Found in app/liquid/liquid_i18n.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 all_params has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def all_params
                    # this method flattens a lot of nested data from one object per form element
                    # to one object per entity (page, share variant, etc) to modify
                    #
                    # this is pretty janky but it's the best I can do moving quickly
                Severity: Minor
                Found in app/controllers/api/pages_controller.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

                Function exports has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                module.exports = function(api) {
                  var validEnv = ['development', 'test', 'production'];
                  var currentEnv = api.env();
                  var isDevelopmentEnv = api.env('development');
                  var isProductionEnv = api.env('production');
                Severity: Minor
                Found in babel.config.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