Showing 157 of 338 total issues
Function EmailComposer
has 358 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export function EmailComposer(props) {
const dispatch = useDispatch();
const member = window.champaign.personalization.member;
const [name, setName] = useState(member.name || '');
File Payment.js
has 697 lines of code (exceeds 250 allowed). Consider refactoring. Open
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';
Function render
has 270 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { errors } = this.state;
return (
<div className="EmailToolView">
<div className="EmailToolView-form">
Function render
has 268 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div className="email-target">
<div className="email-target-form">
<form onSubmit={this.onSubmit} className="action-form form--big">
File EmailPensionView.js
has 512 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
//
import React, { Component } from 'react';
import { isEmpty, find, template, merge, each, pick, join } from 'lodash';
import { connect } from 'react-redux';
Function render
has 183 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
member,
onlyRecurring,
recurringDonor,
File EmailToolView.js
has 461 lines of code (exceeds 250 allowed). Consider refactoring. Open
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';
Function render
has 139 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
if (!this.props.paymentMethods.length || this.props.hidden) return null;
return (
<div className="ExpressDonation">
File EmailComposer.js
has 385 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { useState } from 'react';
import { FormattedMessage } from 'react-intl';
import { isEmpty } from 'lodash';
import { useDispatch, useSelector } from 'react-redux';
Function render
has 118 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
fundraiser: {
formId,
fields,
File reducer.js
has 356 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import { isEmpty, keys, pick, reduce } from 'lodash';
import ee from '../../shared/pub_sub';
import { isDirectDebitSupported } from '../../util/directDebitDecider';
File ExpressDonation.js
has 348 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import $ from 'jquery';
import React, { Component } from 'react';
import { connect } from 'react-redux';
import { FormattedMessage } from 'react-intl';
import { isEmpty, snakeCase } from 'lodash';
Function render
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
if (!this.state.data) {
return this.renderLoading();
}
File action_form.js
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import $ from 'jquery';
import I18n from 'champaign-i18n';
import React from 'react';
import { render } from 'react-dom';
import _ from 'lodash';
Function EmailComposer
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
Open
export function EmailComposer(props) {
const dispatch = useDispatch();
const member = window.champaign.personalization.member;
const [name, setName] = useState(member.name || '');
- Read upRead up
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
Open
render() {
return (
<div className="email-target">
<div className="email-target-form">
<form
ActionForm
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
Open
const ActionForm = Backbone.View.extend({
el: 'form.action-form',
HIDDEN_FIELDS: [
'source',
'akid',
Function getEventData
has 90 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const getEventData = (eventName, ...data) => {
switch (eventName) {
case 'action:submitted_success':
return ['action', 'submitted_success'];
case '@@chmp:consent:change_country':
Payment
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
Open
export class Payment extends Component {
static title = (<FormattedMessage id="payment" defaultMessage="payment" />);
constructor(props) {
super(props);
Function Form
has 86 lines of code (exceeds 25 allowed). Consider refactoring. Open
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);