myems-web/src/components/page/CustomerDetails.js

Summary

Maintainability
C
7 hrs
Test Coverage

Function CustomerDetail has 64 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const CustomerDetail = () => {
  const { loading, data: customer } = useFakeFetch(rawCustomer);
  const { id, email, createdAt, description, vat_no, email_to, address, cell, invoice_prefix } = customer;

  return (
Severity: Major
Found in myems-web/src/components/page/CustomerDetails.js - About 2 hrs to fix

    Function CustomerSummary has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const CustomerSummary = () => {
      const { loading, data: customer } = useFakeFetch(rawCustomer);
      const { name, email, createdAt } = customer;
    
      return (
    Severity: Major
    Found in myems-web/src/components/page/CustomerDetails.js - About 2 hrs to fix

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

      CustomerLog.propTypes = {
        status: PropTypes.number.isRequired,
        link: PropTypes.string.isRequired,
        time: PropTypes.string.isRequired
      };
      Severity: Major
      Found in myems-web/src/components/page/CustomerDetails.js and 6 other locations - About 50 mins to fix
      myems-web/src/components/e-commerce/checkout/CheckoutAside.js on lines 113..117
      myems-web/src/components/e-commerce/checkout/CheckoutPaymentMethod.js on lines 203..207
      myems-web/src/components/email/inbox/DropdownItemFilter.js on lines 15..19
      myems-web/src/components/email/inbox/InboxBody.js on lines 81..85
      myems-web/src/components/email/inbox/InboxHeader.js on lines 55..59
      myems-web/src/components/profile/ProfileContent.js on lines 72..76

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

      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 3 locations. Consider refactoring.
      Open

                    <CustomerDetailRow title="Phone number">
                      <a href={`tel:${cell}`}>{cell}</a>
                    </CustomerDetailRow>
      Severity: Minor
      Found in myems-web/src/components/page/CustomerDetails.js and 2 other locations - About 40 mins to fix
      myems-web/src/components/page/CustomerDetails.js on lines 130..132
      myems-web/src/components/page/CustomerDetails.js on lines 142..144

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

      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 3 locations. Consider refactoring.
      Open

                    <CustomerDetailRow title="Email">
                      <a href={`mailto:${email}`}>{email}</a>
                    </CustomerDetailRow>
      Severity: Minor
      Found in myems-web/src/components/page/CustomerDetails.js and 2 other locations - About 40 mins to fix
      myems-web/src/components/page/CustomerDetails.js on lines 142..144
      myems-web/src/components/page/CustomerDetails.js on lines 148..150

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

      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 3 locations. Consider refactoring.
      Open

                    <CustomerDetailRow title="Send email to">
                      <a href={`mailto:${email_to}`}>{email_to}</a>
                    </CustomerDetailRow>
      Severity: Minor
      Found in myems-web/src/components/page/CustomerDetails.js and 2 other locations - About 40 mins to fix
      myems-web/src/components/page/CustomerDetails.js on lines 130..132
      myems-web/src/components/page/CustomerDetails.js on lines 148..150

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

      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 13 locations. Consider refactoring.
      Open

      CustomerDetailRow.propTypes = {
        title: PropTypes.string.isRequired,
        children: PropTypes.node.isRequired,
        isLastItem: PropTypes.bool
      };
      Severity: Major
      Found in myems-web/src/components/page/CustomerDetails.js and 12 other locations - About 35 mins to fix
      myems-web/src/components/MyEMS/Tenant/TenantBill.js on lines 82..86
      myems-web/src/components/MyEMS/auth/ChangePasswordForm.js on lines 133..137
      myems-web/src/components/MyEMS/auth/SentForgotPasswordEmailMessageForm.js on lines 238..242
      myems-web/src/components/MyEMS/auth/SentRegisterEmailMessageForm.js on lines 261..265
      myems-web/src/components/auth/ForgetPasswordForm.js on lines 49..53
      myems-web/src/components/common/accordion/Accordion.js on lines 23..27
      myems-web/src/components/dashboard-alt/StorageStatusProgressBar.js on lines 15..19
      myems-web/src/components/education/EducationInput.js on lines 21..25
      myems-web/src/components/experience/ExperienceInput.js on lines 21..25
      myems-web/src/components/feed/BirthdayNotice.js on lines 25..29
      myems-web/src/components/feed/ButtonImgPostCreate.js on lines 20..24
      myems-web/src/components/page/Invoice.js on lines 57..61

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

      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