TargetProcess/tauCharts

View on GitHub
src/elements/element.path.base.js

Summary

Maintainability
F
4 days
Test Coverage

File element.path.base.js has 396 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {LayerLabels} from './decorators/layer-labels';
import {CSS_PREFIX} from '../const';
import {
    d3_animationInterceptor,
    d3_setAttrs as attrs,
Severity: Minor
Found in src/elements/element.path.base.js - About 5 hrs to fix

    Function draw has 129 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        draw() {
            const node = this.node();
            const config = node.config;
            const guide = config.guide;
            const options = config.options;
    Severity: Major
    Found in src/elements/element.path.base.js - About 5 hrs to fix

      Function updateGroupContainer has 61 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              const updateGroupContainer = function (selection) {
      
                  selection.call(attrs(model.groupAttributes));
      
                  const points = selection
      Severity: Major
      Found in src/elements/element.path.base.js - About 2 hrs to fix

        Function _getBoundsInfo has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _getBoundsInfo(dots) {
                if (dots.length === 0) {
                    return null;
                }
        
        
        Severity: Minor
        Found in src/elements/element.path.base.js - About 1 hr to fix

          Function draw has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

              draw() {
                  const node = this.node();
                  const config = node.config;
                  const guide = config.guide;
                  const options = config.options;
          Severity: Minor
          Found in src/elements/element.path.base.js - About 1 hr 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 highlightDataPoints has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              highlightDataPoints(filter) {
                  const node = this.node();
                  const elModel = this.domElementModel;
                  const dots = highlightAnchors(node, elModel, filter);
                  const container = node.config.options.container;
          Severity: Minor
          Found in src/elements/element.path.base.js - About 1 hr 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 getClosestElement has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              getClosestElement(cursorX, cursorY) {
                  if (!this._boundsInfo) {
                      return null;
                  }
                  const {bounds, tree} = this._boundsInfo;
          Severity: Minor
          Found in src/elements/element.path.base.js - About 1 hr 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 init has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              init(xConfig) {
          
                  const config = xConfig;
          
                  config.guide = utils.defaults(
          Severity: Minor
          Found in src/elements/element.path.base.js - About 1 hr to fix

            Function getDataSetId has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    const getDataSetId = (() => {
                        const current = (frameSelection.empty() ? [] : frameSelection.data());
                        const currentIds = new Map();
                        frameSelection.each(function (d) {
                            currentIds.set(d, Number(this.getAttribute('data-id')));
            Severity: Minor
            Found in src/elements/element.path.base.js - About 1 hr to fix

              Function baseModel has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  baseModel(screenModel) {
              
                      const kRound = 10000;
                      var baseModel = {
                          gog: screenModel.model,
              Severity: Minor
              Found in src/elements/element.path.base.js - About 1 hr to fix

                Function getClosestElement has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    getClosestElement(cursorX, cursorY) {
                        if (!this._boundsInfo) {
                            return null;
                        }
                        const {bounds, tree} = this._boundsInfo;
                Severity: Minor
                Found in src/elements/element.path.base.js - About 1 hr to fix

                  Function highlightDataPoints has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      highlightDataPoints(filter) {
                          const node = this.node();
                          const elModel = this.domElementModel;
                          const dots = highlightAnchors(node, elModel, filter);
                          const container = node.config.options.container;
                  Severity: Minor
                  Found in src/elements/element.path.base.js - About 1 hr to fix

                    Function highlight has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        highlight(filter) {
                    
                            const container = this.node().config.options.container;
                    
                            const x = 'tau-chart__highlighted';
                    Severity: Minor
                    Found in src/elements/element.path.base.js - About 1 hr to fix

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

                              items.forEach((item) => {
                                  const tick = ticks.find(flip ? ((value) => item.y === value) : ((value) => item.x === value));
                                  groups[tick].push(item);
                              });
                      Severity: Major
                      Found in src/elements/element.path.base.js and 1 other location - About 2 hrs to fix
                      src/elements/element.interval.js on lines 395..398

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

                      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 items = (function getClosestElements(el) {
                                  if (Array.isArray(el)) {
                                      return el;
                                  }
                                  return getClosestElements(cursor > el.middle ? el.greater : el.lower);
                      Severity: Major
                      Found in src/elements/element.path.base.js and 1 other location - About 1 hr to fix
                      src/elements/element.interval.js on lines 438..456

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

                      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 ticks = utils.unique(items.map(flip ?
                                  ((item) => item.y) :
                                  ((item) => item.x))).sort((a, b) => a - b);
                      Severity: Major
                      Found in src/elements/element.path.base.js and 1 other location - About 1 hr to fix
                      src/elements/element.interval.js on lines 391..393

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

                      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

                                          selection.attr(model.pathTween.attr, function (d) {
                                              return model.pathTween.fn.call(this, d)(1);
                                          });
                      Severity: Minor
                      Found in src/elements/element.path.base.js and 1 other location - About 40 mins to fix
                      src/elements/element.path.base.js on lines 155..157

                      Duplicated Code

                      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                      Tuning

                      This issue has a mass of 49.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

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

                                          selection.attr(model.pathTween.attr, function (d) {
                                              return model.pathTween.fn.call(this, d)(0);
                                          });
                      Severity: Minor
                      Found in src/elements/element.path.base.js and 1 other location - About 40 mins to fix
                      src/elements/element.path.base.js on lines 162..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 49.

                      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                      Refactorings

                      Further Reading

                      There are no issues that match your filters.

                      Category
                      Status