AugurProject/augur-ui

View on GitHub
src/modules/account/components/account-withdraw/account-withdraw.jsx

Summary

Maintainability
D
2 days
Test Coverage

Function render has 103 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  render() {
    const { eth, isMobileSmall, rep } = this.props;
    const s = this.state;

    return (
Severity: Major
Found in src/modules/account/components/account-withdraw/account-withdraw.jsx - About 4 hrs to fix

    File account-withdraw.jsx has 306 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint jsx-a11y/label-has-for: 0 */
    
    import React, { Component } from "react";
    import PropTypes from "prop-types";
    
    
    Severity: Minor
    Found in src/modules/account/components/account-withdraw/account-withdraw.jsx - About 3 hrs to fix

      Function withdrawReview has 42 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        withdrawReview() {
          const { withdrawReviewModal, closeModal } = this.props;
          const s = this.state;
          if (s.isValid) {
            withdrawReviewModal({

        Function validateAmount has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          validateAmount(amount, callback) {
            const { eth } = this.props;
            const { selectedAsset, repGasCost, upperBound, etherGasCost } = this.state;
            let gasValue = etherGasCost.value;
            if (selectedAsset !== ETH) {

          Function constructor has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            constructor(props) {
              super(props);
          
              const etherGasCost = formatEtherEstimate(
                formatGasCostToEther(

            Function validateAmount has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

              validateAmount(amount, callback) {
                const { eth } = this.props;
                const { selectedAsset, repGasCost, upperBound, etherGasCost } = this.state;
                let gasValue = etherGasCost.value;
                if (selectedAsset !== ETH) {
            Severity: Minor
            Found in src/modules/account/components/account-withdraw/account-withdraw.jsx - About 55 mins 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

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

              static propTypes = {
                isMobileSmall: PropTypes.bool.isRequired,
                eth: PropTypes.object.isRequired,
                rep: PropTypes.object.isRequired,
                transferFunds: PropTypes.func.isRequired,
            src/modules/auth/components/common/address-picker-content.jsx on lines 13..21
            src/modules/auth/components/connect-dropdown/connect-dropdown.jsx on lines 21..29

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

            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

                            {s.errors.hasOwnProperty("amount") &&
                              s.errors.amount.length && (
                                <span className={FormStyles["Form__error--even__space"]}>
                                  {InputErrorIcon}
                                  {s.errors.amount}
            src/modules/account/components/account-withdraw/account-withdraw.jsx on lines 311..317
            src/modules/reporting/components/reporting-dispute-form/reporting-dispute-form.jsx on lines 651..657

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

            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

                            {s.errors.hasOwnProperty("address") &&
                              s.errors.address.length && (
                                <span className={FormStyles["Form__error--even__space"]}>
                                  {InputErrorIcon}
                                  {s.errors.address}
            src/modules/account/components/account-withdraw/account-withdraw.jsx on lines 292..298
            src/modules/reporting/components/reporting-dispute-form/reporting-dispute-form.jsx on lines 651..657

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

            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

                      <div className={Styles.AccountWithdraw__description}>
                        <p>
                          Withdraw Ethereum or Reputation from your Trading Account into
                          another account.
                        </p>
            src/modules/reporting/components/reporting-dispute-form/reporting-dispute-form.jsx on lines 489..501

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

            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