AugurProject/augur-ui

View on GitHub

Showing 1,757 of 1,757 total issues

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

      asks: [
        {
          shares: formatShares(0.002),
          price: formatEther(0.35),
          cumulativeShares: createBigNumber("0.003")
Severity: Major
Found in src/modules/markets/helpers/order-for-market-depth.test.js and 1 other location - About 1 hr to fix
src/modules/markets/helpers/order-for-market-depth.test.js on lines 10..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 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.PRICE])
                    ? s[this.INPUT_TYPES.PRICE].toNumber()
                    : s[this.INPUT_TYPES.PRICE]
                }
src/modules/trading/components/trading--form/trading--form.jsx on lines 448..452

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

  yTicks
    .selectAll("line")
    .data(offsetTicks)
    .enter()
    .append("line")
src/modules/market-charts/components/market-outcome-charts--candlestick/market-outcome-charts--candlestick.jsx on lines 586..594

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

    store.dispatch(
      loadBidsAsks(params.marketId, err => {
        expect(err).toEqual("market MARKET_0 data not found");
        expect(store.getActions()).toEqual([]);
      })
Severity: Major
Found in src/modules/orders/actions/load-bids-asks.test.js and 1 other location - About 1 hr to fix
src/modules/orders/actions/load-bids-asks.test.js on lines 54..59

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

      bids: [
        {
          shares: formatShares(0.001),
          price: formatEther(0.28),
          cumulativeShares: createBigNumber("0.001")
Severity: Major
Found in src/modules/markets/helpers/order-for-market-depth.test.js and 1 other location - About 1 hr to fix
src/modules/markets/helpers/order-for-market-depth.test.js on lines 22..33

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

    store.dispatch(
      loadBidsAsks(params.marketId, err => {
        expect(err).toEqual("market MARKET_0 numOutcomes not found");
        expect(store.getActions()).toEqual([]);
      })
Severity: Major
Found in src/modules/orders/actions/load-bids-asks.test.js and 1 other location - About 1 hr to fix
src/modules/orders/actions/load-bids-asks.test.js on lines 41..46

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

export const calculateNonAccountPercentage = (
  size,
  numStakeCurrent,
  numAccountStakeCurrent
) => {
Severity: Major
Found in src/modules/reports/helpers/progress-calculations.js and 1 other location - About 1 hr to fix
src/modules/reports/helpers/progress-calculations.js on lines 43..54

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

  yTicks
    .selectAll("line")
    .data(volumeTicks)
    .enter()
    .append("line")
src/modules/market-charts/components/market-outcome-charts--candlestick/market-outcome-charts--candlestick.jsx on lines 483..491

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 max = marketDepth[ASKS].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 8..11

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

export const calculateAddedStakePercentage = (
  size,
  numAccountStake,
  numAddedStake
) => {
Severity: Major
Found in src/modules/reports/helpers/progress-calculations.js and 1 other location - About 1 hr to fix
src/modules/reports/helpers/progress-calculations.js on lines 30..41

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

Function componentWillMount has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  componentWillMount() {
    const {
      feeWindows,
      forkedMarket,
      nonforkedMarkets,

    Function getMainMenuData has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      getMainMenuData() {
        const showRepFaucet = parseInt(augur.rpc.getNetworkID(), 10) !== 1;
        const { currentBasePath } = this.props;
        return [
          {
    Severity: Minor
    Found in src/modules/app/components/inner-nav/account-inner-nav.jsx - About 1 hr to fix

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

        componentWillReceiveProps(nextProps) {
          const openMarkets = [];
          const reportingMarkets = [];
          const disputingMarkets = [];
          const finalMarkets = [];
      Severity: Minor
      Found in src/modules/portfolio/components/markets/markets.jsx - About 1 hr to fix

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

          render() {
            const { children } = this.props;
            if (this.state.hasError) {
              return (
                <section className={Styles.MainErrorBoundary}>

          Function getDerivedStateFromProps has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            static getDerivedStateFromProps(nextProps, prevState) {
              const {
                currentTimeInSeconds,
                pricePrecision,
                marketMax,

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

              constructor(props) {
                super(props);
            
                this.INPUT_TYPES = {
                  QUANTITY: "orderQuantity",
            Severity: Minor
            Found in src/modules/trading/components/trading--form/trading--form.jsx - About 1 hr to fix

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

                render() {
                  const {
                    filter,
                    sort,
                    maxFee,

                Function formatGroupedTransactions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                export function formatGroupedTransactions(transactions) {
                  const formattedTransactions = transactions
                    .map(transaction => formatTransaction(transaction))
                    .sort(
                      (a, b) =>
                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

                Function selectTopAsk has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  (marketOrderBook, excludeCurrentUser) => {
                    let topAsk;
                    if (excludeCurrentUser) {
                      const numAsks = marketOrderBook.asks.length;
                      if (numAsks) {
                Severity: Minor
                Found in src/modules/orders/helpers/select-order-book.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 selectTopBid has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                Open

                  (marketOrderBook, excludeCurrentUser) => {
                    let topBid;
                    if (excludeCurrentUser) {
                      const numBids = marketOrderBook.bids.length;
                      if (numBids) {
                Severity: Minor
                Found in src/modules/orders/helpers/select-order-book.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