AugurProject/augur-ui

View on GitHub

Showing 1,757 of 1,757 total issues

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

      jest
        .spyOn(augurjs.augur.events, "startAugurNodeEventListeners")
        .mockImplementation(listeners =>
          listeners.InitialReportSubmitted(null, {
            eventName: "InitialReportSubmitted",
Severity: Major
Found in src/modules/events/actions/listen-to-updates.test.js and 4 other locations - About 1 hr to fix
src/modules/events/actions/listen-to-updates.test.js on lines 287..296
src/modules/events/actions/listen-to-updates.test.js on lines 423..432
src/modules/events/actions/listen-to-updates.test.js on lines 449..458
src/modules/events/actions/listen-to-updates.test.js on lines 516..525

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

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

    const {
      hoveredPrice,
      marketDepth,
      marketMax,
      marketMin,
src/modules/market-charts/components/market-outcome-charts--depth/market-outcome-charts--depth.jsx on lines 59..70
src/modules/notifications/components/notification/notification.jsx on lines 33..44
src/modules/portfolio/components/positions/positions.jsx on lines 32..43

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

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

  shouldComponentUpdate(nextProps, nextState) {
    const updateBlock = createBigNumber(this.state.blockNumber);
    const currentBlock = createBigNumber(nextProps.currentBlockNumber);
    if (currentBlock.gt(updateBlock)) return true;
    return false;
src/modules/forking/components/migrate-rep-form/formatted-migration-totals.jsx on lines 43..48

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

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

                <li>
                  {validations.hasOwnProperty("err") && (
                    <span className={FormStyles.Form__error}>
                      {InputErrorIcon}
                      {validations.err}
src/modules/reporting/components/reporting-report-form/reporting-report-form.jsx on lines 323..330

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

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

              <li>
                {validations.hasOwnProperty("err") && (
                  <span className={FormStyles.Form__error}>
                    {InputErrorIcon}
                    {validations.err}
src/modules/forking/components/migrate-rep-form/migrate-rep-form.jsx on lines 263..270

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

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

      afterEach(() => {
        store.clearActions();
        isGlobalWeb3Spy.mockReset();
        getAugurNodeNetworkIdSpy.mockReset();
        getNetworkIdSpy.mockReset();
Severity: Major
Found in src/modules/app/actions/verify-matching-network-ids.test.js and 1 other location - About 1 hr to fix
src/modules/events/actions/listen-to-updates.test.js on lines 484..490

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

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.CreateMarketReview_inline_property}>
                    <span>Max Price</span>
                    <span>{newMarket.scalarBigNum.toString()}</span>
                  </div>
src/modules/create-market/components/create-market-form-review/create-market-form-review.jsx on lines 319..322

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

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.CreateMarketReview_inline_property}>
                    <span>Min Price</span>
                    <span>{newMarket.scalarSmallNum.toString()}</span>
                  </div>
src/modules/create-market/components/create-market-form-review/create-market-form-review.jsx on lines 323..326

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

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

  describe("when only a new ethereum-node-ws is passed", () => {
    test("should update the ethereum-node-ws in the url search string", () => {
      editEndpointParams(windowRef, {
        ethereumNodeWS: "ws://222.2.2.2:2222"
      });
Severity: Major
Found in src/utils/edit-endpoint-params.test.js and 1 other location - About 1 hr to fix
src/utils/edit-endpoint-params.test.js on lines 76..87

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

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

    afterEach(() => {
      stopBlockListenersSpy.mockReset();
      stopAugurNodeEventListenersSpy.mockReset();
      startBlockListenersSpy.mockReset();
      augurOnSpy.mockReset();
Severity: Major
Found in src/modules/events/actions/listen-to-updates.test.js and 1 other location - About 1 hr to fix
src/modules/app/actions/verify-matching-network-ids.test.js on lines 171..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 62.

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

  describe("when passed a range equal to a period's duration", () => {
    test("should not include the period in the result", () => {
      const result = limitPeriodByRange(PERIODS, 3600);
      expect(result).toEqual(PERIODS.slice(0, 1));
    });
Severity: Major
Found in src/modules/markets/helpers/limit-period-by-range.test.js and 1 other location - About 1 hr to fix
src/modules/markets/helpers/limit-period-by-range.test.js on lines 26..31

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

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 items = [
          {
            id: 1,
            endTime: { timestamp: 1 }
          },
src/modules/reporting/components/reporting-report-markets/reporting-report-markets.test.jsx on lines 54..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 62.

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

  describe("when passed a range less than a a period's duration", () => {
    test("should return the subset or period with duration less than the passed value", () => {
      const result = limitPeriodByRange(PERIODS, 3000);
      expect(result).toEqual(PERIODS.slice(0, 1));
    });
Severity: Major
Found in src/modules/markets/helpers/limit-period-by-range.test.js and 1 other location - About 1 hr to fix
src/modules/markets/helpers/limit-period-by-range.test.js on lines 33..38

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

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

  describe("when only a new ethereum-node-http is passed", () => {
    test("should update the ehtereum-node-http in the url search string", () => {
      editEndpointParams(windowRef, {
        ethereumNodeHTTP: "http://111.1.1.1:1111"
      });
Severity: Major
Found in src/utils/edit-endpoint-params.test.js and 1 other location - About 1 hr to fix
src/utils/edit-endpoint-params.test.js on lines 89..100

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

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 items = [
          {
            id: 1,
            endTime: { timestamp: 5 }
          },
src/modules/reporting/components/reporting-report-markets/reporting-report-markets.test.jsx on lines 25..38

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

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

Consider simplifying this complex logical expression.
Open

    if (
      newTradeDetails.side &&
      newTradeDetails.numShares &&
      loginAccount.address
    ) {
Severity: Critical
Found in src/modules/trades/actions/update-trades-in-progress.js - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

        if (
          !isEqual(hoveredPrice, nextProps.hoveredPrice) ||
          !isEqual(marketDepth, nextProps.marketDepth) ||
          !isEqual(this.state.yScale, nextState.yScale) ||
          !isEqual(this.state.xScale, nextState.xScale) ||

      Function loadMarketsToReportOn has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const loadMarketsToReportOn = (options, callback = logError) => (
        dispatch,
        getState
      ) => {
        const { env, universe, loginAccount } = getState();
      Severity: Minor
      Found in src/modules/reports/actions/load-markets-to-report-on.js - About 1 hr to fix

        Function updateAssets has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function updateAssets(callback = logError) {
          return (dispatch, getState) => {
            const { loginAccount, universe } = getState();
            const universeID = universe.id || UNIVERSE_ID;
            const balances = { eth: undefined, rep: undefined };
        Severity: Minor
        Found in src/modules/auth/actions/update-assets.js - About 1 hr to fix

          Function componentWillReceiveProps has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            componentWillReceiveProps(nextProps) {
              const { selectedOrderProperties } = this.props;
          
              if (!nextProps.selectedOutcome || !nextProps.selectedOutcome.trade) {
                this.setState({ currentPage: 0 });
            Severity
            Category
            Status
            Source
            Language