ivmartel/dwv

View on GitHub

Showing 386 of 386 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

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

            for (var j = 0; j < -count + 1; ++j) {
              // store
              outputArray[outputIndex] = value;
              // increment index
              outputIndex += outputIndexIncrement;
    Severity: Major
    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

        Avoid deeply nested control flow statements.
        Open

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

          Avoid deeply nested control flow statements.
          Open

              if (!isClosed) {
                if (points.length === 2) {
                  shape = new Line(points[0], points[1]);
                } else if (points.length === 3) {
                  shape = new Protractor([points[0], points[1], points[2]]);
          Severity: Major
          Found in src/dicom/dicomSpatialCoordinate.js - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                    if (dicomElement.vr === 'OB') {
                      tmp = '00'.substring(0, 2 - tmp.length) + tmp;
                    } else {
                      tmp = '0000'.substring(0, 4 - tmp.length) + tmp;
                    }
            Severity: Major
            Found in src/dicom/dicomElementsWrapper.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 (readBits(1)) {
                              valueReady = !zeroBitPlanesTree.nextLevel();
                              if (valueReady) {
                                break;
                              }
                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

                                  } else if ((quantizationTableSpec >> 4) === 1) { //16 bit
                                    for (j = 0; j < 64; j++) {
                                      z = dctZigZag[j];
                                      tableData[z] = readUint16();
                                    }
                    Severity: Major
                    Found in decoders/pdfjs/jpg.js - About 45 mins to fix

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

                      export const ValueTypeValueTagName = {
                        TEXT: 'TextValue',
                        DATE: 'Date',
                        TIME: 'Time',
                        DATETIME: 'DateTime',
                      Severity: Minor
                      Found in src/dicom/dicomSRContent.js and 1 other location - About 45 mins to fix
                      src/dicom/dicomSRContent.js on lines 60..68

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

                      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

                      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

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

                        export const RelationshipTypes = {
                          contains: 'CONTAINS',
                          hasProperties: 'HAS PROPERTIES',
                          hasObsContext: 'HAS OBS CONTEXT',
                          hasAcqContext: 'HAS ACQ CONTEXT',
                        Severity: Minor
                        Found in src/dicom/dicomSRContent.js and 1 other location - About 45 mins to fix
                        src/dicom/dicomSRContent.js on lines 97..105

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

                        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

                        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

                                      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

                                          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

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

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

                                        if (this.numBytes == 1) {
                                            this.outputData = new Uint8Array(new ArrayBuffer(this.xDim * this.yDim * this.numBytes * this.numComp));
                                        } else {
                                Severity: Minor
                                Found in decoders/rii-mango/lossless.js and 1 other location - About 45 mins to fix
                                decoders/rii-mango/lossless.js on lines 440..442

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

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language