TargetProcess/tauCharts

View on GitHub
src/elements/element.interval.js

Summary

Maintainability
F
6 days
Test Coverage

Function buildModel has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

    buildModel(screenModel, {prettify, minBarH, minBarW, baseCssClass}) {

        const barSize = ((d) => {
            var w = screenModel.size(d);
            if (prettify) {
Severity: Minor
Found in src/elements/element.interval.js - About 6 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

File element.interval.js has 446 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {CSS_PREFIX} from '../const';
import {GrammarRegistry} from '../grammar-registry';
import {LayerLabels} from './decorators/layer-labels';
import {
    d3_animationInterceptor,
Severity: Minor
Found in src/elements/element.interval.js - About 6 hrs to fix

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

        draw() {
            const node = this.node();
            const config = node.config;
            const options = config.options;
            // TODO: hide it somewhere
    Severity: Major
    Found in src/elements/element.interval.js - About 4 hrs to fix

      Function init has 94 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          init(xConfig) {
      
              const config = Object.assign({}, xConfig);
      
              config.guide = (config.guide || {});
      Severity: Major
      Found in src/elements/element.interval.js - About 3 hrs to fix

        Function buildModel has 66 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            buildModel(screenModel, {prettify, minBarH, minBarW, baseCssClass}) {
        
                const barSize = ((d) => {
                    var w = screenModel.size(d);
                    if (prettify) {
        Severity: Major
        Found in src/elements/element.interval.js - About 2 hrs to fix

          Function getClosestElement has a Cognitive Complexity of 19 (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.interval.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 _getBoundsInfo has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              _getBoundsInfo(bars) {
                  if (bars.length === 0) {
                      return null;
                  }
          
          
          Severity: Major
          Found in src/elements/element.interval.js - About 2 hrs to fix

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

                draw() {
                    const node = this.node();
                    const config = node.config;
                    const options = config.options;
                    // TODO: hide it somewhere
            Severity: Minor
            Found in src/elements/element.interval.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 getClosestElement has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                getClosestElement(_cursorX, _cursorY) {
                    if (!this._boundsInfo) {
                        return null;
                    }
                    const {bounds, tree} = this._boundsInfo;
            Severity: Major
            Found in src/elements/element.interval.js - About 2 hrs to fix

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

                  init(xConfig) {
              
                      const config = Object.assign({}, xConfig);
              
                      config.guide = (config.guide || {});
              Severity: Minor
              Found in src/elements/element.interval.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

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

                      const sortByWidthThenY = ((a, b) => {
                          const dataA = d3Data(a);
                          const dataB = d3Data(b);
                          const widthA = d3Attrs.width(dataA);
                          const widthB = d3Attrs.width(dataB);
              Severity: Major
              Found in src/elements/element.interval.js and 1 other location - About 5 hrs to fix
              src/elements/element.interval.js on lines 228..242

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

              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 sortByHeightThenX = ((a, b) => {
                          const dataA = d3Data(a);
                          const dataB = d3Data(b);
                          const heightA = d3Attrs.height(dataA);
                          const heightB = d3Attrs.height(dataB);
              Severity: Major
              Found in src/elements/element.interval.js and 1 other location - About 5 hrs to fix
              src/elements/element.interval.js on lines 213..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 140.

              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

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

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

              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.cy) :
                          ((item) => item.cx))).sort((a, b) => a - b);
              Severity: Major
              Found in src/elements/element.interval.js and 1 other location - About 1 hr to fix
              src/elements/element.path.base.js on lines 302..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 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

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

                              const params = Object.assign(
                                  {},
                                  args,
                                  {
                                      defMin: sizeCfg.defMinSize,
              Severity: Major
              Found in src/elements/element.interval.js and 2 other locations - About 1 hr to fix
              src/elements/element.line.js on lines 52..60
              src/elements/element.path.js on lines 35..43

              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

              There are no issues that match your filters.

              Category
              Status