AugurProject/augur-ui

View on GitHub

Showing 1,757 of 1,757 total issues

File trading.test.ts has 313 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"use strict";

import "jest-environment-puppeteer";
import { UnlockedAccounts } from "./constants/accounts";
import { waitNextBlock } from "./helpers/wait-new-block";
Severity: Minor
Found in integration/trading.test.ts - About 3 hrs to fix

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

      test(`should return the expected profit and loss values for a BUY in a SCALAR market`, () => {
        const actual = calcProfits(
          "10",
          "1",
          BUY,
    src/modules/trades/helpers/calc-order-profits-loss-percents.test.js on lines 72..94
    src/modules/trades/helpers/calc-order-profits-loss-percents.test.js on lines 120..142

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

    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

      test(`should return the expected profit and loss values for a SELL in a yes/no market`, () => {
        const actual = calcProfits(
          "10",
          "0.4",
          SELL,
    src/modules/trades/helpers/calc-order-profits-loss-percents.test.js on lines 96..118
    src/modules/trades/helpers/calc-order-profits-loss-percents.test.js on lines 120..142

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

    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

      test(`should return the expected profit and loss values for a SELL in a SCALAR market`, () => {
        const actual = calcProfits(
          "10",
          "1",
          SELL,
    src/modules/trades/helpers/calc-order-profits-loss-percents.test.js on lines 72..94
    src/modules/trades/helpers/calc-order-profits-loss-percents.test.js on lines 96..118

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

    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-outcome-charts--orders.jsx has 312 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import React, { Component } from "react";
    import PropTypes from "prop-types";
    import classNames from "classnames";
    
    import MarketOutcomeChartHeaderOrders from "modules/market-charts/components/market-outcome-charts--header-orders/market-outcome-charts--header-orders";

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

        utils6.forEach(currentUtil => {
          describe(`${currentUtil.func}`, () => {
            test("should return a correctly formatted object", () => {
              expect(
                formatNumber[`${currentUtil.func}`](currentUtil.num || num6)
      Severity: Major
      Found in src/utils/format-number.test.js and 5 other locations - About 3 hrs to fix
      src/utils/format-number.test.js on lines 114..122
      src/utils/format-number.test.js on lines 158..166
      src/utils/format-number.test.js on lines 202..210
      src/utils/format-number.test.js on lines 246..254
      src/utils/format-number.test.js on lines 290..298

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

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

        utils.forEach(currentUtil => {
          describe(`${currentUtil.func}`, () => {
            test("should return a correctly formatted object", () => {
              expect(
                formatNumber[`${currentUtil.func}`](currentUtil.num || num)
      Severity: Major
      Found in src/utils/format-number.test.js and 5 other locations - About 3 hrs to fix
      src/utils/format-number.test.js on lines 158..166
      src/utils/format-number.test.js on lines 202..210
      src/utils/format-number.test.js on lines 246..254
      src/utils/format-number.test.js on lines 290..298
      src/utils/format-number.test.js on lines 334..342

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

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

        utils3.forEach(currentUtil => {
          describe(`${currentUtil.func}`, () => {
            test("should return a correctly formatted object", () => {
              expect(
                formatNumber[`${currentUtil.func}`](currentUtil.num || num3)
      Severity: Major
      Found in src/utils/format-number.test.js and 5 other locations - About 3 hrs to fix
      src/utils/format-number.test.js on lines 114..122
      src/utils/format-number.test.js on lines 158..166
      src/utils/format-number.test.js on lines 246..254
      src/utils/format-number.test.js on lines 290..298
      src/utils/format-number.test.js on lines 334..342

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

      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

          store.dispatch(
            purchaseParticipationTokens("10.25", true, (err, res) => {
              expect(res).not.toBeDefined();
              expect(err).toEqual({ error: 1000, message: "Uh-Oh!" });
              const expectedActions = [];
      src/modules/reports/actions/purchase-participation-tokens.test.js on lines 116..124

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

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

        utils4.forEach(currentUtil => {
          describe(`${currentUtil.func}`, () => {
            test("should return a correctly formatted object", () => {
              expect(
                formatNumber[`${currentUtil.func}`](currentUtil.num || num4)
      Severity: Major
      Found in src/utils/format-number.test.js and 5 other locations - About 3 hrs to fix
      src/utils/format-number.test.js on lines 114..122
      src/utils/format-number.test.js on lines 158..166
      src/utils/format-number.test.js on lines 202..210
      src/utils/format-number.test.js on lines 290..298
      src/utils/format-number.test.js on lines 334..342

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

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

        utils5.forEach(currentUtil => {
          describe(`${currentUtil.func}`, () => {
            test("should return a correctly formatted object", () => {
              expect(
                formatNumber[`${currentUtil.func}`](currentUtil.num || num5)
      Severity: Major
      Found in src/utils/format-number.test.js and 5 other locations - About 3 hrs to fix
      src/utils/format-number.test.js on lines 114..122
      src/utils/format-number.test.js on lines 158..166
      src/utils/format-number.test.js on lines 202..210
      src/utils/format-number.test.js on lines 246..254
      src/utils/format-number.test.js on lines 334..342

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

      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

          store.dispatch(
            purchaseParticipationTokens("10.25", true, (err, res) => {
              expect(res).not.toBeDefined();
              expect(err).toEqual({ error: 1000, message: "Uh-Oh!" });
              const expectedActions = [];
      src/modules/reports/actions/purchase-participation-tokens.test.js on lines 137..145

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

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

        utils2.forEach(currentUtil => {
          describe(`${currentUtil.func}`, () => {
            test("should return a correctly formatted object", () => {
              expect(
                formatNumber[`${currentUtil.func}`](currentUtil.num || num2)
      Severity: Major
      Found in src/utils/format-number.test.js and 5 other locations - About 3 hrs to fix
      src/utils/format-number.test.js on lines 114..122
      src/utils/format-number.test.js on lines 202..210
      src/utils/format-number.test.js on lines 246..254
      src/utils/format-number.test.js on lines 290..298
      src/utils/format-number.test.js on lines 334..342

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

      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 86 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        render() {
          const {
            indexArray,
            addresses,
            clickAction,
      Severity: Major
      Found in src/modules/auth/components/common/address-picker-content.jsx - About 3 hrs to fix

        File market-properties.jsx has 310 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import React, { Component } from "react";
        import PropTypes from "prop-types";
        import classNames from "classnames";
        
        import MarketLink from "modules/market/components/market-link/market-link";
        Severity: Minor
        Found in src/modules/market/components/market-properties/market-properties.jsx - About 3 hrs to fix

          Function wrapLogHandler has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

          export const wrapLogHandler = (logHandler = defaultLogHandler) => (
            dispatch,
            getState
          ) => (err, log) => {
            if (err) return console.error((log || {}).eventName, err, log);
          Severity: Minor
          Found in src/modules/events/actions/wrap-log-handler.js - About 3 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

          Function loadTransactions has 85 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function loadTransactions(dispatch, getState, options, cb) {
            const allOptions = Object.assign(options, {
              orderState: augur.constants.ORDER_STATE.ALL
            });
            dispatch(updateAppStatus(TRANSACTIONS_LOADING, true));
          Severity: Major
          Found in src/modules/auth/actions/load-account-history.js - About 3 hrs to fix

            Function helpers has 85 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export const helpers = store => {
              const { dispatch, whenever } = store;
              return {
                updateAccountAddress: account =>
                  new Promise(resolve => {
            Severity: Major
            Found in src/helpers/helpers.js - About 3 hrs to fix

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

                render() {
                  const { history, location, transactionsLoading } = this.props;
                  const {
                    lowerBound,
                    boundedLength,
              Severity: Major
              Found in src/modules/portfolio/components/transactions/transactions.jsx - About 3 hrs to fix

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

                    test(`should call callback and history`, () => {
                      store.dispatch(
                        submitInitialReport({
                          estimateGas: false,
                          marketId: "testMarketId",
                Severity: Major
                Found in src/modules/reports/actions/submit-initial-report.test.js and 2 other locations - About 3 hrs to fix
                src/modules/reports/actions/submit-initial-report.test.js on lines 147..161
                src/modules/reports/actions/submit-initial-report.test.js on lines 163..177

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

                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

                Severity
                Category
                Status
                Source
                Language