SumOfUs/Champaign

View on GitHub

Showing 338 of 338 total issues

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

  fieldTypes.forEach(type => {
    test(`data_type: ${type} => <FormField .../>`, () => {
      const cnf = { ...config, data_type: type };
      const wrapper = render(<FormField {...cnf} />);
      expect(wrapper.find('span').text()).toMatch('Invalid data');
Severity: Major
Found in app/javascript/components/Form/FormField.test.tsx and 1 other location - About 3 hrs to fix
app/javascript/components/Form/FormField.test.tsx on lines 183..189

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

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

  fieldTypes.forEach(type => {
    test(`data_type: ${type} => <FormField .../>`, () => {
      const cnf = { ...config, data_type: type };
      const wrapper = render(<FormField {...cnf} />);
      expect(wrapper.find('span').text()).toMatch('');
Severity: Major
Found in app/javascript/components/Form/FormField.test.tsx and 1 other location - About 3 hrs to fix
app/javascript/components/Form/FormField.test.tsx on lines 172..178

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

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

export default function Form(props: IProps, second?: any) {
  const dispatch = useDispatch();
  const values = useSelector((state: IAppState) => state.forms[props.id]);
  const member = useSelector((state: IAppState) => state.member);
  const [highlightConsent, setHighlightConsent] = React.useState(false);
Severity: Major
Found in app/javascript/components/Form/index.tsx - About 3 hrs to fix

    Function exports has 82 lines of code (exceeds 25 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: Major
    Found in babel.config.js - About 3 hrs to fix

      File BraintreeCardFields.js has 296 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { Component } from 'react';
      import { injectIntl, FormattedMessage } from 'react-intl';
      import classnames from 'classnames';
      import braintree from 'braintree-web';
      import hostedFields from 'braintree-web/hosted-fields';
      Severity: Minor
      Found in app/javascript/components/Braintree/BraintreeCardFields.js - About 3 hrs to fix

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

          it('is rendered if there is a featured amount', () => {
            const component = shallowWithIntl(
              <AmountSelection {...defaultProps} donationFeaturedAmount={1} />
            );
            const button = component.find('Button.AmountSelection__proceed-button');
        app/javascript/components/AmountSelection/AmountSelection.test.js on lines 139..146

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

        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

          submissionState() {
            return (
              <div className="submission-interstitial">
                <h1 className="submission-interstitial__title">
                  <i className="fa fa-spin fa-cog" />
        Severity: Major
        Found in app/javascript/components/Stepper/StepWrapper.js and 1 other location - About 3 hrs to fix
        app/javascript/components/OneClick/OneClick.js on lines 114..126

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

        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

          procssingView() {
            return (
              <div className="submission-interstitial">
                <h1 className="submission-interstitial__title">
                  <i className="fa fa-spin fa-cog" />
        Severity: Major
        Found in app/javascript/components/OneClick/OneClick.js and 1 other location - About 3 hrs to fix
        app/javascript/components/Stepper/StepWrapper.js on lines 46..58

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

        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('is enabled if there is a donation amount', () => {
            const component = shallowWithIntl(
              <AmountSelection {...defaultProps} donationAmount={1} />
            );
            const button = component.find('Button.AmountSelection__proceed-button');
        app/javascript/components/AmountSelection/AmountSelection.test.js on lines 130..137

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

        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

        Class Page has 26 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Page < ApplicationRecord # rubocop:disable Metrics/ClassLength
          extend FriendlyId
          has_paper_trail
        
          PRONTO_TEMPLATES = ['Default: Petition And Scroll To Share Greenpeace', 'Fundraiser With Title Below Image'].freeze
        Severity: Minor
        Found in app/models/page.rb - About 3 hrs to fix

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

                  <label className={declineClass}>
                    <input
                      type="radio"
                      name="consented"
                      value={0}
          Severity: Major
          Found in app/javascript/components/consent/ConsentControls.js and 1 other location - About 3 hrs to fix
          app/javascript/components/consent/ConsentControls.js on lines 27..36

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

          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

                  <label className={acceptClass}>
                    <input
                      type="radio"
                      name="consented"
                      value={1}
          Severity: Major
          Found in app/javascript/components/consent/ConsentControls.js and 1 other location - About 3 hrs to fix
          app/javascript/components/consent/ConsentControls.js on lines 37..46

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

          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 action_queue.rb has 288 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'active_support/concern'
          
          module ActionQueue
            module Enqueable
              extend ActiveSupport::Concern
          Severity: Minor
          Found in app/services/action_queue.rb - About 2 hrs to fix

            Similar blocks of code found in 2 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 1 other location - About 2 hrs to fix
            app/javascript/modules/EmailParliament/EmailComposer.js on lines 227..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 92.

            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>
                          <label>
                            <input
                              disabled={emailService === 'in_app_send'}
                              type="radio"
            Severity: Major
            Found in app/javascript/modules/EmailParliament/EmailComposer.js and 1 other location - About 2 hrs to fix
            app/javascript/modules/EmailParliament/EmailComposer.js on lines 292..305

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

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

            import React, { Component, Fragment } from 'react';
            import { connect } from 'react-redux';
            import { FormattedMessage } from 'react-intl';
            import classnames from 'classnames';
            import _ from 'lodash';
            Severity: Minor
            Found in app/javascript/plugins/fundraiser/FundraiserView.js - About 2 hrs to fix

              Class PagesController has 24 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class PagesController < ApplicationController # rubocop:disable Metrics/ClassLength
                newrelic_ignore_enduser only: %i[show follow_up double_opt_in_notice]
                skip_before_action :verify_authenticity_token, raise: false, only: %i[create update destroy]
                before_action :authenticate_user!, except: %i[feeds show follow_up double_opt_in_notice]
                before_action :get_page, only: %i[edit update destroy follow_up double_opt_in_notice analytics actions preview emails]
              Severity: Minor
              Found in app/controllers/pages_controller.rb - About 2 hrs to fix

                Class LiquidRenderer has 24 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class LiquidRenderer # rubocop:disable Metrics/ClassLength
                  include Rails.application.routes.url_helpers
                
                  HIDDEN_FIELDS = %w[source bucket referrer_id rid akid referring_akid].freeze
                  SCROLL_TO_DONATE_LAYOUT = 'Default: Petition And Scroll To Donate Greenpeace'
                Severity: Minor
                Found in app/liquid/liquid_renderer.rb - About 2 hrs to fix

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

                    handleSendEmail = () => {
                      const emailParam = {
                        emailService: this.state.emailService,
                        toEmails: this.getTargetEmails(),
                        subject: this.state.subject,
                  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 166..174

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

                  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="Thermometer-goal">
                            <FormattedMessage
                              className="Thermometer-stats-label"
                              id="fundraiser.thermometer.goal"
                              defaultMessage="Goal"
                  Severity: Major
                  Found in app/javascript/components/Thermometer.js and 1 other location - About 2 hrs to fix
                  app/javascript/components/Thermometer.js on lines 27..37

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

                  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