Showing 157 of 338 total issues
Function sendEmail
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const sendEmail = async params => {
const data = {
email: {
body: params.body,
recipients: params.recipients,
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,
});
Function render
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div>
<form className="form-inline" onSubmit={this.handleSubmit.bind(this)}>
<div className="input-group">
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const formClassNames = classnames({
'action-form': true,
'form--big': true,
'single-country': !!this.props.restrictedCountryCode,
Function init
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
export const init = options => {
if (!options.el) {
options.el = document.getElementById('call-tool-component');
}
const { el, store } = options;
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const className = classnames('sweet-placeholder', this.props.className);
const labelClassName = classnames({
'sweet-placeholder__label': true,
'sweet-placeholder__label--full':
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,
});
- 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 handleSuccess
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
handleSuccess(e, data) {
ee.emit('petition:submitted');
const tracking = data.tracking;
const member = window.champaign.personalization.member;
Function paymentOptionsView
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
paymentOptionsView() {
return (
<div className="OneClick">
<div className="StepWrapper-root">
<div className="overlay-toggle__mobile-ui">
Function composeEmailLink
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function composeEmailLink(email) {
const sanitizedToEmails = buildToEmailForCompose(
email.toEmails,
email.emailService
);
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
alwaysShow,
consented,
active,
Method create
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
# TODO: Move form validator to ManageAction
validator = FormValidator.new(action_params.to_h)
action_params[:source] = action_params[:source] || detect_source
Function onSubmit
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
const onSubmit = async e => {
e.preventDefault();
const valid = validateForm();
if (!valid) return;
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const className = classnames('sweet-placeholder__label', {
'sweet-placeholder__label--full':
!!this.props.value && !this.state.focused,
'sweet-placeholder__label--active': this.state.focused,
Function InlineConsentRadiobuttons
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function InlineConsentRadiobuttons(props: IProps) {
const member = useSelector((state: IAppState) => state.member);
if (member && member.email) {
return null;
}
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
) {
- 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 getEventData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
const getEventData = (eventName, ...data) => {
switch (eventName) {
case 'action:submitted_success':
return ['action', 'submitted_success'];
case '@@chmp:consent:change_country':
- 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
Method create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create
# TODO: Move form validator to ManageAction
validator = FormValidator.new(action_params.to_h)
action_params[:source] = action_params[:source] || detect_source
- 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
Method previous_action
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def previous_action
return nil unless existing_member.present?
@previous_action ||= Action.not_donation.where(member: existing_member, page_id: page).first
- 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
Method data_for_view
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def data_for_view(page, supplemental_data = {})
default_ref = 'default'
plugins_data = page.plugins.inject({}) do |memo, plugin|
if plugin
plugin_name = plugin.name.underscore
- 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"