AugurProject/augur-ui

View on GitHub

Showing 1,757 of 1,757 total issues

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

              <button
                className={classNames(FormStyles.Form__next, {
                  [`${FormStyles["hide-button"]}`]: s.currentStep === 1
                })}
                disabled={
Severity: Major
Found in src/modules/forking/components/migrate-rep/migrate-rep.jsx and 1 other location - About 5 hrs to fix
src/modules/reporting/components/reporting-dispute/reporting-dispute.jsx on lines 181..199

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

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

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

  render() {
    const {
      addOrderToNewMarket,
      availableEth,
      availableRep,

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

    export const selectTopBid = memoize(
      (marketOrderBook, excludeCurrentUser) => {
        let topBid;
        if (excludeCurrentUser) {
          const numBids = marketOrderBook.bids.length;
    Severity: Major
    Found in src/modules/orders/helpers/select-order-book.js and 1 other location - About 5 hrs to fix
    src/modules/orders/helpers/select-order-book.js on lines 69..88

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

    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

    export const selectTopAsk = memoize(
      (marketOrderBook, excludeCurrentUser) => {
        let topAsk;
        if (excludeCurrentUser) {
          const numAsks = marketOrderBook.asks.length;
    Severity: Major
    Found in src/modules/orders/helpers/select-order-book.js and 1 other location - About 5 hrs to fix
    src/modules/orders/helpers/select-order-book.js on lines 48..67

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

    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

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

      render() {
        const { newMarket, validateField, keyPressed } = this.props;
        const validations = newMarket.validations[newMarket.currentStep];
    
        const designatedReporterError =

      File new-market.test.js has 409 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import newMarket from "modules/markets/reducers/new-market";
      import { DEFAULT_SCALAR_TICK_SIZE } from "augur.js/src/constants";
      
      import {
        ADD_ORDER_TO_NEW_MARKET,
      Severity: Minor
      Found in src/modules/markets/reducers/new-market.test.js - About 5 hrs to fix

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

          render() {
            const {
              accountREP,
              market,
              selectedOutcome,
        Severity: Major
        Found in src/modules/forking/components/migrate-rep-form/migrate-rep-form.jsx - About 5 hrs to fix

          File create-market-form-review.jsx has 405 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React, { Component } from "react";
          import PropTypes from "prop-types";
          import { augur } from "services/augurjs";
          import { createBigNumber } from "utils/create-big-number";
          import getValue from "src/utils/get-value";

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

                    <div
                      className={Styles.ModalMarketReview__checkbox}
                      role="button"
                      tabIndex="0"
                      onClick={e => {
            Severity: Major
            Found in src/modules/modal/components/modal-market-review.jsx and 1 other location - About 5 hrs to fix
            src/modules/modal/components/modal-v2-markets-alert.jsx on lines 80..102

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

            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.ModalMarketReview__checkbox}
                      role="button"
                      tabIndex="0"
                      onClick={e => {
            Severity: Major
            Found in src/modules/modal/components/modal-v2-markets-alert.jsx and 1 other location - About 5 hrs to fix
            src/modules/modal/components/modal-market-review.jsx on lines 103..125

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

            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={classNames(
                        StylesHeader.MarketOutcomeChartsHeader__stats,
                        Styles.MarketOutcomeOrderBook__stats
                      )}
            src/modules/market-charts/components/market-outcome-charts--header-orders/market-outcome-charts--header-orders.jsx on lines 32..53

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

            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={classNames(
                    StylesHeader.MarketOutcomeChartsHeader__stats,
                    Styles["MarketOutcomeChartsHeader__stats--orders"]
                  )}
            src/modules/market-charts/components/market-outcome-charts--orders/market-outcome-charts--orders.jsx on lines 288..321

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

            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

              const utils6 = [
                {
                  func: "formatEther",
                  denom: "ETH",
                  out: {
            Severity: Major
            Found in src/utils/format-number.test.js and 1 other location - About 5 hrs to fix
            src/utils/format-number.test.js on lines 345..376

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

            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

              const utils7 = [
                {
                  func: "formatEther",
                  denom: "ETH",
                  out: {
            Severity: Major
            Found in src/utils/format-number.test.js and 1 other location - About 5 hrs to fix
            src/utils/format-number.test.js on lines 301..332

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

            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

            File market-outcomes-chart.jsx has 395 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import React, { Component } from "react";
            import PropTypes from "prop-types";
            import { isEqual } from "lodash";
            
            import * as d3 from "d3";

              Function validateScalarNum has 137 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                validateScalarNum(rawValue, type, limitDigits) {
                  const { isValid, newMarket, updateNewMarket } = this.props;
                  const { currentStep } = newMarket;
                  const { scalarType } = this.state;
              
              

                Function generateTrade has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                Open

                  (market, outcome, outcomeTradeInProgress, orderBooks) => {
                    const { loginAccount } = store.getState();
                    const { settlementFee } = market;
                    const side =
                      (outcomeTradeInProgress && outcomeTradeInProgress.side) ||
                Severity: Minor
                Found in src/modules/trades/helpers/generate-trade.js - About 5 hrs 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

                File performance-graph.jsx has 392 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React, { Component } from "react";
                import PropTypes from "prop-types";
                import * as d3 from "d3";
                
                import Dropdown from "modules/common/components/dropdown/dropdown";

                  File hardware-wallet.jsx has 391 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React, { Component } from "react";
                  import PropTypes from "prop-types";
                  import { createBigNumber } from "utils/create-big-number";
                  import DerivationPath, {
                    DEFAULT_DERIVATION_PATH,
                  Severity: Minor
                  Found in src/modules/auth/components/common/hardware-wallet.jsx - About 5 hrs to fix

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

                      render() {
                        const { closeModal } = this.props;
                        const { didScroll, didCheck } = this.state;
                    
                        return (
                    Severity: Major
                    Found in src/modules/modal/components/modal-disclaimer.jsx - About 5 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language