src/helpers/helpers.lut.js

Summary

Maintainability
F
1 wk
Test Coverage

Function helpersLut has 731 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const helpersLut = (three = window.THREE) => {
  if (three === undefined || three.Object3D === undefined) {
    return null;
  }
  const Constructor = three.Object3D;
Severity: Major
Found in src/helpers/helpers.lut.js - About 3 days to fix

    File helpers.lut.js has 736 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import CoreUtils from '../core/core.utils';
    
    /**
     * @module helpers/lut
     */
    Severity: Major
    Found in src/helpers/helpers.lut.js - About 1 day to fix

      Function presetLuts has 303 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          static presetLuts() {
            return {
              default: [[0, 0, 0, 0], [1, 1, 1, 1]],
              spectrum: [
                [0, 0, 0, 0],
      Severity: Major
      Found in src/helpers/helpers.lut.js - About 1 day to fix

        Function presetLutsO has 266 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            static presetLutsO() {
              return {
                linear: [[0, 0], [1, 1]],
                lowpass: [[0, 0.8], [0.2, 0.6], [0.3, 0.1], [1, 0]],
                bandpass: [[0, 0], [0.4, 0.8], [0.6, 0.8], [1, 0]],
        Severity: Major
        Found in src/helpers/helpers.lut.js - About 1 day to fix

          Function helpersLut has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
          Open

          const helpersLut = (three = window.THREE) => {
            if (three === undefined || three.Object3D === undefined) {
              return null;
            }
            const Constructor = three.Object3D;
          Severity: Minor
          Found in src/helpers/helpers.lut.js - About 4 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 paintCanvas has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              paintCanvas() {
                // setup context
                let ctx = this._canvas.getContext('2d');
                ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
                ctx.globalCompositeOperation = 'source-over';
          Severity: Major
          Found in src/helpers/helpers.lut.js - About 2 hrs to fix

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

                initCanvas() {
                  // container
                  this._canvasContainer = this.initCanvasContainer(this._dom);
                  // background
                  this._canvasBg = this.createCanvas();
            Severity: Major
            Found in src/helpers/helpers.lut.js and 1 other location - About 4 hrs to fix
            src/helpers/helpers.segmentationlut.js on lines 29..38

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

            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

                get texture() {
                  let texture = new three.Texture(this._canvas);
                  texture.mapping = three.UVMapping;
                  texture.wrapS = texture.wrapT = three.ClampToEdgeWrapping;
                  texture.magFilter = texture.minFilter = three.NearestFilter;
            Severity: Major
            Found in src/helpers/helpers.lut.js and 1 other location - About 3 hrs to fix
            src/helpers/helpers.segmentationlut.js on lines 79..88

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

            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

                    hot_and_cold: [
                      [0, 0, 0, 1],
                      [0.15, 0, 1, 1],
                      [0.3, 0, 1, 0],
                      [0.45, 0, 0, 0],
            Severity: Major
            Found in src/helpers/helpers.lut.js and 1 other location - About 1 hr to fix
            src/helpers/helpers.lut.js on lines 231..241

            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

                    gold: [
                      [0, 0, 0, 0],
                      [0.13, 0.19, 0.03, 0],
                      [0.25, 0.39, 0.12, 0],
                      [0.38, 0.59, 0.26, 0],
            Severity: Major
            Found in src/helpers/helpers.lut.js and 1 other location - About 1 hr to fix
            src/helpers/helpers.lut.js on lines 220..230

            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

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

                  if (CoreUtils.isString(domTarget)) {
                    this._dom = document.getElementById(domTarget);
                  } else {
                    this._dom = domTarget;
                  }
            Severity: Major
            Found in src/helpers/helpers.lut.js and 2 other locations - About 40 mins to fix
            src/helpers/helpers.progressbar.eventbased.js on lines 21..25
            src/helpers/helpers.segmentationlut.js on lines 10..14

            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

                set lutO(targetLUTO) {
                  this._opacity = this._lutsO[targetLUTO];
                  this._lutO = targetLUTO;
            
                  this.paintCanvas();
            Severity: Minor
            Found in src/helpers/helpers.lut.js and 1 other location - About 40 mins to fix
            src/helpers/helpers.lut.js on lines 144..149

            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

                set lut(targetLUT) {
                  this._color = this._luts[targetLUT];
                  this._lut = targetLUT;
            
                  this.paintCanvas();
            Severity: Minor
            Found in src/helpers/helpers.lut.js and 1 other location - About 40 mins to fix
            src/helpers/helpers.lut.js on lines 163..168

            Duplicated Code

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

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

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

            Tuning

            This issue has a mass of 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