SumOfUs/Champaign

View on GitHub
app/javascript/plugins/email_pension/EmailPensionView.js

Summary

Maintainability
F
1 wk
Test Coverage

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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  <div className="EmailToolView-note">
                    <div className="section title">
                      <FormattedMessage
                        id="email_tool.form.choose_email_service"
                        defaultMessage="If you have not set up an email client or the above button does not open your email, please use the following instructions."
      Severity: Major
      Found in app/javascript/plugins/email_pension/EmailPensionView.js and 1 other location - About 1 wk to fix
      app/javascript/plugins/email_tool/EmailToolView.js on lines 278..456

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 1240.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          MailerClient.sendPensionEmail({ page_id: this.props.pageId, payload }).then(
            response => {
              window.location.href = URI(`${response.data.follow_up_page}`);
            },
            ({ errors }) => {
      Severity: Major
      Found in app/javascript/plugins/email_pension/EmailPensionView.js and 1 other location - About 4 hrs to fix
      app/javascript/plugins/email_pension/EmailRepresentativeView.js on lines 115..122

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 117.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                    <EmailEditor
                      errors={this.state.errors}
                      body={this.props.emailBody}
                      header={this.props.emailHeader}
                      footer={this.props.emailFooter}
      Severity: Major
      Found in app/javascript/plugins/email_pension/EmailPensionView.js and 1 other location - About 3 hrs to fix
      app/javascript/plugins/email_pension/EmailRepresentativeView.js on lines 211..219

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 107.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        handleSendEmail = () => {
          const emailParam = {
            emailService: this.state.emailService,
            toEmails: this.composeTargetAddress(),
            subject: this.props.emailSubject,
      Severity: Major
      Found in app/javascript/plugins/email_pension/EmailPensionView.js and 1 other location - About 2 hrs to fix
      app/javascript/plugins/email_tool/EmailToolView.js on lines 140..148

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 88.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

          fields.forEach(field => {
            if (isEmpty(this.props[field])) {
              const location = `email_tool.form.errors.${field}`;
              const message = <FormattedMessage id={location} />;
              errors[field] = message;
      Severity: Major
      Found in app/javascript/plugins/email_pension/EmailPensionView.js and 1 other location - About 2 hrs to fix
      app/javascript/plugins/email_pension/EmailRepresentativeView.js on lines 50..56

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 82.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  {consent.isRequired(
                    this.props.countryCode,
                    window.champaign.personalization.member
                  ) && (
                    <ConsentComponent
      Severity: Major
      Found in app/javascript/plugins/email_pension/EmailPensionView.js and 1 other location - About 2 hrs to fix
      app/javascript/plugins/email_tool/EmailToolView.js on lines 457..467

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 76.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        errorNotice = () => {
          if (!isEmpty(this.state.errors)) {
            return (
              <span className="error-msg left-align">
                <FormattedMessage id="email_tool.form.errors.message" />
      Severity: Major
      Found in app/javascript/plugins/email_pension/EmailPensionView.js and 1 other location - About 1 hr to fix
      app/javascript/plugins/email_pension/EmailRepresentativeView.js on lines 86..94

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 63.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          each(this.defaultTemplateVars, (val, key) => {
            if (vars[key] === undefined || vars[key] === '') {
              vars[key] = val;
            }
          });
      Severity: Major
      Found in app/javascript/plugins/email_pension/EmailPensionView.js and 1 other location - About 1 hr to fix
      app/javascript/plugins/email_pension/EmailRepresentativeView.js on lines 73..77

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status