Showing 665 of 665 total issues

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

    let ray5 = this.posdir(
      new Vector3(
        aabb.center.x - aabb.halfDimensions.x,
        aabb.center.y - aabb.halfDimensions.y,
        aabb.center.z + aabb.halfDimensions.z
Severity: Major
Found in src/core/core.intersections.js and 2 other locations - About 3 hrs to fix
src/core/core.intersections.js on lines 187..194
src/core/core.intersections.js on lines 210..217

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

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

    createLine() {
      const line = document.createElement('div');

      line.className = 'widgets-line';
      line.addEventListener('mouseenter', this.onHover);
Severity: Major
Found in src/widgets/widgets.freehand.js and 2 other locations - About 3 hrs to fix
src/widgets/widgets.polygon.js on lines 284..292
src/widgets/widgets.velocityTimeIntegral.js on lines 285..293

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

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

    createLine() {
      const line = document.createElement('div');

      line.className = 'widgets-line';
      line.addEventListener('mouseenter', this.onHover);
Severity: Major
Found in src/widgets/widgets.polygon.js and 2 other locations - About 3 hrs to fix
src/widgets/widgets.freehand.js on lines 250..258
src/widgets/widgets.velocityTimeIntegral.js on lines 285..293

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

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

    let ray3 = this.posdir(
      new Vector3(
        aabb.center.x + aabb.halfDimensions.x,
        aabb.center.y - aabb.halfDimensions.y,
        aabb.center.z - aabb.halfDimensions.z
Severity: Major
Found in src/core/core.intersections.js and 2 other locations - About 3 hrs to fix
src/core/core.intersections.js on lines 210..217
src/core/core.intersections.js on lines 233..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 96.

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

    update() {
      this.updateColor();

      // update handles
      this._handles.forEach(elem => elem.update());
Severity: Major
Found in src/widgets/widgets.polygon.js and 1 other location - About 3 hrs to fix
src/widgets/widgets.freehand.js on lines 274..287

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

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 _decodeOpenJPEG has 75 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _decodeOpenJPEG(frameIndex = 0) {
    const encodedPixelData = this.getEncapsulatedImageFrame(frameIndex);
    const bytesPerPixel = this.bitsAllocated(frameIndex) <= 8 ? 1 : 2;
    const signed = this.pixelRepresentation(frameIndex) === 1;
    const dataPtr = openJPEG._malloc(encodedPixelData.length);
Severity: Major
Found in src/parsers/parsers.dicom.js - About 3 hrs to fix

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

            for (let v = 0; v < vertCount; v++) {
              geometry.vertices.push(
                new THREE.Vector3(
                  reader.getFloat32(offset + 0, littleEndian),
                  reader.getFloat32(offset + 4, littleEndian),
    Severity: Major
    Found in src/loaders/loaders.freesurfer.js and 1 other location - About 2 hrs to fix
    src/loaders/loaders.freesurfer.js on lines 179..188

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

    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

            for (let f = 0; f < faceCount; f++) {
              geometry.faces.push(
                new THREE.Face3(
                  reader.getInt32(offset + 0, littleEndian),
                  reader.getInt32(offset + 4, littleEndian),
    Severity: Major
    Found in src/loaders/loaders.freesurfer.js and 1 other location - About 2 hrs to fix
    src/loaders/loaders.freesurfer.js on lines 168..177

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

    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 _convertColorSpace has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

      _convertColorSpace(uncompressedData) {
        let rgbData = null;
        let photometricInterpretation = this.photometricInterpretation();
        let planarConfiguration = this.planarConfiguration();
        if  (planarConfiguration === null) {
    Severity: Minor
    Found in src/parsers/parsers.dicom.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 decode16 has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    function decode16(imageFrame, pixelData) {
      const frameData = pixelData;
      const frameSize = imageFrame.rows * imageFrame.columns;
    
      const outFrame = new ArrayBuffer(frameSize * imageFrame.samplesPerPixel * 2);
    Severity: Minor
    Found in src/decoders/decoders.rle.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 widgetsVoxelprobe has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    const widgetsVoxelprobe = (three = window.THREE) => {
      if (three === undefined || three.Object3D === undefined) {
        return null;
      }
    
    
    Severity: Minor
    Found in src/widgets/widgets.voxelProbe.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 _decodeUncompressed has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      _decodeUncompressed(frameIndex = 0) {
        let pixelRepresentation = this.pixelRepresentation(frameIndex);
        let bitsAllocated = this.bitsAllocated(frameIndex);
        let pixelDataElement = this._dataSet.elements.x7fe00010;
        let pixelDataOffset = pixelDataElement.dataOffset;
    Severity: Major
    Found in src/parsers/parsers.dicom.js - About 2 hrs to fix

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

          hideDOM() {
            this._line.style.display = 'none';
            this._line2.style.display = 'none';
            this._label.style.display = 'none';
      
      
      Severity: Major
      Found in src/widgets/widgets.angle.js and 2 other locations - About 2 hrs to fix
      src/widgets/widgets.annotation.js on lines 351..356
      src/widgets/widgets.annotation.js on lines 358..363

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

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

          dispose() {
            this._mesh.material.dispose();
            this._mesh.material = null;
            this._geometry.dispose();
            this._geometry = null;
      Severity: Major
      Found in src/helpers/helpers.boundingbox.js and 1 other location - About 2 hrs to fix
      src/helpers/helpers.border.js on lines 100..107

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

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

          dispose() {
            this._mesh.material.dispose();
            this._mesh.material = null;
            this._geometry.dispose();
            this._geometry = null;
      Severity: Major
      Found in src/helpers/helpers.border.js and 1 other location - About 2 hrs to fix
      src/helpers/helpers.boundingbox.js on lines 99..106

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

      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

          showDOM() {
            this._line.style.display = '';
            this._dashline.style.display = '';
            this._label.style.display = '';
            this._handles.forEach(elem => elem.showDOM());
      Severity: Major
      Found in src/widgets/widgets.annotation.js and 2 other locations - About 2 hrs to fix
      src/widgets/widgets.angle.js on lines 240..246
      src/widgets/widgets.annotation.js on lines 351..356

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

      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

          hideDOM() {
            this._line.style.display = 'none';
            this._dashline.style.display = 'none';
            this._label.style.display = 'none';
            this._handles.forEach(elem => elem.hideDOM());
      Severity: Major
      Found in src/widgets/widgets.annotation.js and 2 other locations - About 2 hrs to fix
      src/widgets/widgets.angle.js on lines 240..246
      src/widgets/widgets.annotation.js on lines 358..363

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

      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

      File core.utils.js has 283 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import Validators from './core.validators';
      
      import { Box3 } from 'three/src/math/Box3';
      import { Raycaster } from 'three/src/core/Raycaster';
      import { Triangle } from 'three/src/math/Triangle';
      Severity: Minor
      Found in src/core/core.utils.js - About 2 hrs to fix

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

          initEventListenner() {
            const self = this;
        
            this._emitter.on('load-start', function(event) {
              const totalFiles = event.files.length;
        Severity: Major
        Found in src/helpers/helpers.progressbar.eventbased.js - About 2 hrs to fix

          Function _decodeOpenJPEG has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

            _decodeOpenJPEG(frameIndex = 0) {
              const encodedPixelData = this.getEncapsulatedImageFrame(frameIndex);
              const bytesPerPixel = this.bitsAllocated(frameIndex) <= 8 ? 1 : 2;
              const signed = this.pixelRepresentation(frameIndex) === 1;
              const dataPtr = openJPEG._malloc(encodedPixelData.length);
          Severity: Minor
          Found in src/parsers/parsers.dicom.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

          Severity
          Category
          Status
          Source
          Language