SumOfUs/Champaign

View on GitHub
app/javascript/plugins/fundraiser/FundraiserView.js

Summary

Maintainability
C
1 day
Test Coverage

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

      Function componentDidMount has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        async componentDidMount() {
          if (window.dataLayer) {
            await window.dataLayer.push({
              event: unintendedDonationsExperiment.activationEvent,
            });
      Severity: Minor
      Found in app/javascript/plugins/fundraiser/FundraiserView.js - About 1 hr to fix

        Function componentDidMount has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          async componentDidMount() {
            if (window.dataLayer) {
              await window.dataLayer.push({
                event: unintendedDonationsExperiment.activationEvent,
              });
        Severity: Minor
        Found in app/javascript/plugins/fundraiser/FundraiserView.js - About 1 hr 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 componentDidUpdate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

          componentDidUpdate(prevProps) {
            if (
              prevProps.experiments.length == 0 &&
              this.props.experiments.length > 0
            ) {
        Severity: Minor
        Found in app/javascript/plugins/fundraiser/FundraiserView.js - About 1 hr 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

        There are no issues that match your filters.

        Category
        Status