ivmartel/dwv

View on GitHub

Showing 386 of 386 total issues

Function getDimensionOrganization has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

export function getDimensionOrganization(dataElements) {
  // Dimension Organization Sequence (required)
  const orgSq = dataElements['00209221'];
  if (typeof orgSq === 'undefined' || orgSq.value.length !== 1) {
    throw new Error('Unsupported dimension organization sequence length');
Severity: Minor
Found in src/dicom/dicomElementsWrapper.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 9 has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

},{}],9:[function(require,module,exports){
/*
 * Copyright (C) 2015 Michael Martinez
 * Changes: Added support for selection values 2-7, fixed minor bugs &
 * warnings, split into multiple class files, and general clean up.
Severity: Minor
Found in decoders/rii-mango/lossless.js - About 1 hr to fix

    Function ArithmeticDecoder_readBit has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        readBit: function ArithmeticDecoder_readBit(contexts, pos) {
          // contexts are packed into 1 byte:
          // highest 7 bits carry cx.index, lowest bit carries cx.mps
          var cx_index = contexts[pos] >> 1, cx_mps = contexts[pos] & 1;
          var qeTableIcx = QeTable[cx_index];
    Severity: Minor
    Found in decoders/pdfjs/arithmetic_decoder.js - About 1 hr to fix

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

      export class SpatialCoordinate3D {
        /**
         * @type {string[]}
         */
        graphicData;
      Severity: Major
      Found in src/dicom/dicomSpatialCoordinate3D.js and 1 other location - About 1 hr to fix
      src/dicom/dicomSpatialCoordinate.js on lines 40..70

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

      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

            if (Object.prototype.hasOwnProperty.call(obj1, key)) {
              value1 = obj1[key];
              if (Object.prototype.hasOwnProperty.call(value1, valueKey)) {
                subValue1 = value1[valueKey];
              }
      Severity: Major
      Found in src/utils/operator.js and 1 other location - About 1 hr to fix
      src/utils/operator.js on lines 122..127

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

      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

      export class SpatialCoordinate {
        /**
         * @type {string[]}
         */
        graphicData;
      Severity: Major
      Found in src/dicom/dicomSpatialCoordinate.js and 1 other location - About 1 hr to fix
      src/dicom/dicomSpatialCoordinate3D.js on lines 21..51

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

      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

            if (Object.prototype.hasOwnProperty.call(obj2, key)) {
              value2 = obj2[key];
              if (Object.prototype.hasOwnProperty.call(value2, valueKey)) {
                subValue2 = value2[valueKey];
              }
      Severity: Major
      Found in src/utils/operator.js and 1 other location - About 1 hr to fix
      src/utils/operator.js on lines 113..118

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

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

      export function range(dataAccessor, start, maxIter, increment,
        blockMaxIter, blockIncrement, reverse1, reverse2) {
        if (typeof reverse1 === 'undefined') {
          reverse1 = false;
        }
      Severity: Minor
      Found in src/image/iterator.js - About 1 hr to fix

        Function getDimensionOrganization has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function getDimensionOrganization(dataElements) {
          // Dimension Organization Sequence (required)
          const orgSq = dataElements['00209221'];
          if (typeof orgSq === 'undefined' || orgSq.value.length !== 1) {
            throw new Error('Unsupported dimension organization sequence length');
        Severity: Minor
        Found in src/dicom/dicomElementsWrapper.js - About 1 hr to fix

          Function getSegment has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function getSegment(dataElements) {
            // number -> SegmentNumber (type1)
            // label -> SegmentLabel (type1)
            // algorithmType -> SegmentAlgorithmType (type1)
            const segment = new MaskSegment(
          Severity: Minor
          Found in src/dicom/dicomSegment.js - About 1 hr to fix

            Function getSRContent has 44 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export function getSRContent(dataElements) {
              // valueType -> ValueType (type1)
              let valueType = '';
              if (typeof dataElements[TagKeys.ValueType] !== 'undefined') {
                valueType = dataElements[TagKeys.ValueType].value[0];
            Severity: Minor
            Found in src/dicom/dicomSRContent.js - About 1 hr to fix

              Function BitModel_decodeSignBit has 44 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    decodeSignBit: function BitModel_decodeSignBit(row, column, index) {
                      var width = this.width, height = this.height;
                      var coefficentsMagnitude = this.coefficentsMagnitude;
                      var coefficentsSign = this.coefficentsSign;
                      var contribution, sign0, sign1, significance1;
              Severity: Minor
              Found in decoders/pdfjs/jpx.js - About 1 hr to fix

                Function getHuffmanValue has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                jpeg.lossless.Decoder.prototype.getHuffmanValue = function (table, temp, index) {
                    /*jslint bitwise: true */
                
                    var code, input, mask;
                    mask = 0xFFFF;
                Severity: Minor
                Found in decoders/rii-mango/lossless.js - About 1 hr to fix

                  Function range has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                  export function range(dataAccessor, start, maxIter, increment,
                    blockMaxIter, blockIncrement, reverse1, reverse2) {
                    if (typeof reverse1 === 'undefined') {
                      reverse1 = false;
                    }
                  Severity: Minor
                  Found in src/image/iterator.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 PageViewportClosure has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var PageViewport = PDFJS.PageViewport = (function PageViewportClosure() {
                    /**
                     * @constructor
                     * @private
                     * @param viewBox {Array} xMin, yMin, xMax and yMax coordinates.
                  Severity: Minor
                  Found in decoders/pdfjs/util.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

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

                          if (row + 1 < height) {
                            i = index + width;
                            if (left) {
                              neighborsSignificance[i - 1] += 0x10;
                            }
                  Severity: Major
                  Found in decoders/pdfjs/jpx.js and 1 other location - About 1 hr to fix
                  decoders/pdfjs/jpx.js on lines 1718..1727

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

                  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

                          if (row > 0) {
                            i = index - width;
                            if (left) {
                              neighborsSignificance[i - 1] += 0x10;
                            }
                  Severity: Major
                  Found in decoders/pdfjs/jpx.js and 1 other location - About 1 hr to fix
                  decoders/pdfjs/jpx.js on lines 1729..1738

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

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

                  jpeg.lossless.QuantizationTable.prototype.read = function (data, table) {
                      /*jslint bitwise: true */
                  
                      var count = 0, length, temp, t, i;
                  
                  
                  Severity: Minor
                  Found in decoders/rii-mango/lossless.js - About 1 hr to fix

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

                      '0042': {
                        '0000': ['UL', '1', 'GenericGroupLength'],
                        '0010': ['ST', '1', 'DocumentTitle'],
                        '0011': ['OB', '1', 'EncapsulatedDocument'],
                        '0012': ['LO', '1', 'MIMETypeOfEncapsulatedDocument'],
                    Severity: Major
                    Found in src/dicom/dictionary.js and 1 other location - About 1 hr to fix
                    src/dicom/dictionary.js on lines 3789..3797

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

                    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

                      '1000': {
                        '0000': ['UL', '1', 'GenericGroupLength'],
                        '0010': ['US', '3', 'EscapeTriplet'],
                        '0011': ['US', '3', 'RunLengthTriplet'],
                        '0012': ['US', '1', 'HuffmanTableSize'],
                    Severity: Major
                    Found in src/dicom/dictionary.js and 1 other location - About 1 hr to fix
                    src/dicom/dictionary.js on lines 2746..2754

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

                    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