AugurProject/augur-ui

View on GitHub

Showing 1,757 of 1,757 total issues

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

      test(`market.tradeSummary.tradeOrders${i}.gas`, () => {
        expect(trade.gas).toBeDefined();
        expect(typeof trade.gas).toBe("object");
      });
Severity: Major
Found in src/assertions/market.js and 13 other locations - About 1 hr to fix
src/assertions/market.js on lines 86..89
src/assertions/market.js on lines 91..94
src/assertions/market.js on lines 108..111
src/assertions/market.js on lines 113..116
src/assertions/market.js on lines 118..121
src/assertions/market.js on lines 142..145
src/assertions/market.js on lines 147..150
src/assertions/market.js on lines 152..155
src/assertions/market.js on lines 157..160
src/assertions/market.js on lines 168..171
src/assertions/market.js on lines 304..307
src/assertions/market.js on lines 324..327
src/assertions/market.js on lines 339..342

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

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

        test(`market.outcomes[${i}].trade.side`, () => {
          expect(trade.side).toBeDefined();
          expect(typeof trade.side).toBe("string");
        });
Severity: Major
Found in src/assertions/market.js and 13 other locations - About 1 hr to fix
src/assertions/market.js on lines 86..89
src/assertions/market.js on lines 91..94
src/assertions/market.js on lines 108..111
src/assertions/market.js on lines 113..116
src/assertions/market.js on lines 118..121
src/assertions/market.js on lines 147..150
src/assertions/market.js on lines 152..155
src/assertions/market.js on lines 157..160
src/assertions/market.js on lines 168..171
src/assertions/market.js on lines 304..307
src/assertions/market.js on lines 315..318
src/assertions/market.js on lines 324..327
src/assertions/market.js on lines 339..342

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

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

          onFailed: res => {
            dispatch(
              updateNotification(res.hash, {
                id: res.hash,
                status: "Failed",
Severity: Major
Found in src/modules/account/actions/get-rep.js and 1 other location - About 1 hr to fix
src/modules/auth/actions/approve-account.js on lines 40..49

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

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

      test(`market.tradeSummary.tradeOrders${i}.data`, () => {
        expect(trade.data).toBeDefined();
        expect(typeof trade.data).toBe("object");
      });
Severity: Major
Found in src/assertions/market.js and 13 other locations - About 1 hr to fix
src/assertions/market.js on lines 86..89
src/assertions/market.js on lines 91..94
src/assertions/market.js on lines 108..111
src/assertions/market.js on lines 113..116
src/assertions/market.js on lines 118..121
src/assertions/market.js on lines 142..145
src/assertions/market.js on lines 147..150
src/assertions/market.js on lines 152..155
src/assertions/market.js on lines 157..160
src/assertions/market.js on lines 168..171
src/assertions/market.js on lines 304..307
src/assertions/market.js on lines 315..318
src/assertions/market.js on lines 339..342

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

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

      onFailed: res => {
        dispatch(
          updateNotification(res.hash, {
            id: res.hash,
            status: "Failed",
Severity: Major
Found in src/modules/auth/actions/approve-account.js and 1 other location - About 1 hr to fix
src/modules/account/actions/get-rep.js on lines 36..45

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

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

    <g
      id="Symbols"
      fill="none"
      fillRule="evenodd"
      strokeLinecap="round"
Severity: Major
Found in src/modules/common/components/icons.jsx and 1 other location - About 1 hr to fix
src/modules/common/components/icons.jsx on lines 79..88

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

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

    this.drawDepth({
      marketDepth,
      orderBookKeys,
      sharedChartMargins,
      pricePrecision,
src/modules/market-charts/components/market-outcomes-chart/market-outcomes-chart.jsx on lines 86..97

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

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

                <CreateMarketResolution
                  newMarket={newMarket}
                  updateNewMarket={updateNewMarket}
                  validateField={this.validateField}
                  isValid={this.isValid}
src/modules/create-market/components/create-market-form/create-market-form.jsx on lines 362..369

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

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

                <CreateMarketOutcome
                  newMarket={newMarket}
                  updateNewMarket={updateNewMarket}
                  validateField={this.validateField}
                  isValid={this.isValid}
src/modules/create-market/components/create-market-form/create-market-form.jsx on lines 370..377

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

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

    <g id="Symbols" fill="none" fillRule="evenodd" fillOpacity="1">
      <g id="Markets/Header" fill="#9592a4">
        <g id="Group-5">
          <path
            d="M8.337 7.402h-.494l-.172-.17c.608-.707.977-1.624.977-2.63C8.647 2.37 6.837.56 4.604.56 2.37.56.56 2.37.56 4.603s1.81 4.043 4.044 4.043c1.004 0 1.92-.368 2.628-.974l.17.17v.493l3.11 3.105.928-.928-3.103-3.11zm-3.733 0c-1.547 0-2.8-1.252-2.8-2.8 0-1.544 1.253-2.798 2.8-2.798 1.545 0 2.8 1.254 2.8 2.8 0 1.546-1.255 2.798-2.8 2.798z"
Severity: Major
Found in src/modules/common/components/icons.jsx and 1 other location - About 1 hr to fix
src/modules/common/components/icons.jsx on lines 94..106

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

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

    this.drawChart({
      creationTime,
      currentTimestamp,
      estimatedInitialPrice,
      fixedPrecision,
src/modules/market-charts/components/market-outcome-charts--depth/market-outcome-charts--depth.jsx on lines 71..82

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

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

function processReport(market, transaction) {
  const amountStaked = formatAttoRep(transaction.amountStaked, {
    decimals: 4,
    roundUp: true
  });
Severity: Minor
Found in src/modules/transactions/actions/add-transactions.js - About 1 hr to fix

    Function addCompleteSetsSoldLogs has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function addCompleteSetsSoldLogs(completeSetsSoldLogs) {
      return (dispatch, getState) => {
        const { marketsData } = getState();
        const completeSetsData = {};
        each(completeSetsSoldLogs, completeSetLog => {
    Severity: Minor
    Found in src/modules/transactions/actions/add-transactions.js - About 1 hr to fix

      Function validateAmount has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        validateAmount(amount, callback) {
          const { eth } = this.props;
          const { selectedAsset, repGasCost, upperBound, etherGasCost } = this.state;
          let gasValue = etherGasCost.value;
          if (selectedAsset !== ETH) {

        Function componentWillUpdate has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          componentWillUpdate(nextProps, nextState) {
            const { isLoading, isClicked, showAdvanced } = this.props;
            if (
              nextState.walletAddresses !== this.state.walletAddresses &&
              !nextState.walletAddresses.every(element => !element)
        Severity: Minor
        Found in src/modules/auth/components/common/hardware-wallet.jsx - About 1 hr to fix

          Function mergeProps has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          const mergeProps = (sP, dP, oP) => {
            const marketId = parseQuery(oP.location.search)[MARKET_ID_PARAM_NAME];
            const market = selectMarket(marketId);
          
            return {
          Severity: Minor
          Found in src/modules/forking/containers/migrate-rep.js - About 1 hr to fix

            Function mapStateToProps has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            const mapStateToProps = (state, ownProps) => {
              const {
                creationTime = {},
                maxPrice = createBigNumber(1),
                minPrice = createBigNumber(0),
            Severity: Minor
            Found in src/modules/market-charts/containers/market-outcomes-chart.js - About 1 hr to fix

              Function sellCompleteSets has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export function sellCompleteSets(
                marketId,
                numCompleteSets,
                callback = logError
              ) {
              Severity: Minor
              Found in src/modules/positions/actions/sell-complete-sets.js - About 1 hr to fix

                Function createYesNoMarket has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export const createYesNoMarket = async (
                  address: string = "",
                  settlementFee: number = 0
                ) => {
                  // page.on('console', msg => console.log('PAGE LOG:', msg.text()));
                Severity: Minor
                Found in integration/helpers/create-markets.ts - About 1 hr to fix

                  Function selectTransactions has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                  Open

                    transactionsData => {
                      const tradeGroups = [];
                      const formattedTransactions = Object.keys(transactionsData || {})
                        .reduce((p, id) => {
                          const { tradeGroupId } = transactionsData[id];
                  Severity: Minor
                  Found in src/modules/transactions/selectors/transactions.js - About 1 hr to fix

                  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

                  Severity
                  Category
                  Status
                  Source
                  Language