AugurProject/augur-ui

View on GitHub
src/modules/portfolio/components/markets/markets.jsx

Summary

Maintainability
F
4 days
Test Coverage

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

  render() {
    const {
      collectMarketCreatorFees,
      loadMarketsInfoIfNotLoaded,
      history,
Severity: Major
Found in src/modules/portfolio/components/markets/markets.jsx - About 4 hrs to fix

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

      constructor(props) {
        super(props);
        // NOTE: from here to this.state was added to sort markets, this might need to be more robust in the future.
        const openMarkets = [];
        const reportingMarkets = [];
    Severity: Minor
    Found in src/modules/portfolio/components/markets/markets.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

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

            this.props.myMarkets.forEach((market, index) => {
              if (market.reportingState === this.reportingStates.PRE_REPORTING) {
                openMarkets.push(market);
                filteredMarketsOpen.push(market.id);
              } else if (
        Severity: Major
        Found in src/modules/portfolio/components/markets/markets.jsx and 1 other location - About 1 day to fix
        src/modules/portfolio/components/markets/markets.jsx on lines 102..121

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

        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

            nextProps.myMarkets.forEach((market, index) => {
              if (market.reportingState === this.reportingStates.PRE_REPORTING) {
                openMarkets.push(market);
                filteredMarketsOpen.push(market.id);
              } else if (
        Severity: Major
        Found in src/modules/portfolio/components/markets/markets.jsx and 1 other location - About 1 day to fix
        src/modules/portfolio/components/markets/markets.jsx on lines 53..72

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

        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

          static propTypes = {
            collectMarketCreatorFees: PropTypes.func.isRequired,
            loadMarketsInfoIfNotLoaded: PropTypes.func.isRequired,
            history: PropTypes.object.isRequired,
            isLogged: PropTypes.bool.isRequired,
        Severity: Major
        Found in src/modules/portfolio/components/markets/markets.jsx and 1 other location - About 7 hrs to fix
        src/modules/forking/components/migrate-rep/migrate-rep.jsx on lines 18..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 175.

        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

                {(myMarkets == null || (myMarkets && myMarkets.length === 0)) && (
                  <div className={PortfolioStyles.NoMarkets__container}>
                    <span>You haven&apos;t created any markets.</span>
                    <Link
                      className={PortfolioStyles.NoMarkets__link}
        Severity: Major
        Found in src/modules/portfolio/components/markets/markets.jsx and 1 other location - About 2 hrs to fix
        src/modules/portfolio/components/positions/positions.jsx on lines 88..98

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

        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

            const {
              collectMarketCreatorFees,
              loadMarketsInfoIfNotLoaded,
              history,
              isLogged,
        Severity: Major
        Found in src/modules/portfolio/components/markets/markets.jsx and 2 other locations - About 1 hr to fix
        src/modules/market-charts/components/market-outcome-charts--candlestick/market-outcome-charts--candlestick.jsx on lines 187..199
        src/modules/market-charts/components/market-outcome-charts--orders/market-outcome-charts--orders.jsx on lines 66..78

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

        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.setState({
              openMarkets,
              reportingMarkets,
              disputingMarkets,
              finalMarkets,
        Severity: Minor
        Found in src/modules/portfolio/components/markets/markets.jsx and 1 other location - About 35 mins to fix
        src/modules/common/components/paginator/paginator.jsx on lines 210..218

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

        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

        There are no issues that match your filters.

        Category
        Status