SumOfUs/Champaign

View on GitHub

Showing 270 of 270 total issues

File Payment.js has 616 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import $ from 'jquery';
import React, { Component } from 'react';
import { FormattedMessage, FormattedHTMLMessage } from 'react-intl';
import { connect } from 'react-redux';
import braintreeClient from 'braintree-web/client';
Severity: Major
Found in app/javascript/components/Payment/Payment.js - About 1 day to fix

    Function render has 193 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const {
          member,
          hideRecurring,
          onlyRecurring,
    Severity: Major
    Found in app/javascript/components/Payment/Payment.js - About 7 hrs to fix

      Function render has 144 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          if (!this.props.paymentMethods.length || this.props.hidden) return null;
      
          return (
            <div className="ExpressDonation">
      Severity: Major
      Found in app/javascript/components/ExpressDonation/ExpressDonation.js - About 5 hrs to fix

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

              this.state.currencyDropdVisible && (
                <select
                  value={this.props.currency}
                  className="AmountSelection__currency-selector"
                  onChange={e => this.onSelectCurrency(e.currentTarget.value)}
        app/javascript/components/AmountSelection/AmountSelection.js on lines 88..102

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

        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

                {this.state.currencyDropdVisible && (
                  <select
                    value={this.props.currency}
                    className="AmountSelection__currency-selector"
                    onChange={e => this.onSelectCurrency(e.currentTarget.value)}
        Severity: Major
        Found in app/javascript/components/AmountSelection/AmountSelection.js and 1 other location - About 5 hrs to fix
        app/javascript/components/CurrencySelector/CurrencySelector.js on lines 27..41

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

        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

                    <ShowIf condition={this.showMonthlyButton()}>
                      <DonateButton
                        currency={currency}
                        amount={donationAmount || 0}
                        submitting={this.state.submitting}
        Severity: Major
        Found in app/javascript/components/Payment/Payment.js and 1 other location - About 4 hrs to fix
        app/javascript/components/Payment/Payment.js on lines 636..647

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

        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

                    <ShowIf condition={this.showOneOffButton()}>
                      <DonateButton
                        currency={currency}
                        amount={donationAmount || 0}
                        submitting={this.state.submitting}
        Severity: Major
        Found in app/javascript/components/Payment/Payment.js and 1 other location - About 4 hrs to fix
        app/javascript/components/Payment/Payment.js on lines 623..634

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

        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

        File ExpressDonation.js has 353 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import $ from 'jquery';
        import React, { Component } from 'react';
        import { connect } from 'react-redux';
        import { FormattedMessage } from 'react-intl';
        import ee from '../../shared/pub_sub';
        Severity: Minor
        Found in app/javascript/components/ExpressDonation/ExpressDonation.js - About 4 hrs to fix

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

            showMonthlyButton() {
              let keys = ['recurring', 'only_recurring'];
              // recurring donor
              if (this.state.recurringDonar) {
                return false;
          Severity: Major
          Found in app/javascript/components/Payment/Payment.js and 1 other location - About 4 hrs to fix
          app/javascript/components/ExpressDonation/ExpressDonation.js on lines 178..194

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

          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

            showMonthlyButton() {
              let keys = ['recurring', 'only_recurring'];
              // recurring donor
              if (this.state.recurringDonar) {
                return false;
          Severity: Major
          Found in app/javascript/components/ExpressDonation/ExpressDonation.js and 1 other location - About 4 hrs to fix
          app/javascript/components/Payment/Payment.js on lines 432..448

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

          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 render has 101 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render() {
              if (!this.state.data) {
                return this.renderLoading();
              }
          
          
          Severity: Major
          Found in app/javascript/plugins/call_tool_analytics/CallToolAnalyticsView.js - About 4 hrs to fix

            File action_form.js has 334 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import $ from 'jquery';
            import I18n from 'champaign-i18n';
            import React from 'react';
            import { render } from 'react-dom';
            import _ from 'lodash';
            Severity: Minor
            Found in app/javascript/legacy/member-facing/backbone/action_form.js - About 4 hrs to fix

              Function render has 97 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                render() {
                  return (
                    <div className="email-target">
                      <div className="email-target-form">
                        <form
              Severity: Major
              Found in app/javascript/plugins/email_pension/EmailRepresentativeView.js - About 3 hrs to fix

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

                  test(`data_type: hidden => <FormField .../>`, () => {
                    const cnf = { ...config, data_type: 'hidden' };
                    const wrapper = shallow(<FormField {...cnf} />);
                    const input = wrapper.children();
                
                
                Severity: Major
                Found in app/javascript/components/Form/FormField.test.tsx and 11 other locations - About 3 hrs to fix
                app/javascript/components/Form/FormField.test.tsx on lines 36..43
                app/javascript/components/Form/FormField.test.tsx on lines 45..52
                app/javascript/components/Form/FormField.test.tsx on lines 54..61
                app/javascript/components/Form/FormField.test.tsx on lines 63..70
                app/javascript/components/Form/FormField.test.tsx on lines 81..88
                app/javascript/components/Form/FormField.test.tsx on lines 90..97
                app/javascript/components/Form/FormField.test.tsx on lines 99..106
                app/javascript/components/Form/FormField.test.tsx on lines 108..115
                app/javascript/components/Form/FormField.test.tsx on lines 117..124
                app/javascript/components/Form/FormField.test.tsx on lines 126..133
                app/javascript/components/Form/FormField.test.tsx on lines 135..142

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

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

                  test(`data_type: paragraph => <FormField .../>`, () => {
                    const cnf = { ...config, data_type: 'paragraph' };
                    const wrapper = shallow(<FormField {...cnf} />);
                    const input = wrapper.children();
                
                
                Severity: Major
                Found in app/javascript/components/Form/FormField.test.tsx and 11 other locations - About 3 hrs to fix
                app/javascript/components/Form/FormField.test.tsx on lines 36..43
                app/javascript/components/Form/FormField.test.tsx on lines 45..52
                app/javascript/components/Form/FormField.test.tsx on lines 54..61
                app/javascript/components/Form/FormField.test.tsx on lines 63..70
                app/javascript/components/Form/FormField.test.tsx on lines 72..79
                app/javascript/components/Form/FormField.test.tsx on lines 81..88
                app/javascript/components/Form/FormField.test.tsx on lines 99..106
                app/javascript/components/Form/FormField.test.tsx on lines 108..115
                app/javascript/components/Form/FormField.test.tsx on lines 117..124
                app/javascript/components/Form/FormField.test.tsx on lines 126..133
                app/javascript/components/Form/FormField.test.tsx on lines 135..142

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

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

                  test(`data_type: numeric => <FormField .../>`, () => {
                    const cnf = { ...config, data_type: 'numeric' };
                    const wrapper = shallow(<FormField {...cnf} />);
                    const input = wrapper.children();
                
                
                Severity: Major
                Found in app/javascript/components/Form/FormField.test.tsx and 11 other locations - About 3 hrs to fix
                app/javascript/components/Form/FormField.test.tsx on lines 36..43
                app/javascript/components/Form/FormField.test.tsx on lines 54..61
                app/javascript/components/Form/FormField.test.tsx on lines 63..70
                app/javascript/components/Form/FormField.test.tsx on lines 72..79
                app/javascript/components/Form/FormField.test.tsx on lines 81..88
                app/javascript/components/Form/FormField.test.tsx on lines 90..97
                app/javascript/components/Form/FormField.test.tsx on lines 99..106
                app/javascript/components/Form/FormField.test.tsx on lines 108..115
                app/javascript/components/Form/FormField.test.tsx on lines 117..124
                app/javascript/components/Form/FormField.test.tsx on lines 126..133
                app/javascript/components/Form/FormField.test.tsx on lines 135..142

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

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

                  test(`data_type: postal => <FormField .../>`, () => {
                    const cnf = { ...config, data_type: 'postal' };
                    const wrapper = shallow(<FormField {...cnf} />);
                    const input = wrapper.children();
                
                
                Severity: Major
                Found in app/javascript/components/Form/FormField.test.tsx and 11 other locations - About 3 hrs to fix
                app/javascript/components/Form/FormField.test.tsx on lines 36..43
                app/javascript/components/Form/FormField.test.tsx on lines 45..52
                app/javascript/components/Form/FormField.test.tsx on lines 54..61
                app/javascript/components/Form/FormField.test.tsx on lines 72..79
                app/javascript/components/Form/FormField.test.tsx on lines 81..88
                app/javascript/components/Form/FormField.test.tsx on lines 90..97
                app/javascript/components/Form/FormField.test.tsx on lines 99..106
                app/javascript/components/Form/FormField.test.tsx on lines 108..115
                app/javascript/components/Form/FormField.test.tsx on lines 117..124
                app/javascript/components/Form/FormField.test.tsx on lines 126..133
                app/javascript/components/Form/FormField.test.tsx on lines 135..142

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

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

                  test(`data_type: email => <FormField .../>`, () => {
                    const cnf = { ...config, data_type: 'email' };
                    const wrapper = shallow(<FormField {...cnf} />);
                    const input = wrapper.children();
                
                
                Severity: Major
                Found in app/javascript/components/Form/FormField.test.tsx and 11 other locations - About 3 hrs to fix
                app/javascript/components/Form/FormField.test.tsx on lines 45..52
                app/javascript/components/Form/FormField.test.tsx on lines 54..61
                app/javascript/components/Form/FormField.test.tsx on lines 63..70
                app/javascript/components/Form/FormField.test.tsx on lines 72..79
                app/javascript/components/Form/FormField.test.tsx on lines 81..88
                app/javascript/components/Form/FormField.test.tsx on lines 90..97
                app/javascript/components/Form/FormField.test.tsx on lines 99..106
                app/javascript/components/Form/FormField.test.tsx on lines 108..115
                app/javascript/components/Form/FormField.test.tsx on lines 117..124
                app/javascript/components/Form/FormField.test.tsx on lines 126..133
                app/javascript/components/Form/FormField.test.tsx on lines 135..142

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

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

                  test(`data_type: instruction => <FormField .../>`, () => {
                    const cnf = { ...config, data_type: 'instruction' };
                    const wrapper = shallow(<FormField {...cnf} />);
                    const input = wrapper.children();
                
                
                Severity: Major
                Found in app/javascript/components/Form/FormField.test.tsx and 11 other locations - About 3 hrs to fix
                app/javascript/components/Form/FormField.test.tsx on lines 36..43
                app/javascript/components/Form/FormField.test.tsx on lines 45..52
                app/javascript/components/Form/FormField.test.tsx on lines 54..61
                app/javascript/components/Form/FormField.test.tsx on lines 63..70
                app/javascript/components/Form/FormField.test.tsx on lines 72..79
                app/javascript/components/Form/FormField.test.tsx on lines 90..97
                app/javascript/components/Form/FormField.test.tsx on lines 99..106
                app/javascript/components/Form/FormField.test.tsx on lines 108..115
                app/javascript/components/Form/FormField.test.tsx on lines 117..124
                app/javascript/components/Form/FormField.test.tsx on lines 126..133
                app/javascript/components/Form/FormField.test.tsx on lines 135..142

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

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

                  test(`data_type: country => <FormField .../>`, () => {
                    const cnf = { ...config, data_type: 'country' };
                    const wrapper = shallow(<FormField {...cnf} />);
                    const input = wrapper.children();
                
                
                Severity: Major
                Found in app/javascript/components/Form/FormField.test.tsx and 11 other locations - About 3 hrs to fix
                app/javascript/components/Form/FormField.test.tsx on lines 36..43
                app/javascript/components/Form/FormField.test.tsx on lines 45..52
                app/javascript/components/Form/FormField.test.tsx on lines 54..61
                app/javascript/components/Form/FormField.test.tsx on lines 63..70
                app/javascript/components/Form/FormField.test.tsx on lines 72..79
                app/javascript/components/Form/FormField.test.tsx on lines 81..88
                app/javascript/components/Form/FormField.test.tsx on lines 90..97
                app/javascript/components/Form/FormField.test.tsx on lines 99..106
                app/javascript/components/Form/FormField.test.tsx on lines 108..115
                app/javascript/components/Form/FormField.test.tsx on lines 126..133
                app/javascript/components/Form/FormField.test.tsx on lines 135..142

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

                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