SumOfUs/Champaign

View on GitHub

Showing 157 of 338 total issues

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

    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

              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

                Function render has 139 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

                  File EmailComposer.js has 385 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React, { useState } from 'react';
                  import { FormattedMessage } from 'react-intl';
                  import { isEmpty } from 'lodash';
                  import { useDispatch, useSelector } from 'react-redux';
                  
                  
                  Severity: Minor
                  Found in app/javascript/modules/EmailParliament/EmailComposer.js - About 5 hrs to fix

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

                      render() {
                        const {
                          fundraiser: {
                            formId,
                            fields,
                    Severity: Major
                    Found in app/javascript/plugins/fundraiser/FundraiserView.js - About 4 hrs to fix

                      File reducer.js has 356 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import { isEmpty, keys, pick, reduce } from 'lodash';
                      import ee from '../../shared/pub_sub';
                      
                      import { isDirectDebitSupported } from '../../util/directDebitDecider';
                      
                      
                      Severity: Minor
                      Found in app/javascript/state/fundraiser/reducer.js - About 4 hrs to fix

                        File ExpressDonation.js has 348 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 { isEmpty, snakeCase } from 'lodash';
                        Severity: Minor
                        Found in app/javascript/components/ExpressDonation/ExpressDonation.js - About 4 hrs to fix

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

                              export function EmailComposer(props) {
                                const dispatch = useDispatch();
                              
                                const member = window.champaign.personalization.member;
                                const [name, setName] = useState(member.name || '');
                              Severity: Minor
                              Found in app/javascript/modules/EmailParliament/EmailComposer.js - About 3 hrs to fix

                              Cognitive Complexity

                              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                              A method's cognitive complexity is based on a few simple rules:

                              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                              • Code is considered more complex for each "break in the linear flow of the code"
                              • Code is considered more complex when "flow breaking structures are nested"

                              Further reading

                              Function 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

                                ActionForm has 31 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                const ActionForm = Backbone.View.extend({
                                  el: 'form.action-form',
                                  HIDDEN_FIELDS: [
                                    'source',
                                    'akid',
                                Severity: Minor
                                Found in app/javascript/legacy/member-facing/backbone/action_form.js - About 3 hrs to fix

                                  Function getEventData has 90 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const getEventData = (eventName, ...data) => {
                                    switch (eventName) {
                                      case 'action:submitted_success':
                                        return ['action', 'submitted_success'];
                                      case '@@chmp:consent:change_country':
                                  Severity: Major
                                  Found in app/javascript/util/log_event.js - About 3 hrs to fix

                                    Payment has 29 functions (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    export class Payment extends Component {
                                      static title = (<FormattedMessage id="payment" defaultMessage="payment" />);
                                    
                                      constructor(props) {
                                        super(props);
                                    Severity: Minor
                                    Found in app/javascript/components/Payment/Payment.js - About 3 hrs to fix

                                      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
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language