ivmartel/dwv

View on GitHub

Showing 209 of 401 total issues

Avoid deeply nested control flow statements.
Open

      if (dirMax0.index === 0) {
        // xzy
        rangeObj = getRange(dataAccessor,
          start, maxIter, 1, ncols, sliceSize, reverse1, reverse2);
      } else {
Severity: Major
Found in src/image/iterator.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

              if (gotOneArg) {
                baseUrl += '&';
              }
    Severity: Major
    Found in src/utils/uri.js - About 45 mins to fix

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

      export function getDicomSegmentItem(segment) {
        let algoType = segment.algorithmType;
        if (algoType === undefined) {
          algoType = 'MANUAL';
        }
      Severity: Minor
      Found in src/dicom/dicomSegment.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

      Function decode has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      dwvdecoder.RleDecoder.prototype.decode = function (buffer,
        bitsAllocated, isSigned, sliceSize, samplesPerPixel, planarConfiguration) {
      Severity: Minor
      Found in decoders/dwv/rle.js - About 45 mins to fix

        Function rangeRegion has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

          dataAccessor, start, end, increment, regionSize, regionOffset) {
        Severity: Minor
        Found in src/image/iterator.js - About 45 mins to fix

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

          export function getViewFromDOMVideo(
            video, onloaditem, onload, onprogress, onloadend,
            origin, dataIndex) {
            // video size
            const width = video.videoWidth;
          Severity: Minor
          Found in src/image/domReader.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 (Array.isArray(subValue1)) {
                      // merged object with repeated value
                      // copy it with the index list
                      value[valueKey] = {};
                      for (let j = 0; j < id1.length; ++j) {
          Severity: Major
          Found in src/utils/operator.js - About 45 mins to fix

            Function PageViewport has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

              function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
            Severity: Minor
            Found in decoders/pdfjs/util.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                          if (sign[position] !== 0) {
                            n = -n;
                          }
              Severity: Major
              Found in decoders/pdfjs/jpx.js - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                            for (pos = c, j = 0, jj = items.length; j < jj; j++) {
                              val = items[j];
                              out[pos] = val <= min ? 0 :
                                         val >= max ? 255 : (val + offset) >> shift;
                              pos += componentsCount;
                Severity: Major
                Found in decoders/pdfjs/jpx.js - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                if (k === null) {
                                  continue;
                                }
                  Severity: Major
                  Found in decoders/pdfjs/jpx.js - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                for (pos = c, j = 0, jj = items.length; j < jj; j++) {
                                  val = items[j];
                                  out[pos] = (val + offset);
                                  pos += componentsCount;
                                }
                    Severity: Major
                    Found in decoders/pdfjs/jpx.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                    for (b = 0; b < numBuffers; b++) {
                                      items[k + b] = colBuffers[b][l];
                                    }
                      Severity: Major
                      Found in decoders/pdfjs/jpx.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                    if (reversible && (nb >= mb)) {
                                      coefficients[pos] = n;
                                    } else {
                                      coefficients[pos] = n * (1 << (mb - nb));
                                    }
                        Severity: Major
                        Found in decoders/pdfjs/jpx.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                        for (b = 0; b < numBuffers; b++) {
                                          colBuffers[b][l] = items[k + b];
                                        }
                          Severity: Major
                          Found in decoders/pdfjs/jpx.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                        for (j = 0; j < v; j++) {
                                          for (k = 0; k < h; k++) {
                                            decodeMcu(component, decodeFn, mcu, j, k);
                                          }
                                        }
                            Severity: Major
                            Found in decoders/pdfjs/jpg.js - About 45 mins to fix

                              Avoid deeply nested control flow statements.
                              Open

                                            if (k === null) {
                                              continue;
                                            }
                              Severity: Major
                              Found in decoders/pdfjs/jpx.js - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                              for (; l < layersCount;) {
                                                var packet = createPacket(resolution, k, l);
                                                l++;
                                                return packet;
                                              }
                                Severity: Major
                                Found in decoders/pdfjs/jpx.js - About 45 mins to fix

                                  Avoid deeply nested control flow statements.
                                  Open

                                                for (; l < layersCount;) {
                                                  var packet = createPacket(resolution, k, l);
                                                  l++;
                                                  return packet;
                                                }
                                  Severity: Major
                                  Found in decoders/pdfjs/jpx.js - About 45 mins to fix

                                    Avoid deeply nested control flow statements.
                                    Open

                                                    for (j = 0; j < 64; j++) {
                                                      z = dctZigZag[j];
                                                      tableData[z] = data[offset++];
                                                    }
                                    Severity: Major
                                    Found in decoders/pdfjs/jpg.js - About 45 mins to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language