AugurProject/augur-ui

View on GitHub
src/modules/market-charts/components/market-outcomes-chart/market-outcomes-chart.jsx

Summary

Maintainability
D
2 days
Test Coverage

File market-outcomes-chart.jsx has 395 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { Component } from "react";
import PropTypes from "prop-types";
import { isEqual } from "lodash";

import * as d3 from "d3";

    Function drawChart has 56 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      drawChart({
        creationTime,
        currentTimestamp,
        estimatedInitialPrice,
        maxPrice,

      Function drawTicks has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function drawTicks(options) {
        const { drawParams, chart, pricePrecision } = options;
      
        // Y axis
        //  Bounds

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

          render() {
            const { pricePrecision } = this.props;
            const s = this.state;
        
            return (

          Function determineDrawParams has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function determineDrawParams(options) {
            const {
              drawContainer,
              maxPrice,
              minPrice,

            Function drawSeries has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function drawSeries(options) {
              const {
                creationTime,
                drawParams,
                estimatedInitialPrice,

              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

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

                chart
                  .append("g")
                  .selectAll("text")
                  .data(ticks)
                  .enter()
              src/modules/market-charts/components/market-outcomes-chart/market-outcomes-chart.jsx on lines 298..308

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

              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

                chart
                  .append("g")
                  .selectAll("line")
                  .data(ticks)
                  .enter()
              src/modules/market-charts/components/market-outcomes-chart/market-outcomes-chart.jsx on lines 314..321

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

              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 xScale = d3
                  .scaleTime()
                  .domain(d3.extent(xDomain))
                  .range([chartDim.left, containerWidth - chartDim.right - 1]);
              src/modules/market-charts/components/market-outcome-charts--depth/market-outcome-charts--depth.jsx on lines 419..422

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

              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

                drawChart({
                  creationTime,
                  currentTimestamp,
                  estimatedInitialPrice,
                  maxPrice,
              src/modules/forking/components/forking-content/forking-content.jsx on lines 14..185

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

              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

                chart
                  .append("line")
                  .attr("class", Styles["MarketOutcomesChart__bounding-line"])
                  .attr("x1", 0)
                  .attr("x2", drawParams.containerWidth)
              src/modules/market-charts/components/market-outcomes-chart/market-outcomes-chart.jsx on lines 280..285

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

              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

                chart
                  .append("line")
                  .attr("class", Styles["MarketOutcomesChart__bounding-line"])
                  .attr("x1", 0)
                  .attr("x2", drawParams.containerWidth)
              src/modules/market-charts/components/market-outcomes-chart/market-outcomes-chart.jsx on lines 272..277

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

              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