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

          test(`market.outcomes[${i}].userOpenOrders[${j}].type`, () => {
            expect(openOrder.type).toBeDefined();
            expect(typeof openOrder.type).toBe("string");
          });
Severity: Major
Found in src/assertions/market.js and 3 other locations - About 1 hr to fix
src/assertions/market.js on lines 217..220
src/assertions/market.js on lines 222..225
src/assertions/market.js on lines 227..230

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

      augur.connect = (env, cb) => {
        cb(null, {
          ethereumNode: {
            ...ethereumNodeConnectionInfo,
            contracts: {},
Severity: Major
Found in src/modules/app/actions/init-augur.test.js and 5 other locations - About 1 hr to fix
src/modules/app/actions/init-augur.test.js on lines 100..112
src/modules/app/actions/init-augur.test.js on lines 135..147
src/modules/app/actions/init-augur.test.js on lines 229..241
src/modules/app/actions/init-augur.test.js on lines 268..280
src/modules/app/actions/init-augur.test.js on lines 306..318

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

        augur.connect = (env, cb) => {
          cb(null, {
            ethereumNode: {
              ...ethereumNodeConnectionInfo,
              contracts: {},
Severity: Major
Found in src/modules/app/actions/init-augur.test.js and 5 other locations - About 1 hr to fix
src/modules/app/actions/init-augur.test.js on lines 100..112
src/modules/app/actions/init-augur.test.js on lines 135..147
src/modules/app/actions/init-augur.test.js on lines 175..187
src/modules/app/actions/init-augur.test.js on lines 268..280
src/modules/app/actions/init-augur.test.js on lines 306..318

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

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

          test(`market.outcomes[${i}].userOpenOrders[${j}].id`, () => {
            expect(openOrder.id).toBeDefined();
            expect(typeof openOrder.id).toBe("object");
          });
Severity: Major
Found in src/assertions/market.js and 3 other locations - About 1 hr to fix
src/assertions/market.js on lines 222..225
src/assertions/market.js on lines 227..230
src/assertions/market.js on lines 232..235

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

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

          test(`market.outcomes[${i}].userOpenOrders[${j}].outcomeName`, () => {
            expect(openOrder.outcomeName).toBeDefined();
            expect(typeof openOrder.outcomeName).toBe("string");
          });
Severity: Major
Found in src/assertions/market.js and 3 other locations - About 1 hr to fix
src/assertions/market.js on lines 217..220
src/assertions/market.js on lines 222..225
src/assertions/market.js on lines 232..235

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

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 netChange = formatEther(
    createBigNumber(
      (positionsSummary &&
        positionsSummary.netChange &&
        positionsSummary.netChange.value) ||
Severity: Major
Found in src/modules/positions/selectors/portfolio-totals.js and 1 other location - About 1 hr to fix
src/modules/positions/selectors/portfolio-totals.js on lines 11..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 65.

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 totalValue = formatEther(
    createBigNumber(
      (positionsSummary &&
        positionsSummary.totalNet &&
        positionsSummary.totalNet.value) ||
Severity: Major
Found in src/modules/positions/selectors/portfolio-totals.js and 1 other location - About 1 hr to fix
src/modules/positions/selectors/portfolio-totals.js on lines 22..32

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

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

function loadAccount(dispatch, existing, accountType, callback) {
  let loggedInAccount = null;
  const usingMetaMask = accountType === ACCOUNT_TYPES.META_MASK;
  if (windowRef.localStorage && windowRef.localStorage.getItem) {
    loggedInAccount = windowRef.localStorage.getItem("loggedInAccount");
Severity: Minor
Found in src/modules/app/actions/init-augur.js - About 1 hr to fix

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

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

      Function validateForm has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        validateForm(property, rawValue) {
          const { updateState } = this.props;
          // since the order changed by user action, make sure we can place orders.
          // updateState('doNotCreateOrders', false)
          let value = rawValue;
      Severity: Minor
      Found in src/modules/trading/components/trading--form/trading--form.jsx - About 1 hr to fix

        Function validateNumber has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          validateNumber(
            fieldName,
            rawValue,
            humanName,
            min,

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

              beforeEach(() => {
                augur.api.Market.doInitialReport.mockImplementation(
                  ({ onSent, onFailed }) => {
                    onSent();
                    onFailed();
          Severity: Major
          Found in src/modules/reports/actions/submit-initial-report.test.js and 3 other locations - About 1 hr to fix
          src/modules/reports/actions/submit-initial-report.test.js on lines 31..38
          src/modules/reports/actions/submit-market-contribute.test.js on lines 33..40
          src/modules/reports/actions/submit-market-contribute.test.js on lines 146..151

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

          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

              beforeEach(() => {
                augur.api.Market.contribute.mockImplementation(
                  ({ onSent, onSuccess }) => {
                    onSent();
                    onSuccess();
          src/modules/reports/actions/submit-initial-report.test.js on lines 31..38
          src/modules/reports/actions/submit-initial-report.test.js on lines 138..145
          src/modules/reports/actions/submit-market-contribute.test.js on lines 146..151

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

          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", () => {
              const out = {
                type: action.UPDATE_IS_RECONNECTION_PAUSED,
                data: { isReconnectionPaused: true }
              };
          Severity: Major
          Found in src/modules/app/actions/update-connection.test.js and 2 other locations - About 1 hr to fix
          src/modules/app/actions/update-connection.test.js on lines 4..10
          src/modules/app/actions/update-connection.test.js on lines 12..18

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

          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

              beforeEach(() => {
                augur.api.Market.doInitialReport.mockImplementation(
                  ({ onSent, onSuccess }) => {
                    onSent();
                    onSuccess();
          Severity: Major
          Found in src/modules/reports/actions/submit-initial-report.test.js and 3 other locations - About 1 hr to fix
          src/modules/reports/actions/submit-initial-report.test.js on lines 138..145
          src/modules/reports/actions/submit-market-contribute.test.js on lines 33..40
          src/modules/reports/actions/submit-market-contribute.test.js on lines 146..151

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

          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("Updated the ethereum node connection status", () => {
              const out = {
                type: action.UPDATE_CONNECTION_STATUS,
                data: { isConnected: true }
              };
          Severity: Major
          Found in src/modules/app/actions/update-connection.test.js and 2 other locations - About 1 hr to fix
          src/modules/app/actions/update-connection.test.js on lines 12..18
          src/modules/app/actions/update-connection.test.js on lines 28..34

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

          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

              beforeEach(() => {
                augur.api.Market.contribute.mockImplementation(({ onSent, onFailed }) => {
                  onSent();
                  onFailed();
                });
          src/modules/reports/actions/submit-initial-report.test.js on lines 31..38
          src/modules/reports/actions/submit-initial-report.test.js on lines 138..145
          src/modules/reports/actions/submit-market-contribute.test.js on lines 33..40

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

          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

                        value={
                          BigNumber.isBigNumber(s[this.INPUT_TYPES.MARKET_ORDER_SIZE])
                            ? s[this.INPUT_TYPES.MARKET_ORDER_SIZE].toNumber()
                            : s[this.INPUT_TYPES.MARKET_ORDER_SIZE]
                        }
          src/modules/trading/components/trading--form/trading--form.jsx on lines 563..567

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

          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

            let min = marketDepth[BIDS].reduce((p, order, i) => {
              if (i === 0) return order[1];
              return order[1] < p ? order[1] : p;
            }, null);
          Severity: Major
          Found in src/modules/markets/helpers/get-orderbook-keys.js and 1 other location - About 1 hr to fix
          src/modules/markets/helpers/get-orderbook-keys.js on lines 28..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 64.

          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 augur node connection status", () => {
              const out = {
                type: action.UPDATE_AUGUR_NODE_CONNECTION_STATUS,
                data: { isConnectedToAugurNode: true }
              };
          Severity: Major
          Found in src/modules/app/actions/update-connection.test.js and 2 other locations - About 1 hr to fix
          src/modules/app/actions/update-connection.test.js on lines 4..10
          src/modules/app/actions/update-connection.test.js on lines 28..34

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

          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