Gapminder/vizabi

View on GitHub
src/helpers/labels.js

Summary

Maintainability
F
1 wk
Test Coverage

Function label has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
Open

const label = function(context) {

  return (function d3_label() {

    const _this = context;
Severity: Minor
Found in src/helpers/labels.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 labels.js has 722 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import * as utils from "base/utils";
import Class from "base/class";
import cssEscape from "css.escape";

import { close as iconClose } from "base/iconset";
Severity: Major
Found in src/helpers/labels.js - About 1 day to fix

    Function label has 249 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    const label = function(context) {
    
      return (function d3_label() {
    
        const _this = context;
    Severity: Major
    Found in src/helpers/labels.js - About 1 day to fix

      Function d3_label has 247 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        return (function d3_label() {
      
          const _this = context;
      
          let _cssPrefix;
      Severity: Major
      Found in src/helpers/labels.js - About 1 day to fix

        Function positionLabel has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring.
        Open

          positionLabel(d, index, cache, context, duration, showhide, lineGroup, position) {
            const KEY = this.KEY;
            const cached = cache || this.cached[d[KEY]];
        
            const lockPosition = (position || position === 0);
        Severity: Minor
        Found in src/helpers/labels.js - About 7 hrs 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 _repositionLabels has 120 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function _repositionLabels(d, i, _cache, labelContext, _X, _Y, _X0, _Y0, duration, showhide, lineGroup) {
        
              const cache = _cache || _this.cached[d[_this.KEY]];
        
              const labelGroup = d3.select(labelContext);
        Severity: Major
        Found in src/helpers/labels.js - About 4 hrs to fix

          Labels has 26 functions (exceeds 20 allowed). Consider refactoring.
          Open

          const Labels = Class.extend({
          
            init(context, conditions) {
              const _this = this;
              this.context = context;
          Severity: Minor
          Found in src/helpers/labels.js - About 3 hrs to fix

            Function positionLabel has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              positionLabel(d, index, cache, context, duration, showhide, lineGroup, position) {
                const KEY = this.KEY;
                const cached = cache || this.cached[d[KEY]];
            
                const lockPosition = (position || position === 0);
            Severity: Major
            Found in src/helpers/labels.js - About 2 hrs to fix

              Function label has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function label(container, isTooltip) {
                    container
                      .each(function(d, index) {
                        const view = d3.select(this);
              
              
              Severity: Major
              Found in src/helpers/labels.js - About 2 hrs to fix

                Function _updateLabelSize has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  _updateLabelSize(d, index, cache, labelGroup, valueLST, text) {
                    const _this = this;
                    const KEY = this.KEY;
                    const cached = cache || _this.cached[d[KEY]];
                
                
                Severity: Major
                Found in src/helpers/labels.js - About 2 hrs to fix

                  Function _updateLabelSize has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                    _updateLabelSize(d, index, cache, labelGroup, valueLST, text) {
                      const _this = this;
                      const KEY = this.KEY;
                      const cached = cache || _this.cached[d[KEY]];
                  
                  
                  Severity: Minor
                  Found in src/helpers/labels.js - About 2 hrs 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 updateLabel has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                    updateLabel(d, index, cache, valueX, valueY, valueS, valueC, valueL, valueLST, duration, showhide) {
                      const _this = this;
                      const KEYS = this.KEYS;
                      const KEY = this.KEY;
                      if (d[KEY] == _this.dragging)
                  Severity: Minor
                  Found in src/helpers/labels.js - About 2 hrs 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 selectDataPoints has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    selectDataPoints() {
                      const _this = this;
                      const KEYS = this.KEYS;
                      const KEY = this.KEY;
                      const _cssPrefix = this.options.CSS_PREFIX;
                  Severity: Minor
                  Found in src/helpers/labels.js - About 1 hr to fix

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

                      updateSize() {
                        const profiles = {
                          small: {
                            minLabelTextSize: 7,
                            maxLabelTextSize: 21,
                    Severity: Minor
                    Found in src/helpers/labels.js - About 1 hr to fix

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

                        readyOnce() {
                          const _this = this;
                      
                          this.model = this.context.model;
                      
                      
                      Severity: Minor
                      Found in src/helpers/labels.js - About 1 hr to fix

                        Function _repositionLabels has 11 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            function _repositionLabels(d, i, _cache, labelContext, _X, _Y, _X0, _Y0, duration, showhide, lineGroup) {
                        Severity: Major
                        Found in src/helpers/labels.js - About 1 hr to fix

                          Function updateLabel has 11 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                            updateLabel(d, index, cache, valueX, valueY, valueS, valueC, valueL, valueLST, duration, showhide) {
                          Severity: Major
                          Found in src/helpers/labels.js - About 1 hr to fix

                            Function updateLabel has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              updateLabel(d, index, cache, valueX, valueY, valueS, valueC, valueL, valueLST, duration, showhide) {
                                const _this = this;
                                const KEYS = this.KEYS;
                                const KEY = this.KEY;
                                if (d[KEY] == _this.dragging)
                            Severity: Minor
                            Found in src/helpers/labels.js - About 1 hr to fix

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

                                setTooltip(d, tooltipText, tooltipCache, labelValues) {
                                  if (tooltipText) {
                                    let position = 0;
                                    const _cssPrefix = this.options.CSS_PREFIX;
                                    this.tooltipEl.raise().text(null);
                              Severity: Minor
                              Found in src/helpers/labels.js - About 1 hr to fix

                                Consider simplifying this complex logical expression.
                                Open

                                    if (_this.model.marker.isSelected(d)  && _this.entityLabels != null) {
                                      if (_this.cached[d[KEY]] == null) this.selectDataPoints();
                                
                                      const cached = _this.cached[d[KEY]];
                                      if (cache) utils.extend(cached, cache);
                                Severity: Major
                                Found in src/helpers/labels.js - About 1 hr to fix

                                  Function positionLabel has 8 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                    positionLabel(d, index, cache, context, duration, showhide, lineGroup, position) {
                                  Severity: Major
                                  Found in src/helpers/labels.js - About 1 hr to fix

                                    Function _updateLabelSize has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                    Open

                                      _updateLabelSize(d, index, cache, labelGroup, valueLST, text) {
                                    Severity: Minor
                                    Found in src/helpers/labels.js - About 45 mins to fix

                                      Function _initNewCache has 6 arguments (exceeds 4 allowed). Consider refactoring.
                                      Open

                                        _initNewCache(cached, valueX, valueY, valueS, valueC, valueLST) {
                                      Severity: Minor
                                      Found in src/helpers/labels.js - About 45 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                              return (cornerDistance_sq <= Math.pow(circle.r, 2));
                                        Severity: Major
                                        Found in src/helpers/labels.js - About 30 mins to fix

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

                                                    lineGroup
                                                      .attr("transform", "translate(" + _X + "," + _Y + ")")
                                                      .style("opacity", 0)
                                                      .transition().duration(duration).ease(d3.easeExp)
                                                      .style("opacity", 1)
                                          Severity: Major
                                          Found in src/helpers/labels.js and 1 other location - About 3 hrs to fix
                                          src/helpers/labels.js on lines 218..228

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

                                          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

                                                    labelGroup
                                                      .attr("transform", "translate(" + _X + "," + _Y + ")")
                                                      .style("opacity", 0)
                                                      .transition().duration(duration).ease(d3.easeExp)
                                                      .style("opacity", 1)
                                          Severity: Major
                                          Found in src/helpers/labels.js and 1 other location - About 3 hrs to fix
                                          src/helpers/labels.js on lines 230..240

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

                                          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

                                                    labelGroup
                                                      .style("opacity", 1)
                                                      .transition().duration(duration).ease(d3.easeExp)
                                                      .style("opacity", 0)
                                                      .on("end", () => {
                                          Severity: Major
                                          Found in src/helpers/labels.js and 1 other location - About 2 hrs to fix
                                          src/helpers/labels.js on lines 254..262

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

                                          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

                                                    lineGroup
                                                      .style("opacity", 1)
                                                      .transition().duration(duration).ease(d3.easeExp)
                                                      .style("opacity", 0)
                                                      .on("end", () => {
                                          Severity: Major
                                          Found in src/helpers/labels.js and 1 other location - About 2 hrs to fix
                                          src/helpers/labels.js on lines 245..253

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

                                          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.tooltipEl
                                                  .classed(this.options.CSS_PREFIX + "-entity", false)
                                                  .classed(this.options.CSS_PREFIX + "-tooltip", true)
                                                  .selectAll("." + _cssPrefix + "-label-content")
                                                  .text(tooltipText);
                                          Severity: Major
                                          Found in src/helpers/labels.js and 1 other location - About 1 hr to fix
                                          src/helpers/labels.js on lines 647..651

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

                                          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.tooltipEl
                                                    .classed(this.options.CSS_PREFIX + "-tooltip", false)
                                                    .classed(this.options.CSS_PREFIX + "-entity", true)
                                                    .selectAll("." + _cssPrefix + "-label-content")
                                                    .text(labelValues.labelText);
                                          Severity: Major
                                          Found in src/helpers/labels.js and 1 other location - About 1 hr to fix
                                          src/helpers/labels.js on lines 655..659

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

                                          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 (_X + rectBBox.x <= 0) { //check left
                                                  _X = -rectBBox.x;
                                                  cache.labelX_ = (_X - _this.xScale(cache.labelX0)) / viewWidth;
                                                } else if (_X + offsetX > viewWidth) { //check right
                                                  _X = viewWidth - offsetX;
                                          Severity: Major
                                          Found in src/helpers/labels.js and 1 other location - About 1 hr to fix
                                          src/helpers/labels.js on lines 193..199

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

                                          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 (_Y + rectBBox.y <= 0) { // check top
                                                  _Y = -rectBBox.y;
                                                  cache.labelY_ = (_Y - _this.yScale(cache.labelY0)) / viewHeight;
                                                } else if (_Y + offsetY > viewHeight) { //check bottom
                                                  _Y = viewHeight - offsetY;
                                          Severity: Major
                                          Found in src/helpers/labels.js and 1 other location - About 1 hr to fix
                                          src/helpers/labels.js on lines 186..192

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

                                          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

                                                    labelGroup
                                                      .transition().duration(duration).ease(d3.easeLinear)
                                                      .attr("transform", "translate(" + _X + "," + _Y + ")");
                                          Severity: Minor
                                          Found in src/helpers/labels.js and 1 other location - About 55 mins to fix
                                          src/helpers/labels.js on lines 270..272

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

                                          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

                                                    lineGroup
                                                      .transition().duration(duration).ease(d3.easeLinear)
                                                      .attr("transform", "translate(" + _X + "," + _Y + ")");
                                          Severity: Minor
                                          Found in src/helpers/labels.js and 1 other location - About 55 mins to fix
                                          src/helpers/labels.js on lines 267..269

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

                                          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.entityLines = this.linesContainer.selectAll("g.entity-line." + _cssPrefix + "-entity")
                                                .data(select, d => (d[KEY]));
                                          Severity: Minor
                                          Found in src/helpers/labels.js and 1 other location - About 40 mins to fix
                                          src/helpers/labels.js on lines 518..519

                                          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

                                              this.entityLabels = this.labelsContainer.selectAll("." + _cssPrefix + "-entity")
                                                .data(select, d => (d[KEY]));
                                          Severity: Minor
                                          Found in src/helpers/labels.js and 1 other location - About 40 mins to fix
                                          src/helpers/labels.js on lines 520..521

                                          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

                                          There are no issues that match your filters.

                                          Category
                                          Status