airbnb/superset

View on GitHub
superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js

Summary

Maintainability
F
1 wk
Test Coverage

Function Rose has 519 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Rose(element, props) {
  const {
    data,
    width,
    height,
Severity: Major
Found in superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js - About 2 days to fix

    Function Rose has a Cognitive Complexity of 63 (exceeds 5 allowed). Consider refactoring.
    Open

    function Rose(element, props) {
      const {
        data,
        width,
        height,
    Severity: Minor
    Found in superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js - About 1 day 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 Rose.js has 564 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * Licensed to the Apache Software Foundation (ASF) under one
     * or more contributor license agreements.  See the NOTICE file
     * distributed with this work for additional information
     * regarding copyright ownership.  The ASF licenses this file
    Severity: Major
    Found in superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js - About 1 day to fix

      Function click has 119 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function click(b, i) {
          if (inTransition) {
            return;
          }
          const delay = d3.event.altKey ? 3750 : 375;
      Severity: Major
      Found in superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js - About 4 hrs to fix

        Function computeArcStates has 112 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function computeArcStates(adatum) {
            // Find the max sum of values across all time
            let maxSum = 0;
            let grain = 0;
            const sums = [];
        Severity: Major
        Found in superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js - About 4 hrs to fix

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

            function updateActive() {
              const delay = d3.event.altKey ? 3000 : 300;
              legendWrap.datum(legendData(datum)).call(legend);
              const nArcSt = computeArcStates(datum);
              inTransition = true;
          Severity: Major
          Found in superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js - About 2 hrs to fix

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

              function mouseover(b, i) {
                tooltip.data(tooltipData(b, i, datum)).hidden(false);
                const $this = d3.select(this);
                $this.classed('hover', true);
                if (clickId < 0 && !inTransition) {
            Severity: Minor
            Found in superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js - About 1 hr to fix

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

                function mouseout(b, i) {
                  tooltip.hidden(true);
                  const $this = d3.select(this);
                  $this.classed('hover', false);
                  if (clickId < 0 && !inTransition) {
              Severity: Minor
              Found in superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js - About 1 hr to fix

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

                    if (clickId < 0 && !inTransition) {
                      $this
                        .select('path')
                        .interrupt()
                        .transition()
                superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js on lines 424..448

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

                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 (clickId < 0 && !inTransition) {
                      $this
                        .select('path')
                        .interrupt()
                        .transition()
                superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js on lines 393..417

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

                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

                      arcs
                        .filter(d => clickSegments[0] <= d.arcId && d.arcId <= clickSegments[1])
                        .interrupt()
                        .transition()
                        .duration(delay)
                superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js on lines 505..516

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

                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

                      arcs
                        .filter(d => segments[0] <= d.arcId && d.arcId <= segments[1])
                        .interrupt()
                        .transition()
                        .duration(delay)
                superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js on lines 550..562

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

                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

                      groupLabels
                        .attr(
                          'transform',
                          `translate(${arc.centroid({
                            outerRadius: maxRadius + 20,
                superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js on lines 611..628

                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

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

                      groupLabels
                        .interrupt()
                        .transition()
                        .duration(delay)
                        .attrTween('transform', d =>
                superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js on lines 473..500

                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

                          translateTween({
                            outerRadius: maxRadius + 20,
                            innerRadius: maxRadius + 15,
                            startAngle: arcSt.data[clickId].startAngle,
                            endAngle: arcSt.data[clickId].endAngle,
                superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js on lines 476..481

                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

                          `translate(${arc.centroid({
                            outerRadius: maxRadius + 20,
                            innerRadius: maxRadius + 15,
                            startAngle: arcSt.data[i].startAngle,
                            endAngle: arcSt.data[i].endAngle,
                superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js on lines 541..546

                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 4 locations. Consider refactoring.
                Open

                  const {
                    data,
                    width,
                    height,
                    colorScheme,
                Severity: Major
                Found in superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js and 3 other locations - About 55 mins to fix
                superset-frontend/plugins/legacy-plugin-chart-histogram/src/transformProps.js on lines 21..31
                superset-frontend/plugins/legacy-plugin-chart-world-map/src/transformProps.js on lines 23..33
                superset-frontend/plugins/legacy-plugin-chart-parallel-coordinates/src/ParallelCoordinates.js on lines 41..51

                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

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

                  const groupLabels = groupLabelsWrap
                    .selectAll('g')
                    .data(JSON.parse(JSON.stringify(arcSt.groupLabels)))
                    .enter()
                    .append('g');
                Severity: Minor
                Found in superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js and 1 other location - About 50 mins to fix
                superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js on lines 351..355

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

                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 labels = labelsWrap
                    .selectAll('g')
                    .data(JSON.parse(JSON.stringify(arcSt.labels)))
                    .enter()
                    .append('g')
                Severity: Minor
                Found in superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js and 1 other location - About 50 mins to fix
                superset-frontend/plugins/legacy-plugin-chart-rose/src/Rose.js on lines 365..369

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

                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