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("when user has insufficient REP", () => {
    test("should output 'REP'", () => {
      const validityBond = 0.01;
      const gasCost = 0.001;
      const designatedReportNoShowReputationBond = 0.035;
Severity: Major
Found in src/modules/markets/helpers/insufficient-funds.test.js and 3 other locations - About 3 hrs to fix
src/modules/markets/helpers/insufficient-funds.test.js on lines 6..25
src/modules/markets/helpers/insufficient-funds.test.js on lines 46..65
src/modules/markets/helpers/insufficient-funds.test.js on lines 66..85

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

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

        orderBook: {
          "0xdbd821cc394595f9c50f32c1554059ec343471b49f84a4b72c44589a25f70ff3": {
            amount: "50",
            block: 1125453,
            id:
Severity: Major
Found in src/modules/orders/reducers/order-books.test.js and 1 other location - About 3 hrs to fix
src/modules/orders/reducers/order-books.test.js on lines 49..72

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

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

          buy: {
            "0xdbd821cc394595f9c50f32c1554059ec343471b49f84a4b72c44589a25f70ff3": {
              amount: "50",
              block: 1125453,
              id:
Severity: Major
Found in src/modules/orders/reducers/order-books.test.js and 1 other location - About 3 hrs to fix
src/modules/orders/reducers/order-books.test.js on lines 19..42

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

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

  describe("when user has insufficient ETH", () => {
    test("should output 'ETH'", () => {
      const validityBond = 0.01;
      const gasCost = 0.001;
      const designatedReportNoShowReputationBond = 0.035;
Severity: Major
Found in src/modules/markets/helpers/insufficient-funds.test.js and 3 other locations - About 3 hrs to fix
src/modules/markets/helpers/insufficient-funds.test.js on lines 26..45
src/modules/markets/helpers/insufficient-funds.test.js on lines 46..65
src/modules/markets/helpers/insufficient-funds.test.js on lines 66..85

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

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

  describe("when user has insufficient ETH and REP", () => {
    test("should output 'ETH and REP'", () => {
      const validityBond = 0.01;
      const gasCost = 0.001;
      const designatedReportNoShowReputationBond = 0.035;
Severity: Major
Found in src/modules/markets/helpers/insufficient-funds.test.js and 3 other locations - About 3 hrs to fix
src/modules/markets/helpers/insufficient-funds.test.js on lines 6..25
src/modules/markets/helpers/insufficient-funds.test.js on lines 26..45
src/modules/markets/helpers/insufficient-funds.test.js on lines 66..85

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

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(`Updates the connection in state`, () => {
    const action = {
      type: updateConnection.UPDATE_CONNECTION_STATUS,
      data: { isConnected: true }
    };
Severity: Major
Found in src/modules/app/reducers/connection.test.js and 2 other locations - About 3 hrs to fix
src/modules/app/reducers/connection.test.js on lines 19..28
src/modules/app/reducers/connection.test.js on lines 41..50

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

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

  describe("when user has sufficient funds", () => {
    test("should output empty string", () => {
      const validityBond = 0.01;
      const gasCost = 0.001;
      const designatedReportNoShowReputationBond = 0.035;
Severity: Major
Found in src/modules/markets/helpers/insufficient-funds.test.js and 3 other locations - About 3 hrs to fix
src/modules/markets/helpers/insufficient-funds.test.js on lines 6..25
src/modules/markets/helpers/insufficient-funds.test.js on lines 26..45
src/modules/markets/helpers/insufficient-funds.test.js on lines 46..65

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

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(`Updates the isReconnectionPaused variable in the connection object in state`, () => {
    const action = {
      type: updateConnection.UPDATE_IS_RECONNECTION_PAUSED,
      data: { isReconnectionPaused: true }
    };
Severity: Major
Found in src/modules/app/reducers/connection.test.js and 2 other locations - About 3 hrs to fix
src/modules/app/reducers/connection.test.js on lines 8..17
src/modules/app/reducers/connection.test.js on lines 19..28

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

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 log-handlers.js has 297 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import BigNumber from "bignumber.js";
import {
  addNotification,
  updateNotification
} from "modules/notifications/actions/notifications";
Severity: Minor
Found in src/modules/events/actions/log-handlers.js - About 3 hrs to fix

    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

      static propTypes = {
        addresses: PropTypes.array.isRequired,
        indexArray: PropTypes.array.isRequired,
        clickAction: PropTypes.func.isRequired,
        clickPrevious: PropTypes.func.isRequired,
    src/modules/account/components/account-withdraw/account-withdraw.jsx on lines 28..36
    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

      static propTypes = {
        isLogged: PropTypes.bool.isRequired,
        connectMetaMask: PropTypes.func.isRequired,
        toggleDropdown: PropTypes.func.isRequired,
        logout: PropTypes.func.isRequired,
    src/modules/account/components/account-withdraw/account-withdraw.jsx on lines 28..36
    src/modules/auth/components/common/address-picker-content.jsx on lines 13..21

    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

    Function updateChart has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

      updateChart() {
        const { selectedSeriesData, graphPeriod, graphPeriodOptions } = this.state;
        const { margin } = this;
        const timeTickFormat = graphPeriodOptions.reduce((a, e) => {
          let newFormat = a;

    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 validateScalarNum has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

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

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

    export function getForkingInfo(universe, callback) {
      return (dispatch, getState) => {
        const universePayload = { tx: { to: universe.id } };
        // Getting current fork data
        augur.api.Universe.getForkingMarket(
    Severity: Major
    Found in src/modules/universe/actions/load-universe-info.js - About 3 hrs to fix

      Function calculateMaxPossibleShares has 77 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        (
          loginAccount,
          orders,
          makerFee,
          settlementFee,
      Severity: Major
      Found in src/modules/markets/helpers/calculate-max-possible-shares.js - About 3 hrs to fix

        Function determineDrawParams has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function determineDrawParams(options) {
          const {
            sharedChartMargins,
            depthChart,
            marketDepth,

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

                      <li>
                        <button
                          className={classNames({
                            [`${StylesForm.active}`]:
                              newMarket.expirySourceType === EXPIRY_SOURCE_GENERIC
          src/modules/create-market/components/create-market-form-outcome/create-market-form-outcome.jsx on lines 382..392
          src/modules/create-market/components/create-market-form-outcome/create-market-form-outcome.jsx on lines 393..403
          src/modules/create-market/components/create-market-form-outcome/create-market-form-outcome.jsx on lines 404..414
          src/modules/create-market/components/create-market-form-resolution/create-market-form-resolution.jsx on lines 174..188

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

          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(`big numbers completed % both non and account`, () => {
              const outcome = {
                bondSizeCurrent: 2098083496093750000,
                stakeCurrent: "2098083496093750000",
                accountStakeCurrent: "1098083496093750000"
          src/modules/reports/selectors/fill-dispute-outcome-progress.test.js on lines 44..58

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

          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(`big numbers non account complete%`, () => {
              const outcome = {
                bondSizeCurrent: 2098083496093750000,
                stakeCurrent: "1098083496093750000",
                accountStakeCurrent: "0"
          src/modules/reports/selectors/fill-dispute-outcome-progress.test.js on lines 28..42

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

          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