Showing 665 of 665 total issues

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

      this._handles[3].worldPosition.copy(
        intersect.clone().sub(this._normal.clone().multiplyScalar(this._distances[3]))
      );
Severity: Major
Found in src/widgets/widgets.crossRuler.js and 1 other location - About 1 hr to fix
src/widgets/widgets.crossRuler.js on lines 475..477

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

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

    init(xCosine, yCosine, zCosine, controls, box, canvas) {
      // DEPRECATION NOTICE
      window.console.warn(
        `cameras.orthographic.init(...) is deprecated.
        Use .cosines, .controls, .box and .canvas instead.`
Severity: Minor
Found in src/cameras/cameras.orthographic.js - About 1 hr to fix

    Function decode16 has 37 lines of code (exceeds 25 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 1 hr to fix

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

          onMove(evt) {
            let hovered = false;
      
            if (this.active) {
              this._dragged = true;
      Severity: Minor
      Found in src/widgets/widgets.polygon.js - About 1 hr to fix

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

            for (let il = 0; il < 1; il++) {
              header.SWAP_ZX.push(String.fromCharCode(reader.getUint8(offset)));
              offset++;
            }
        Severity: Major
        Found in src/loaders/loaders.trk.js and 4 other locations - About 1 hr to fix
        src/loaders/loaders.trk.js on lines 102..105
        src/loaders/loaders.trk.js on lines 206..209
        src/loaders/loaders.trk.js on lines 216..219
        src/loaders/loaders.trk.js on lines 236..239

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

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

            for (let f = 0; f < 2; f++) {
              header.pad2.push(String.fromCharCode(reader.getUint8(offset)));
              offset++;
            }
        Severity: Major
        Found in src/loaders/loaders.trk.js and 4 other locations - About 1 hr to fix
        src/loaders/loaders.trk.js on lines 102..105
        src/loaders/loaders.trk.js on lines 206..209
        src/loaders/loaders.trk.js on lines 216..219
        src/loaders/loaders.trk.js on lines 271..274

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

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

            for (let d = 0; d < 4; d++) {
              header.pad2.push(String.fromCharCode(reader.getUint8(offset)));
              offset++;
            }
        Severity: Major
        Found in src/loaders/loaders.trk.js and 4 other locations - About 1 hr to fix
        src/loaders/loaders.trk.js on lines 102..105
        src/loaders/loaders.trk.js on lines 206..209
        src/loaders/loaders.trk.js on lines 236..239
        src/loaders/loaders.trk.js on lines 271..274

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

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

            for (let c = 0; c < 4; c++) {
              header.VOXEL_ORDER.push(String.fromCharCode(reader.getUint8(offset)));
              offset++;
            }
        Severity: Major
        Found in src/loaders/loaders.trk.js and 4 other locations - About 1 hr to fix
        src/loaders/loaders.trk.js on lines 102..105
        src/loaders/loaders.trk.js on lines 216..219
        src/loaders/loaders.trk.js on lines 236..239
        src/loaders/loaders.trk.js on lines 271..274

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

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

            for (let i = 0; i < 6; i++) {
              header.ID_STRING.push(String.fromCharCode(reader.getUint8(offset)));
              offset++;
            }
        Severity: Major
        Found in src/loaders/loaders.trk.js and 4 other locations - About 1 hr to fix
        src/loaders/loaders.trk.js on lines 206..209
        src/loaders/loaders.trk.js on lines 216..219
        src/loaders/loaders.trk.js on lines 236..239
        src/loaders/loaders.trk.js on lines 271..274

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

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

            constructor(halfDimensions, center, position, direction, toAABB = new three.Matrix4()) {
              //
              // prepare data for the shape!
              //
              let aabb = {
        Severity: Minor
        Found in src/geometries/geometries.slice.js - About 1 hr to fix

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

              onEnd() {
                this._handles[0].onEnd();
                this._handles[2].onEnd();
          
                if (
          Severity: Minor
          Found in src/widgets/widgets.biruler.js - About 1 hr to fix

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

                constructor(targetMesh, controls, params = {}) {
                  super(targetMesh, controls, params);
            
                  this._widgetType = 'CrossRuler';
            
            
            Severity: Minor
            Found in src/widgets/widgets.crossRuler.js - About 1 hr to fix

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

                  recalculateOrtho() {
                    // called onMove if 2nd or 3rd handle is active
                    const activeInd = this._handles[2].active ? 2 : 3;
                    const lines = [];
                    const intersect = new three.Vector3();
              Severity: Minor
              Found in src/widgets/widgets.crossRuler.js - About 1 hr to fix

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

                  _decompressUncompressed(frameIndex = 0) {
                    let buffer = this._dataSet.buffer;
                    const numberOfChannels = this.numberOfChannels();
                    const numPixels = this.rows(frameIndex) * this.columns(frameIndex) * numberOfChannels;
                    if (!this.rightHanded()) {
                Severity: Minor
                Found in src/parsers/parsers.nrrd.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 _prepareMaterial has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    _prepareMaterial() {
                      // uniforms
                      this._uniforms = ShadersUniform.uniforms();
                      this._uniforms.uWorldBBox.value = this._stack.worldBoundingBox();
                      this._uniforms.uTextureSize.value = this._stack.textureSize;
                Severity: Minor
                Found in src/helpers/helpers.volumerendering.js - About 1 hr to fix

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

                  var copy = (srcDir, dstDir) => {
                      var results = [];
                      var list = fs.readdirSync(srcDir);
                      var src, dst;
                      list.forEach(file => {
                  Severity: Minor
                  Found in scripts/buildDist.js - About 1 hr to fix

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

                      pack() {
                        // Get total number of voxels
                        const nbVoxels = this._dimensionsIJK.x * this._dimensionsIJK.y * this._dimensionsIJK.z;
                    
                        // Packing style
                    Severity: Minor
                    Found in src/models/models.stack.js - About 1 hr to fix

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

                          free() {
                            this.removeEventListeners();
                      
                            this._handles.forEach(h => {
                              this.remove(h);
                      Severity: Minor
                      Found in src/widgets/widgets.freehand.js - About 1 hr to fix

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

                            free() {
                              this.removeEventListeners();
                        
                              this._handles.forEach(elem => {
                                this.remove(elem);
                        Severity: Minor
                        Found in src/widgets/widgets.velocityTimeIntegral.js - About 1 hr to fix

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

                              constructor(targetMesh, controls, params = {}) {
                                super(targetMesh, controls, params);
                          
                                this._widgetType = 'Ellipse';
                          
                          
                          Severity: Minor
                          Found in src/widgets/widgets.ellipse.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language