Showing 665 of 665 total issues

Function _decompressUncompressed has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  _decompressUncompressed(frameIndex = 0) {
    // papaya.volume.nifti.NIFTI_TYPE_UINT8           = 2;
    // papaya.volume.nifti.NIFTI_TYPE_INT16           = 4;
    // papaya.volume.nifti.NIFTI_TYPE_INT32           = 8;
    // papaya.volume.nifti.NIFTI_TYPE_FLOAT32        = 16;
Severity: Minor
Found in src/parsers/parsers.nifti.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 _create has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    _create() {
      if (!this._stack || !this._stack.prepared || !this._stack.packed) {
        return;
      }

Severity: Major
Found in src/helpers/helpers.slice.js - About 2 hrs to fix

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

      compute(dataCoordinates, dataValue, offset) {
        this.computeDefinition();
        this._base._functions[this._name] = this._definition;
        return `${this._name}(${dataCoordinates}, ${dataValue}, ${offset});`;
      }
    Severity: Major
    Found in src/shaders/helpers/shaders.helpers.texture3d.js and 2 other locations - About 2 hrs to fix
    src/shaders/helpers/shaders.helpers.unpack.js on lines 42..46
    src/shaders/interpolation/shaders.interpolation.trilinear.js on lines 25..29

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

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

      compute(currentVoxel, dataValue, gradient) {
        this.computeDefinition();
        this._base._functions[this._name] = this._definition;
        return `${this._name}(${currentVoxel}, ${dataValue}, ${gradient});`;
      }
    src/shaders/helpers/shaders.helpers.texture3d.js on lines 24..28
    src/shaders/helpers/shaders.helpers.unpack.js on lines 42..46

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

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

      compute(packedData, offset, unpackedData) {
        this.computeDefinition();
        this._base._functions[this._name] = this._definition;
        return `${this._name}(${packedData}, ${offset}, ${unpackedData});`;
      }
    Severity: Major
    Found in src/shaders/helpers/shaders.helpers.unpack.js and 2 other locations - About 2 hrs to fix
    src/shaders/helpers/shaders.helpers.texture3d.js on lines 24..28
    src/shaders/interpolation/shaders.interpolation.trilinear.js on lines 25..29

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

    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

    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

      Function getRoI has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        static getRoI(mesh, camera, stack) {
          mesh.geometry.computeBoundingBox();
      
          const bbox = new Box3().setFromObject(mesh);
          const min = bbox.min.clone().project(camera);
      Severity: Minor
      Found in src/core/core.utils.js - About 2 hrs to fix

        Function load has 49 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          load: function(url, onLoad, onProgress, onError) {
            window.console.log(url, onLoad, onProgress, onError);
        
            let scope = this;
            let xhr = new XMLHttpRequest();
        Severity: Minor
        Found in src/loaders/loaders.trk.js - About 1 hr to fix

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

            static get code() {
              return `
                  .widgets-handle {
                      position: absolute;
                      border: 1px solid;
          Severity: Minor
          Found in src/widgets/widgets.css.js - About 1 hr to fix

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

                    if (i === 1) {
                      if (scaledDirection.getComponent(i) + delta >= 1) {
                        label += 'P';
                      } else if (scaledDirection.getComponent(i) - delta <= -1) {
                        label += 'A';
            Severity: Major
            Found in src/cameras/cameras.orthographic.js and 2 other locations - About 1 hr to fix
            src/cameras/cameras.orthographic.js on lines 586..592
            src/cameras/cameras.orthographic.js on lines 602..608

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

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

                    if (i === 2) {
                      if (scaledDirection.getComponent(i) + delta >= 1) {
                        label += 'S';
                      } else if (scaledDirection.getComponent(i) - delta <= -1) {
                        label += 'I';
            Severity: Major
            Found in src/cameras/cameras.orthographic.js and 2 other locations - About 1 hr to fix
            src/cameras/cameras.orthographic.js on lines 586..592
            src/cameras/cameras.orthographic.js on lines 594..600

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

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

                    if (i === 0) {
                      if (scaledDirection.getComponent(i) + delta >= 1) {
                        label += 'L';
                      } else if (scaledDirection.getComponent(i) - delta <= -1) {
                        label += 'R';
            Severity: Major
            Found in src/cameras/cameras.orthographic.js and 2 other locations - About 1 hr to fix
            src/cameras/cameras.orthographic.js on lines 594..600
            src/cameras/cameras.orthographic.js on lines 602..608

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

            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

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

              load: function(url, onLoad, onProgress, onError) {
                let scope = this;
                let xhr = new XMLHttpRequest();
            
                function onloaded(event) {
            Severity: Minor
            Found in src/loaders/loaders.freesurfer.js - About 1 hr to fix

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

                _frameToCanvas() {
                  const dimension = this._columns * this._rows;
              
                  const params = {
                    invert: this._invert,
              Severity: Minor
              Found in src/models/models.frame.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 3 locations. Consider refactoring.
              Open

                    if (!this._dragged && this._active) {
                      this._selected = !this._selected; // change state if there was no dragging
                      this._handles.forEach(elem => (elem.selected = this._selected));
                    }
              Severity: Major
              Found in src/widgets/widgets.polygon.js and 2 other locations - About 1 hr to fix
              src/widgets/widgets.freehand.js on lines 201..204
              src/widgets/widgets.velocityTimeIntegral.js on lines 217..220

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

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

                    if (!this._dragged && this._active) {
                      this._selected = !this._selected; // change state if there was no dragging
                      this._handles.forEach(elem => (elem.selected = this._selected));
                    }
              Severity: Major
              Found in src/widgets/widgets.freehand.js and 2 other locations - About 1 hr to fix
              src/widgets/widgets.polygon.js on lines 207..210
              src/widgets/widgets.velocityTimeIntegral.js on lines 217..220

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

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

                    if (!this._dragged && this._active) {
                      this._selected = !this._selected; // change state if there was no dragging
                      this._handles.forEach(elem => (elem.selected = this._selected));
                    }
              Severity: Major
              Found in src/widgets/widgets.velocityTimeIntegral.js and 2 other locations - About 1 hr to fix
              src/widgets/widgets.freehand.js on lines 201..204
              src/widgets/widgets.polygon.js on lines 207..210

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

              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

              Function uniforms has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                static uniforms() {
                  return {
                    uCanvasWidth: {
                      type: 'f',
                      value: 0,
              Severity: Minor
              Found in src/shaders/shaders.localizer.uniform.js - About 1 hr to fix

                Function _frameToCanvas has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  _frameToCanvas() {
                    const dimension = this._columns * this._rows;
                
                    const params = {
                      invert: this._invert,
                Severity: Minor
                Found in src/models/models.frame.js - About 1 hr to fix

                  Function prepare has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    prepare() {
                      // if segmentation, merge some frames...
                      if (this._modality === 'SEG') {
                        this.prepareSegmentation();
                      }
                  Severity: Minor
                  Found in src/models/models.stack.js - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language