Showing 271 of 665 total issues

Function _readLong has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  _readLong(len = 1) {
    let tempBuff = new DataView(this._buffer.slice(this._bufferPos, this._bufferPos + len * 8));
    this._bufferPos += len * 8;
    let v = new Uint16Array(len);
    for (let i = 0; i < len; i++) {
Severity: Minor
Found in src/parsers/parsers.mgh.js - About 55 mins 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 mergeModels has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

  mergeModels(referenceArray, targetArray) {
    if (!(this._validateModelArray(referenceArray) && this._validateModelArray(targetArray))) {
      window.console.log('invalid inputs provided.');
      return false;
    }
Severity: Minor
Found in src/models/models.base.js - About 55 mins 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 pack has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 load has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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 load has a Cognitive Complexity of 9 (exceeds 5 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 55 mins 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

Avoid deeply nested control flow statements.
Open

      for (let i = startVoxel; i < stopVoxel; i++) {
        frameIndex = ~~(i / frameDimension);
        inFrameIndex = i % frameDimension;

        let raw = frame[frameIndex].pixelData[inFrameIndex] + offset;
Severity: Major
Found in src/models/models.stack.js - About 45 mins to fix

    Function helpersBoundingBox has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

    const helpersBoundingBox = (three = window.THREE) => {
      if (three === undefined || three.Object3D === undefined) {
        return null;
      }
    
    
    Severity: Minor
    Found in src/helpers/helpers.boundingbox.js - About 45 mins 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

    Avoid deeply nested control flow statements.
    Open

                  if (leftDirection.x > 0) {
                    leftDirection.negate();
                  }
    Severity: Major
    Found in src/cameras/cameras.orthographic.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

              for (let j = 0; j < -n + 1 && outIndex < endOfSegment; ++j) {
                out[outIndex] = value;
                outIndex += imageFrame.samplesPerPixel;
              }
      Severity: Major
      Found in src/decoders/decoders.rle.js - About 45 mins to fix

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

          _decompressUncompressed(frameIndex = 0) {
            let buffer = this._buffer;
            let numberOfChannels = this.numberOfChannels();
            let numPixels = this.rows(frameIndex) * this.columns(frameIndex) * numberOfChannels;
            if (!this.rightHanded()) {
        Severity: Minor
        Found in src/parsers/parsers.mhd.js - About 45 mins 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

        Avoid deeply nested control flow statements.
        Open

                      if (superiorDirection.z < 0) {
                        superiorDirection.negate();
                      }
        Severity: Major
        Found in src/cameras/cameras.orthographic.js - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                  if (!Number.isNaN(raw)) {
                    data[4 * packIndex] = raw & 0x000000ff;
                    data[4 * packIndex + 1] = (raw >>> 8) & 0x000000ff;
                    data[4 * packIndex + 2] = (raw >>> 16) & 0x000000ff;
                    data[4 * packIndex + 3] = (raw >>> 24) & 0x000000ff;
          Severity: Major
          Found in src/models/models.stack.js - About 45 mins to fix

            Function imageOrientation has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

              imageOrientation(frameIndex = 0) {
                // http://nifti.nimh.nih.gov/pub/dist/src/niftilib/nifti1.h
                // http://nifti.nimh.nih.gov/pub/dist/src/niftilib/nifti1_io.c
                if (this._dataSet.qform_code > 0) {
                  // METHOD 2 (used when qform_code > 0, which should be the "normal" case):
            Severity: Minor
            Found in src/parsers/parsers.nifti.js - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                          if (superiorDirection.z < 0) {
                            superiorDirection.negate();
                          }
            Severity: Major
            Found in src/cameras/cameras.orthographic.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                            if (posteriorDirection.y > 0) {
                              posteriorDirection.negate();
                            }
              Severity: Major
              Found in src/cameras/cameras.orthographic.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                              if (posteriorDirection.y > 0) {
                                posteriorDirection.negate();
                              }
                Severity: Major
                Found in src/cameras/cameras.orthographic.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                      } else if (bitsAllocated === 8 && channels === 3) {
                        let data = new Uint8Array(textureSize * textureSize * 3);
                  
                        for (let i = startVoxel; i < stopVoxel; i++) {
                          frameIndex = ~~(i / frameDimension);
                  Severity: Major
                  Found in src/models/models.stack.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                            for (let j = 0; j < -n + 1 && outIndex < endOfSegment; ++j) {
                              out[outIndex] = value;
                              outIndex++;
                            }
                    Severity: Major
                    Found in src/decoders/decoders.rle.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                    if (superiorDirection.z > 0) {
                                      superiorDirection.negate();
                                    }
                      Severity: Major
                      Found in src/cameras/cameras.orthographic.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                for (let j = 0; j < -n + 1 && outIndex < frameSize; ++j) {
                                  out[outIndex * 2 + highByte] = value;
                                  outIndex++;
                                }
                        Severity: Major
                        Found in src/decoders/decoders.rle.js - About 45 mins to fix
                          Severity
                          Category
                          Status
                          Source
                          Language