AugurProject/augur-ui

View on GitHub

Showing 1,757 of 1,757 total issues

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

  it("report on outcome_3", async () => {
    await expect(page).toClick("button", {
      text: "outcome_3",
      timeout: 1000
    });
Severity: Major
Found in integration/reporting/reporting.test.ts and 9 other locations - About 3 hrs to fix
integration/reporting/reporting.test.ts on lines 44..58
integration/reporting/reporting.test.ts on lines 60..74
integration/reporting/reporting.test.ts on lines 76..90
integration/reporting/reporting.test.ts on lines 92..106
integration/reporting/reporting.test.ts on lines 108..122
integration/reporting/reporting.test.ts on lines 155..169
integration/reporting/reporting.test.ts on lines 171..185
integration/reporting/reporting.test.ts on lines 203..217
integration/reporting/reporting.test.ts on lines 219..233

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

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

  it("report on outcome_4", async () => {
    await expect(page).toClick("button", {
      text: "outcome_4",
      timeout: 1000
    });
Severity: Major
Found in integration/reporting/reporting.test.ts and 9 other locations - About 3 hrs to fix
integration/reporting/reporting.test.ts on lines 44..58
integration/reporting/reporting.test.ts on lines 60..74
integration/reporting/reporting.test.ts on lines 76..90
integration/reporting/reporting.test.ts on lines 108..122
integration/reporting/reporting.test.ts on lines 155..169
integration/reporting/reporting.test.ts on lines 171..185
integration/reporting/reporting.test.ts on lines 187..201
integration/reporting/reporting.test.ts on lines 203..217
integration/reporting/reporting.test.ts on lines 219..233

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

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

  render() {
    const {
      isExtendedDisplay,
      isMobile,
      outcomeName,

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

                <div className={Styles["MobileOrder__confirm-options"]}>
                  <button
                    onClick={e => {
                      order.cancelOrder(order);
                      this.toggleConfirm();
    src/modules/market/components/market-positions-list--order/market-positions-list--order.jsx on lines 157..167

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

    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

          augurOnSpy = jest
            .spyOn(augurjs.augur.events.nodes.augur, "on")
            .mockImplementationOnce((label, onDisconnect) => {
              expect(label).toStrictEqual("disconnect");
              expect(typeof onDisconnect).toStrictEqual("function");
    Severity: Major
    Found in src/modules/events/actions/listen-to-updates.test.js and 1 other location - About 2 hrs to fix
    src/modules/events/actions/listen-to-updates.test.js on lines 106..112

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

    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["Order__confirm-options"]}>
                    <button
                      onClick={e => {
                        order.cancelOrder(order);
                        this.toggleConfirm();
    src/modules/market/components/market-positions-list--mobile-order/market-positions-list--mobile-order.jsx on lines 97..107

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

    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

          ethereumOnSpy = jest
            .spyOn(augurjs.augur.events.nodes.ethereum, "on")
            .mockImplementationOnce((label, onDisconnect) => {
              expect(label).toStrictEqual("disconnect");
              expect(typeof onDisconnect).toStrictEqual("function");
    Severity: Major
    Found in src/modules/events/actions/listen-to-updates.test.js and 1 other location - About 2 hrs to fix
    src/modules/events/actions/listen-to-updates.test.js on lines 99..105

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

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

      (markets, disputeOutcomes, universe) => {
        if (isEmpty(markets)) {
          return [];
        }
        let filteredMarkets = markets.filter(
    Severity: Major
    Found in src/modules/reports/selectors/select-awaiting-dispute-markets.js - About 2 hrs to fix

      Function loadAccountDataFromLocalStorage has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export const loadAccountDataFromLocalStorage = address => (
        dispatch,
        getState
      ) => {
        const localStorageRef = typeof window !== "undefined" && window.localStorage;
      Severity: Major
      Found in src/modules/auth/actions/load-account-data-from-local-storage.js - About 2 hrs to fix

        Function connectAugur has 73 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function connectAugur(
          history,
          env,
          isInitialConnection = false,
          callback = logError
        Severity: Major
        Found in src/modules/app/actions/init-augur.js - About 2 hrs to fix

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

            render() {
              const {
                removeNotification,
                toggleNotifications,
                clearNotifications,

            Function TimeProgressBar has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
            Open

            const TimeProgressBar = ({
              endTime,
              currentTime,
              startTime,
              timePeriodLabel,

            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

            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 77..81
            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

            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 77..81

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

              describe("categorical 3", () => {
                test(`should call the expected method`, () => {
                  const actual = getPayoutNumerators(marketCategorical, 3, 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 177..185
            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

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

                const expected = {
                  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 177..195
            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 114..132
            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 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 4 locations. Consider refactoring.
            Open

              describe("categorical 6", () => {
                test(`should call the expected method`, () => {
                  const actual = getPayoutNumerators(marketCategorical, 6, 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 177..185
            src/modules/reports/actions/get-payout-numerators.test.js on lines 187..195
            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

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

                const expected = {
                  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 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

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

              describe("categorical invalid", () => {
                test(`should call the expected method`, () => {
                  const actual = getPayoutNumerators(marketCategorical, 0, true).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 177..185
            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

            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

            Severity
            Category
            Status
            Source
            Language