SumOfUs/Champaign

View on GitHub

Showing 157 of 338 total issues

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

      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

        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

          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

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

                  render() {
                    return (
                      <div className="AmountSelection-container section">
                        <Thermometer />
                        <DonationBands
                Severity: Major
                Found in app/javascript/components/AmountSelection/AmountSelection.js - About 2 hrs to fix

                  Function rtl has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      rtl: function(context) {
                        var self = this;
                        var selection;
                        // ui has renders to build ui elements.
                        //  - you can create a button with `ui.button`
                  Severity: Major
                  Found in app/javascript/packs/summernote-rtl-plugin.js - About 2 hrs to fix

                    Fundraiser has 23 functions (exceeds 20 allowed). Consider refactoring.
                    Open

                    export class Fundraiser extends Plugin<IFundraiserPluginConfig> {
                      public store: Store<IAppState>;
                      public customRenderer: (instance: Fundraiser) => any | undefined;
                    
                      constructor(options: IPluginOptions<IFundraiserPluginConfig>) {
                    Severity: Minor
                    Found in app/javascript/plugins/fundraiser/index.tsx - About 2 hrs to fix

                      Function ltr has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          ltr: function(context) {
                            var self = this;
                            // ui has renders to build ui elements.
                            var ui = $.summernote.ui;
                            context.memo('button.ltr', function() {
                      Severity: Major
                      Found in app/javascript/packs/summernote-rtl-plugin.js - About 2 hrs to fix

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

                          render() {
                            const errorMessage = this.state.newPensionFundNameError ? (
                              <FormattedMessage
                                id="email_tool.form.errors.suggest_fund"
                                defaultMessage="Name of pension fund can't be blank"
                        Severity: Major
                        Found in app/javascript/plugins/email_pension/SuggestFund.js - About 2 hrs to fix

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

                            render() {
                              const { restrictedCountryCode } = this.props;
                              const className = classnames(
                                {
                                  SweetPhoneInput__root: true,
                          Severity: Major
                          Found in app/javascript/components/SweetPhoneInput/SweetPhoneInput.js - About 2 hrs to fix

                            Function createHostedFields has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              createHostedFields(client) {
                                Promise.all([
                                  braintree.threeDSecure.create(
                                    {
                                      client: client,
                            Severity: Major
                            Found in app/javascript/components/Braintree/BraintreeCardFields.js - About 2 hrs to fix

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

                                render() {
                                  let targets;
                              
                                  if (this.state.not_found) {
                                    targets = (
                              Severity: Major
                              Found in app/javascript/plugins/email_pension/SelectTarget.js - About 2 hrs to fix

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

                                  render() {
                                    const { header, footer, errors } = this.props;
                                
                                    const hasHeaderValue = this.hasValue(header);
                                    const hasFooterValue = this.hasValue(footer);
                                Severity: Major
                                Found in app/javascript/components/EmailEditor/EmailEditor.js - About 2 hrs to fix

                                  Function handleSuccess has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                  Open

                                    handleSuccess(e, data) {
                                      ee.emit('petition:submitted');
                                  
                                      const tracking = data.tracking;
                                      const member = window.champaign.personalization.member;
                                  Severity: Minor
                                  Found in app/javascript/legacy/member-facing/backbone/petition.js - About 2 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 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

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