grommet/grommet

View on GitHub
src/js/components/DataChart/DataChart.js

Summary

Maintainability
F
1 wk
Test Coverage

Function DataChart has a Cognitive Complexity of 265 (exceeds 5 allowed). Consider refactoring.
Open

  (
    {
      a11yTitle,
      axis: axisProp = true,
      bounds: boundsProp = 'align',
Severity: Minor
Found in src/js/components/DataChart/DataChart.js - About 5 days 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

File DataChart.js has 651 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React, { forwardRef, useContext, useMemo, useState } from 'react';
import { ThemeContext } from 'styled-components';
import { Box } from '../Box';
import { Chart, calcs, calcBounds } from '../Chart';
import { Grid } from '../Grid';
Severity: Major
Found in src/js/components/DataChart/DataChart.js - About 1 day to fix

    Function chartProps has 60 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        const chartProps = useMemo(() => {
          const steps = {};
          const coarseness = horizontal ? [5, undefined] : [undefined, 5];
          if (axis && axis.x) {
            const { granularity = 'coarse' } = axis.x;
    Severity: Major
    Found in src/js/components/DataChart/DataChart.js - About 2 hrs to fix

      Function seriesStyles has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          const seriesStyles = useMemo(() => {
            const result = {};
            // start from what we were explicitly given
            charts.forEach((chart, index) => {
              const { thickness: calcThickness } = chartProps[index];
      Severity: Major
      Found in src/js/components/DataChart/DataChart.js - About 2 hrs to fix

        Function axis has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            const axis = useMemo(() => {
              if (!axisProp) return undefined;
              const result = {};
              if (axisProp === true || axisProp.x === true) result.x = {};
              if (axisProp === true || axisProp.y === true) result.y = {};
        Severity: Minor
        Found in src/js/components/DataChart/DataChart.js - About 1 hr to fix

          Function chartBounds has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                let chartBounds = chartValues.map((_, index) => {
                  const { type } = charts[index];
                  if (stackedChartType[type]) {
                    // merge values for bars, areas, and lines cases
                    let mergedValues = chartValues[index]?.[0]?.slice(0) || [];
          Severity: Minor
          Found in src/js/components/DataChart/DataChart.js - About 1 hr to fix

            Avoid deeply nested control flow statements.
            Open

                          if (data[0].date) result.y.property = 'date';
                          else if (data[0].time) result.y.property = 'time';
            Severity: Major
            Found in src/js/components/DataChart/DataChart.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          if (data[0].date) result.x.property = 'date';
                          else if (data[0].time) result.x.property = 'time';
              Severity: Major
              Found in src/js/components/DataChart/DataChart.js - About 45 mins to fix

                Avoid too many return statements within this function.
                Open

                      return [];
                Severity: Major
                Found in src/js/components/DataChart/DataChart.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        if (chartProp) return [chartProp];
                  Severity: Major
                  Found in src/js/components/DataChart/DataChart.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                              return undefined;
                    Severity: Major
                    Found in src/js/components/DataChart/DataChart.js - About 30 mins to fix

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

                            if (result.y) {
                              // if no granularity and axis, align count with axis
                              if (!result.y.granularity && axis && axis.y)
                                result.y.count = axis.y.count;
                              if (!result.y.count)
                      Severity: Major
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 3 hrs to fix
                      src/js/components/DataChart/DataChart.js on lines 427..433

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

                      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

                            if (result.x) {
                              // if no granularity and axis, align count with axis
                              if (!result.x.granularity && axis && axis.x)
                                result.x.count = axis.x.count;
                              if (!result.x.count)
                      Severity: Major
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 3 hrs to fix
                      src/js/components/DataChart/DataChart.js on lines 434..440

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

                      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

                                  if (data && data[0]) {
                                    if (data[0].date) result.y.property = 'date';
                                    else if (data[0].time) result.y.property = 'time';
                                  }
                      Severity: Major
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 1 hr to fix
                      src/js/components/DataChart/DataChart.js on lines 235..238

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

                      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

                                } else if (data && data[0]) {
                                  if (data[0].date) result.x.property = 'date';
                                  else if (data[0].time) result.x.property = 'time';
                                }
                      Severity: Major
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 1 hr to fix
                      src/js/components/DataChart/DataChart.js on lines 247..250

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

                      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

                            if (!result.x && axisProp.x)
                              result.x =
                                typeof axisProp.x === 'string'
                                  ? { property: axisProp.x }
                                  : { ...axisProp.x };
                      Severity: Major
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 1 hr to fix
                      src/js/components/DataChart/DataChart.js on lines 223..227

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

                      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

                            if (!result.y && axisProp.y)
                              result.y =
                                typeof axisProp.y === 'string'
                                  ? { property: axisProp.y }
                                  : { ...axisProp.y };
                      Severity: Major
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 1 hr to fix
                      src/js/components/DataChart/DataChart.js on lines 218..222

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

                      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

                                      if (color) {
                                        const c = seriesValues[color.property || color][index];
                                        aValue.color = color.transform ? color.transform(c) : c;
                                      }
                      Severity: Major
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 1 hr to fix
                      src/js/components/DataChart/DataChart.js on lines 158..164

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

                      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

                                      if (thickness) {
                                        const t =
                                          seriesValues[thickness.property || thickness][index];
                                        aValue.thickness = thickness.transform
                                          ? thickness.transform(t)
                      Severity: Major
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 1 hr to fix
                      src/js/components/DataChart/DataChart.js on lines 165..168

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

                      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

                                        : [
                                            i,
                                            Math.min(mergedValues[i][1], values[i][1]),
                                            Math.max(mergedValues[i][2], values[i][2]),
                                          ],
                      Severity: Major
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 1 hr to fix
                      src/js/components/DataChart/DataChart.js on lines 295..299

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

                      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

                                        ? [
                                            i,
                                            Math.min(mergedValues[i][1], values[i][1]),
                                            Math.max(mergedValues[i][1], values[i][1]),
                                          ]
                      Severity: Major
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 1 hr to fix
                      src/js/components/DataChart/DataChart.js on lines 300..304

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

                      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

                            if (result.y) {
                              const { granularity = 'coarse' } = result.y;
                              result.y.count = granularities.y[granularity];
                            }
                      Severity: Minor
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 40 mins to fix
                      src/js/components/DataChart/DataChart.js on lines 258..261

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

                      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

                            if (axis && axis.y) {
                              const { granularity = 'coarse' } = axis.y;
                              steps.y = granularities.y[granularity] - 1;
                            } else steps.y = horizontal ? data.length - 1 : 1;
                      Severity: Minor
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 40 mins to fix
                      src/js/components/DataChart/DataChart.js on lines 274..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 48.

                      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

                            if (axis && axis.x) {
                              const { granularity = 'coarse' } = axis.x;
                              steps.x = granularities.x[granularity] - 1;
                            } else steps.x = horizontal ? 1 : data.length - 1;
                      Severity: Minor
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 40 mins to fix
                      src/js/components/DataChart/DataChart.js on lines 279..282

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

                      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

                            if (result.x) {
                              const { granularity = 'coarse' } = result.x;
                              result.x.count = granularities.x[granularity];
                            }
                      Severity: Minor
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 40 mins to fix
                      src/js/components/DataChart/DataChart.js on lines 262..265

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

                      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

                                  if (charts[0])
                                    result.x.property = charts[0].property.x || charts[0].property;
                      Severity: Minor
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 35 mins to fix
                      src/js/components/DataChart/DataChart.js on lines 251..252

                      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

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

                                } else if (charts[0])
                                  result.y.property = charts[0].property.y || charts[0].property;
                      Severity: Minor
                      Found in src/js/components/DataChart/DataChart.js and 1 other location - About 35 mins to fix
                      src/js/components/DataChart/DataChart.js on lines 233..234

                      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