SumOfUs/Champaign

View on GitHub

Showing 338 of 338 total issues

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

            <div className="EmailToolView-note">
              <div className="section title">
                <FormattedMessage
                  id="email_tool.form.choose_email_service"
                  defaultMessage="If you have not set up an email client or the above button does not open your email, please use the following instructions."
Severity: Major
Found in app/javascript/plugins/email_pension/EmailPensionView.js and 1 other location - About 1 wk to fix
app/javascript/plugins/email_tool/EmailToolView.js on lines 278..456

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

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

            <div className="EmailToolView-note">
              <div className="section title">
                <FormattedMessage
                  id="email_tool.form.choose_email_service"
                  defaultMessage="If you have not set up an email client or the above button does not open your email, please use the following instructions."
Severity: Major
Found in app/javascript/plugins/email_tool/EmailToolView.js and 1 other location - About 1 wk to fix
app/javascript/plugins/email_pension/EmailPensionView.js on lines 286..464

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

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

export function EmailComposer(props) {
  const dispatch = useDispatch();

  const member = window.champaign.personalization.member;
  const [name, setName] = useState(member.name || '');
Severity: Major
Found in app/javascript/modules/EmailParliament/EmailComposer.js - About 1 day to fix

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

    describe('For one_off/non_donor/new_user donors when recurring default is recurring', () => {
      it(`shows one_off button`, () => {
        const recurringDonor = false;
        const recurring_default = 'recurring';
        let oneOffWrapper = null;
    app/javascript/components/Payment/doubleButtonConditions.test.js on lines 87..133

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

    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

    describe('For one_off/non_donor/new_user donors when recurring default is one_off', () => {
      it(`shows one_off button`, () => {
        const recurringDonor = false;
        const recurring_default = 'one_off';
        let oneOffWrapper = null;
    app/javascript/components/Payment/doubleButtonConditions.test.js on lines 135..181

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

    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

    describe('For one_off/non_donor/new_user donors when recurring default is only_one_off', () => {
      it(`shows one_off button`, () => {
        const recurringDonor = false;
        const recurring_default = 'only_one_off';
        let oneOffWrapper = null;
    app/javascript/components/Payment/doubleButtonConditions.test.js on lines 39..85

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

    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

    describe('Recurring Donors', () => {
      it(`shows one_off button for recurring donors when recurring_default is any`, () => {
        const recurringDonor = true;
        const recurring_default = 'only_recurring';
        let oneOffWrapper = null;
    app/javascript/components/Payment/doubleButtonConditions.test.js on lines 183..229

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

    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 Payment.js has 697 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 270 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const { errors } = this.state;
          return (
            <div className="EmailToolView">
              <div className="EmailToolView-form">
      Severity: Major
      Found in app/javascript/plugins/email_tool/EmailToolView.js - About 1 day to fix

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

          render() {
            return (
              <div className="email-target">
                <div className="email-target-form">
                  <form onSubmit={this.onSubmit} className="action-form form--big">
        Severity: Major
        Found in app/javascript/plugins/email_pension/EmailPensionView.js - About 1 day to fix

          File EmailPensionView.js has 512 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          //
          import React, { Component } from 'react';
          import { isEmpty, find, template, merge, each, pick, join } from 'lodash';
          
          import { connect } from 'react-redux';
          Severity: Major
          Found in app/javascript/plugins/email_pension/EmailPensionView.js - About 1 day to fix

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

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

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

                          if (
                            elementsClass.style.direction != 'rtl' &&
                            elementsClass.style.direction != 'ltr'
                          ) {
                            var spn = document.createElement('div');
              Severity: Major
              Found in app/javascript/packs/summernote-rtl-plugin.js and 1 other location - About 7 hrs to fix
              app/javascript/packs/summernote-rtl-plugin.js on lines 69..86

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

              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

                          if (
                            elementsClass.style.direction != 'rtl' &&
                            elementsClass.style.direction != 'ltr'
                          ) {
                            var spn = document.createElement('div');
              Severity: Major
              Found in app/javascript/packs/summernote-rtl-plugin.js and 1 other location - About 7 hrs to fix
              app/javascript/packs/summernote-rtl-plugin.js on lines 137..154

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

              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

                          function getHTMLOfSelection() {
                            var range;
                            if (document.selection && document.selection.createRange) {
                              range = document.selection.createRange();
                              return range.htmlText;
              Severity: Major
              Found in app/javascript/packs/summernote-rtl-plugin.js and 1 other location - About 7 hrs to fix
              app/javascript/packs/summernote-rtl-plugin.js on lines 114..133

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

              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

                          function getHTMLOfSelection() {
                            var range;
                            if (document.selection && document.selection.createRange) {
                              range = document.selection.createRange();
                              return range.htmlText;
              Severity: Major
              Found in app/javascript/packs/summernote-rtl-plugin.js and 1 other location - About 7 hrs to fix
              app/javascript/packs/summernote-rtl-plugin.js on lines 42..61

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

              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 EmailToolView.js has 461 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React, { Component } from 'react';
              import { connect } from 'react-redux';
              import { compact, get, join, sample, isEmpty } from 'lodash';
              import Select from '../../components/SweetSelect/SweetSelect';
              import Input from '../../components/SweetInput/SweetInput';
              Severity: Minor
              Found in app/javascript/plugins/email_tool/EmailToolView.js - About 7 hrs to fix

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

                        <ShowIf condition={!isEmpty(this.state.errors)}>
                          <div className="fundraiser-bar__errors">
                            <div className="fundraiser-bar__error-intro">
                              <span className="fa fa-exclamation-triangle" />
                              <FormattedMessage
                Severity: Major
                Found in app/javascript/components/Payment/Payment.js and 1 other location - About 6 hrs to fix
                app/javascript/components/ExpressDonation/ExpressDonation.js on lines 223..240

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

                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={!isEmpty(this.state.errors)}>
                          <div className="fundraiser-bar__errors">
                            <div className="fundraiser-bar__error-intro">
                              <span className="fa fa-exclamation-triangle" />
                              <FormattedMessage
                Severity: Major
                Found in app/javascript/components/ExpressDonation/ExpressDonation.js and 1 other location - About 6 hrs to fix
                app/javascript/components/Payment/Payment.js on lines 572..589

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

                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

                  return new Promise((resolve, reject) => {
                    $.post(`/api/pages/${page_id}/emails`, payload)
                      .done((data, textStatus, jqXHR) => {
                        // Facebook pixel tracking
                        const tracking = data.tracking;
                Severity: Major
                Found in app/javascript/util/ChampaignClient/MailerClient.js and 1 other location - About 5 hrs to fix
                app/javascript/util/ChampaignClient/MailerClient.js on lines 31..49

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

                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