AugurProject/augur-ui

View on GitHub

Showing 1,757 of 1,757 total issues

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

  describe("categorical 3", () => {
    test(`should call the expected method`, () => {
      const actual = calculatePayoutNumeratorsValue(
        marketCategorical,
        [0, 0, 0, 10003, 0, 0, 0],
Severity: Major
Found in src/utils/calculate-payout-numerators-value.test.js and 2 other locations - About 1 hr to fix
src/utils/calculate-payout-numerators-value.test.js on lines 173..183
src/utils/calculate-payout-numerators-value.test.js on lines 197..207

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

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

  describe("categorical 6", () => {
    test(`should call the expected method`, () => {
      const actual = calculatePayoutNumeratorsValue(
        marketCategorical,
        [0, 0, 0, 0, 0, 0, 10003],
Severity: Major
Found in src/utils/calculate-payout-numerators-value.test.js and 2 other locations - About 1 hr to fix
src/utils/calculate-payout-numerators-value.test.js on lines 173..183
src/utils/calculate-payout-numerators-value.test.js on lines 185..195

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

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

    store.dispatch(
      loadOneOutcomeBidsOrAsks(
        params.marketId,
        params.outcome,
        params.orderTypeLabel,
src/modules/orders/actions/load-one-outcome-bids-or-asks.test.js on lines 39..51
src/modules/orders/actions/load-one-outcome-bids-or-asks.test.js on lines 61..73
src/modules/orders/actions/load-one-outcome-bids-or-asks.test.js on lines 105..115

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

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="Page-1" transform="translate(5.000000, 1.000000)">
          <path
            d="M13.341625,18.1445846 C13.341625,17.1418923 13.341625,15.8667385 13.3407656,15.2456615 C13.3399062,14.1879692 13.0056094,13.2453538 12.3120937,12.4347385 C11.4724844,11.4548923 10.4025625,10.9108154 9.09889063,10.8659692 C8.47584375,10.8448154 7.56920313,10.8431231 6.76225,10.8465077"
            id="Stroke-1"
          />
Severity: Major
Found in src/modules/common/components/nav-account-icon.jsx and 1 other location - About 1 hr to fix
src/modules/common/components/icons.jsx on lines 1169..1186

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

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

  nextPage() {
    this.setState({
      currentStep: this.state.currentStep >= 1 ? 1 : this.state.currentStep + 1
    });
    this.calculateGasEstimates(this.props.gasPrice);
src/modules/reporting/components/reporting-dispute/reporting-dispute.jsx on lines 79..84

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

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

  describe("categorical 0", () => {
    test(`should call the expected method`, () => {
      const actual = calculatePayoutNumeratorsValue(
        marketCategorical,
        [10003, 0, 0, 0, 0, 0, 0],
Severity: Major
Found in src/utils/calculate-payout-numerators-value.test.js and 2 other locations - About 1 hr to fix
src/utils/calculate-payout-numerators-value.test.js on lines 185..195
src/utils/calculate-payout-numerators-value.test.js on lines 197..207

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

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

    store.dispatch(
      loadOneOutcomeBidsOrAsks(
        params.marketId,
        params.outcome,
        params.orderTypeLabel,
src/modules/orders/actions/load-one-outcome-bids-or-asks.test.js on lines 39..51
src/modules/orders/actions/load-one-outcome-bids-or-asks.test.js on lines 83..95
src/modules/orders/actions/load-one-outcome-bids-or-asks.test.js on lines 105..115

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

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

      onSuccess: result => {
        const ClaimReportingFeesNonforkedMarketsGasEstimate = result.gasEstimates.totals.all.toString();
        this.setState({
          ClaimReportingFeesNonforkedMarketsGasEstimate: formatGasCostToEther(
            ClaimReportingFeesNonforkedMarketsGasEstimate,
src/modules/modal/components/modal-claim-reporting-fees-forked-market.jsx on lines 39..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 74.

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

      onSuccess: result => {
        const ClaimReportingFeesForkedMarketGasEstimate = result.gasEstimates.totals.all.toString();
        this.setState({
          ClaimReportingFeesForkedMarketGasEstimate: formatGasCostToEther(
            ClaimReportingFeesForkedMarketGasEstimate,
src/modules/modal/components/modal-claim-reporting-fees-nonforked-markets.jsx on lines 53..62

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

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

  <svg viewBox="50 50 205 205">
    <path
      className="outer-lines"
      d="M66.3 199.1L152.8 55M152.8 251l-86.5-51.9M239.7 199.1L152.8 251M152.8 55l86.9 144.1"
    />
Severity: Major
Found in src/modules/common/components/icons.jsx and 1 other location - About 1 hr to fix
src/modules/common/components/nav-account-icon.jsx on lines 20..37

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

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

const orderForMarketDepth = orderBook => {
  const rawBids = ((orderBook || {})[BIDS] || []).slice();
  const bids = rawBids.reduce(
    (p, order) => [
      ...p,
Severity: Minor
Found in src/modules/markets/helpers/order-for-market-depth.js - About 1 hr to fix

    Function submitNewMarket has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function submitNewMarket(newMarket, history, callback = noop) {
      return (dispatch, getState) => {
        const { universe, loginAccount, contractAddresses } = getState();
        const { createMarket, formattedNewMarket } = buildCreateMarket(
          newMarket,
    Severity: Minor
    Found in src/modules/markets/actions/submit-new-market.js - About 1 hr to fix

      Function createReducer has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function createReducer() {
        return {
          accountDisputes,
          accountPositions,
          accountTrades,
      Severity: Minor
      Found in src/reducers.js - About 1 hr to fix

        Function constructor has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          constructor(props) {
            super(props);
        
            let selectedOutcome = props.newMarket.type === CATEGORICAL ? "" : 1;
            if (

          Function verifyLiquidityOrderBook has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export async function verifyLiquidityOrderBook(
            askOrders: LiquidityChartRows,
            bidOrders: LiquidityChartRows,
            timeoutMilliseconds = 10000
          ) {
          Severity: Minor
          Found in integration/helpers/liquidity.ts - About 1 hr to fix

            Function default has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            export default function(
              numShares,
              limitPrice,
              side,
              minPrice,
            Severity: Minor
            Found in src/modules/trades/helpers/calc-order-profit-loss-percents.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

            Function handleMarketFinalizedLog has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

            export const handleMarketFinalizedLog = log => (dispatch, getState) =>
              dispatch(
                loadMarketsInfo([log.market], err => {
                  if (err) return console.error(err);
                  const { author } = getState().marketsData[log.market];
            Severity: Minor
            Found in src/modules/events/actions/log-handlers.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

            Function calculateMaxPossibleShares has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              (
                loginAccount,
                orders,
                makerFee,
                settlementFee,
            Severity: Minor
            Found in src/modules/markets/helpers/calculate-max-possible-shares.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

            Function render has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              render() {
                const {
                  blockchain,
                  coreStats,
                  history,
            Severity: Minor
            Found in src/modules/app/components/app/app.jsx - 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

            Function drawCrosshairs has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              drawCrosshairs(options) {
                const { updateHoveredDepth, sharedChartMargins } = this.props;
                if (this.depthChart) {
                  const {
                    hoveredPrice,

            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