AugurProject/augur-ui

View on GitHub

Showing 1,757 of 1,757 total issues

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

  describe("categorical 0", () => {
    test(`should call the expected method`, () => {
      const actual = getPayoutNumerators(marketCategorical, 0, false).map(n =>
        n.toString()
      );
Severity: Major
Found in src/modules/reports/actions/get-payout-numerators.test.js and 3 other locations - About 2 hrs to fix
src/modules/reports/actions/get-payout-numerators.test.js on lines 187..195
src/modules/reports/actions/get-payout-numerators.test.js on lines 197..205
src/modules/reports/actions/get-payout-numerators.test.js on lines 207..215

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

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

    augur.reporting.getFeeWindowCurrent.mockImplementation((p, cb) => {
      expect(p).toEqual({ universe: store.getState().universe.id });
      expect(typeof cb).toBe("function");
      cb(null, { feeWindow: "0xfeeWindow01" });
    });
src/modules/reports/actions/purchase-participation-tokens.test.js on lines 29..33
src/modules/reports/actions/purchase-participation-tokens.test.js on lines 110..114

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

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

    const newMarketState = {
      test: "test",
      orderBook: {
        Outcome1: [
          {
Severity: Major
Found in src/modules/markets/reducers/new-market.test.js and 4 other locations - About 2 hrs to fix
src/modules/markets/reducers/new-market.test.js on lines 114..132
src/modules/markets/reducers/new-market.test.js on lines 210..228
src/modules/markets/reducers/new-market.test.js on lines 234..252
src/modules/markets/reducers/new-market.test.js on lines 293..311

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

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

    const newMarketState = {
      test: "test",
      orderBook: {
        Outcome1: [
          {
Severity: Major
Found in src/modules/markets/reducers/new-market.test.js and 4 other locations - About 2 hrs to fix
src/modules/markets/reducers/new-market.test.js on lines 177..195
src/modules/markets/reducers/new-market.test.js on lines 210..228
src/modules/markets/reducers/new-market.test.js on lines 234..252
src/modules/markets/reducers/new-market.test.js on lines 293..311

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

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

  beforeEach(async () => {
    await toReporting();

    const market: IMarket = await createYesNoMarket();

Severity: Major
Found in integration/reporting/reporting.test.ts and 1 other location - About 2 hrs to fix
integration/reporting/reporting.test.ts on lines 387..397

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

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

  beforeEach(async () => {
    await toReporting();

    const market: IMarket = await createScalarMarket();

Severity: Major
Found in integration/reporting/reporting.test.ts and 1 other location - About 2 hrs to fix
integration/reporting/reporting.test.ts on lines 245..255

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

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

  componentWillReceiveProps(nextProps) {
    const {
      orderEthEstimate,
      orderShareEstimate,
      selectedNav,
Severity: Major
Found in src/modules/trading/components/trading--form/trading--form.jsx - About 2 hrs to fix

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

      render() {
        const {
          id,
          description,
          linkPath,
    Severity: Major
    Found in src/modules/notifications/components/notification/notification.jsx - About 2 hrs to fix

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

        render() {
          const { switchUniverse, universe } = this.props;
          const { parent, currentLevel, children } = this.state.universesInfo;
      
          return (

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

          render() {
            const { highestBlock, lastProcessedBlock, isLogged } = this.props;
            const s = this.state;
            const highestBlockBn = createBigNumber(highestBlock);
            const lastProcessedBlockBn = createBigNumber(lastProcessedBlock);
        Severity: Major
        Found in src/modules/block-info/components/block-info-data/block-info-data.jsx - About 2 hrs to fix

          Function drawDepth has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            drawDepth(options) {
              if (this.depthChart) {
                const {
                  marketDepth,
                  orderBookKeys,

            File migrate-rep-form.jsx has 285 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";
            import classNames from "classnames";
            Severity: Minor
            Found in src/modules/forking/components/migrate-rep-form/migrate-rep-form.jsx - About 2 hrs to fix

              File reporting-payouts.jsx has 284 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React, { Component } from "react";
              import PropTypes from "prop-types";
              import classNames from "classnames";
              import ReactTooltip from "react-tooltip";
              import { formatAttoRep } from "utils/format-number";

                Function default has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function(
                  market,
                  disputeStakes,
                  newOutcomeDisputeBond,
                  forkThreshold
                Severity: Major
                Found in src/modules/reports/selectors/select-dispute-outcomes.js - About 2 hrs to fix

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

                    render() {
                      const { outcomes, marketId, isMobile, isMobileSmall } = this.props;
                  
                      const numShown =
                        isMobile && !isMobileSmall ? NUM_CELLS_SHOWN_MOBILE : NUM_CELLS_SHOWN;

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

                      test("Reporting cycle is 51% complete", () => {
                        const state = {
                          blockchain: {
                            currentBlockTimestamp: 123456789
                          },
                    Severity: Major
                    Found in src/modules/universe/selectors/reporting-cycle.test.js and 1 other location - About 2 hrs to fix
                    src/modules/universe/selectors/reporting-cycle.test.js on lines 39..57

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

                    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 function formatAttoRep(num, opts) {
                      if (!num || num === 0 || isNaN(num)) return 0;
                      const { ETHER } = augur.rpc.constants;
                      return formatNumber(
                        createBigNumber(num.toString())
                    Severity: Major
                    Found in src/utils/format-number.js and 1 other location - About 2 hrs to fix
                    src/utils/format-number.js on lines 207..216

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

                    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 function formatAttoEth(num, opts) {
                      if (!num || num === 0 || isNaN(num)) return 0;
                      const { ETHER } = augur.rpc.constants;
                      return formatNumber(
                        createBigNumber(num.toString())
                    Severity: Major
                    Found in src/utils/format-number.js and 1 other location - About 2 hrs to fix
                    src/utils/format-number.js on lines 195..204

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

                    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

                      test("Reporting cycle is 0% complete", () => {
                        const state = {
                          blockchain: {
                            currentBlockTimestamp: 123456789
                          },
                    Severity: Major
                    Found in src/modules/universe/selectors/reporting-cycle.test.js and 1 other location - About 2 hrs to fix
                    src/modules/universe/selectors/reporting-cycle.test.js on lines 20..37

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

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

                      render() {
                        const {
                          claimTradingProceeds,
                          closedMarkets,
                          currentTimestamp,
                    Severity: Major
                    Found in src/modules/portfolio/components/positions/positions.jsx - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language