SumOfUs/Champaign

View on GitHub

Showing 338 of 338 total issues

Function click has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          click: function() {
            function clearSelection() {
              if (document.selection) {
                document.selection.empty();
              } else if (window.getSelection) {
Severity: Major
Found in app/javascript/packs/summernote-rtl-plugin.js - About 2 hrs to fix

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

                {consent.isRequired(
                  this.props.countryCode,
                  window.champaign.personalization.member
                ) && (
                  <ConsentComponent
    Severity: Major
    Found in app/javascript/plugins/email_pension/EmailPensionView.js and 1 other location - About 2 hrs to fix
    app/javascript/plugins/email_tool/EmailToolView.js on lines 457..467

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

    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

      getMemberName(member, formValues) {
        if (member) {
          return `${member.fullName}:`;
        } else if (formValues && formValues.member) {
          return `${formValues.member.name}:`;
    Severity: Major
    Found in app/javascript/components/ExpressDonation/ExpressDonation.js and 1 other location - About 2 hrs to fix
    app/javascript/components/Payment/Payment.js on lines 217..225

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

    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

      getMemberName(member, formValues) {
        if (member) {
          return `${member.fullName}:`;
        } else if (formValues && formValues.member) {
          return `${formValues.member.name}:`;
    Severity: Major
    Found in app/javascript/components/Payment/Payment.js and 1 other location - About 2 hrs to fix
    app/javascript/components/ExpressDonation/ExpressDonation.js on lines 46..54

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

    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

                {consent.isRequired(
                  this.props.countryCode,
                  window.champaign.personalization.member
                ) && (
                  <ConsentComponent
    Severity: Major
    Found in app/javascript/plugins/email_tool/EmailToolView.js and 1 other location - About 2 hrs to fix
    app/javascript/plugins/email_pension/EmailPensionView.js on lines 465..475

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

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

      render() {
        const {
          disabled,
          currentPaymentType,
          onChange,
    Severity: Minor
    Found in app/javascript/components/Payment/PaymentTypeSelection.js - About 2 hrs to fix

      Function reducer has 49 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function reducer(state = defaultState, action) {
        switch (action.type) {
          case '@@chmp:initialize':
            const {
              personalization: { member, location },
      Severity: Minor
      Found in app/javascript/state/consent/index.js - About 1 hr to fix

        Function click has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                  click: function() {
                    function clearSelection() {
                      if (document.selection) {
                        document.selection.empty();
                      } else if (window.getSelection) {
        Severity: Minor
        Found in app/javascript/packs/summernote-rtl-plugin.js - About 1 hr to fix

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

                      <div>
                        <label>
                          <input
                            disabled={emailService === 'in_app_send'}
                            type="radio"
          Severity: Major
          Found in app/javascript/modules/EmailParliament/EmailComposer.js and 2 other locations - About 1 hr to fix
          app/javascript/modules/EmailParliament/EmailComposer.js on lines 249..259
          app/javascript/modules/EmailParliament/EmailComposer.js on lines 261..271

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

          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

            it('pre-selects the first property if it is passed in the filter', () => {
              const props = { ...baseProps, filters: { country: 'United States' } };
              const wrapper = shallow(<CallToolDrillDown {...props} />);
              expect(toJSON(wrapper)).toMatchSnapshot('CallToolDrillDownWithFilters');
            });
          app/javascript/components/CallTool/CallToolDrillDown.test.js on lines 36..40

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

          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

                      <div>
                        <label>
                          <input
                            disabled={emailService === 'in_app_send'}
                            type="radio"
          Severity: Major
          Found in app/javascript/modules/EmailParliament/EmailComposer.js and 2 other locations - About 1 hr to fix
          app/javascript/modules/EmailParliament/EmailComposer.js on lines 249..259
          app/javascript/modules/EmailParliament/EmailComposer.js on lines 273..283

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

          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

                      <div>
                        <label>
                          <input
                            disabled={emailService === 'in_app_send'}
                            type="radio"
          Severity: Major
          Found in app/javascript/modules/EmailParliament/EmailComposer.js and 2 other locations - About 1 hr to fix
          app/javascript/modules/EmailParliament/EmailComposer.js on lines 261..271
          app/javascript/modules/EmailParliament/EmailComposer.js on lines 273..283

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

          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

            it('pre-selects nothing if the passed filter is not first', () => {
              const props = { ...baseProps, filters: { state: 'California' } };
              const wrapper = shallow(<CallToolDrillDown {...props} />);
              expect(toJSON(wrapper)).toMatchSnapshot('CallToolDrillDownWithFilters');
            });
          app/javascript/components/CallTool/CallToolDrillDown.test.js on lines 21..25

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

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

            render() {
              const prefix = 'BraintreeCardFields';
              const classNames = classnames({
                [prefix]: true,
                [`${prefix}--active`]: this.props.isActive,
          Severity: Minor
          Found in app/javascript/components/Braintree/BraintreeCardFields.js - About 1 hr to fix

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

              test(`country => <SelectCountry .../>`, () => {
                const wrapper = shallow(<FieldShape field={{...field, data_type: 'country'}} />);
                expect(wrapper.text()).toEqual('<InjectIntl(SelectCountry) />');
              });
            Severity: Major
            Found in app/javascript/components/FieldShape/FieldShape.test.js and 1 other location - About 1 hr to fix
            app/javascript/components/FieldShape/FieldShape.test.js on lines 53..56

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

            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

              test(`dropdown => <Select .../>`, () => {
                const wrapper = shallow(<FieldShape field={{...field, data_type: 'dropdown'}} />);
                expect(wrapper.text()).toEqual('<SweetSelect />');
              });
            Severity: Major
            Found in app/javascript/components/FieldShape/FieldShape.test.js and 1 other location - About 1 hr to fix
            app/javascript/components/FieldShape/FieldShape.test.js on lines 48..51

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

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

            function configureWysiwyg(id, editorOptions = []) {
              const $editor = $('#' + id);
              if ($editor.length === 0) {
                return;
              }
            Severity: Minor
            Found in app/javascript/legacy/campaigner_facing/configure_wysiwyg.js - About 1 hr to fix

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

                        <div className="col1">
                          <TargetsChart
                            data={
                              this.state.data &&
                              this.state.data[this.state.filter]['target_calls'][
              app/javascript/plugins/call_tool_analytics/CallToolAnalyticsView.js on lines 110..119
              app/javascript/plugins/call_tool_analytics/CallToolAnalyticsView.js on lines 136..145

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

              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

                        <div className="col2">
                          <MembersStatusTable
                            data={
                              this.state.data &&
                              this.state.data[this.state.filter]['member_calls'][
              app/javascript/plugins/call_tool_analytics/CallToolAnalyticsView.js on lines 125..134
              app/javascript/plugins/call_tool_analytics/CallToolAnalyticsView.js on lines 136..145

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

              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

                        <div className="col2">
                          <TargetsStatusTable
                            data={
                              this.state.data &&
                              this.state.data[this.state.filter]['target_calls'][
              app/javascript/plugins/call_tool_analytics/CallToolAnalyticsView.js on lines 110..119
              app/javascript/plugins/call_tool_analytics/CallToolAnalyticsView.js on lines 125..134

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

              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