ivmartel/dwv

View on GitHub

Showing 386 of 386 total issues

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

  create(dataElements, image) {
    // view
    const view = new View(image);

    // default color map
Severity: Minor
Found in src/image/viewFactory.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 rangeRegions has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function rangeRegions(
  dataAccessor, start, end, increment, regions) {
  let nextIndex = start;
  let regionCount = 0;
  let regionElementCount = 0;
Severity: Minor
Found in src/image/iterator.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 toStringId has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function toStringId(arr, dims) {
  // use all dims if not as input
  if (typeof dims === 'undefined') {
    dims = [];
    for (let i = 0; i < arr.length; ++i) {
Severity: Minor
Found in src/utils/array.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 buildMultipart has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function buildMultipart(parts, boundary) {
  const lineBreak = '\r\n';
  // build headers and calculate size
  let partsSize = 0;
  const headers = [];
Severity: Minor
Found in src/utils/array.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

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

          if (i < precinct.cbxMin) {
            precinct.cbxMin = i;
          } else if (i > precinct.cbxMax) {
            precinct.cbxMax = i;
          }
Severity: Minor
Found in decoders/pdfjs/jpx.js and 1 other location - About 55 mins to fix
decoders/pdfjs/jpx.js on lines 564..568

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

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 (j < precinct.cbyMin) {
            precinct.cbxMin = j;
          } else if (j > precinct.cbyMax) {
            precinct.cbyMax = j;
          }
Severity: Minor
Found in decoders/pdfjs/jpx.js and 1 other location - About 55 mins to fix
decoders/pdfjs/jpx.js on lines 559..563

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

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 getViewFromDOMVideo has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

  video, onloaditem, onload, onprogress, onloadend,
  origin, dataIndex) {
Severity: Major
Found in src/image/domReader.js - About 50 mins to fix

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

      if (typeof dataElements[TagKeys.MeasuredValueSequence] !== 'undefined') {
        measurement.measuredValue = getMeasuredValue(
          dataElements[TagKeys.MeasuredValueSequence].value[0]);
      }
    Severity: Major
    Found in src/dicom/dicomNumericMeasurement.js and 3 other locations - About 50 mins to fix
    src/dicom/dicomImageReference.js on lines 69..72
    src/dicom/dicomMeasuredValue.js on lines 90..94
    src/dicom/dicomNumericMeasurement.js on lines 68..72

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

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

      if (typeof dataElements[TagKeys.MeasurementUnitsCodeSequence] !==
        'undefined') {
        value.measurementUnitsCode = getCode(
          dataElements[TagKeys.MeasurementUnitsCodeSequence].value[0]);
      }
    Severity: Major
    Found in src/dicom/dicomMeasuredValue.js and 3 other locations - About 50 mins to fix
    src/dicom/dicomImageReference.js on lines 69..72
    src/dicom/dicomNumericMeasurement.js on lines 64..67
    src/dicom/dicomNumericMeasurement.js on lines 68..72

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

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

      if (typeof dataElements[TagKeys.ReferencedSOPSequence] !== 'undefined') {
        ref.referencedSOPSequence = getSopInstanceReference(
          dataElements[TagKeys.ReferencedSOPSequence].value[0]);
      }
    Severity: Major
    Found in src/dicom/dicomImageReference.js and 3 other locations - About 50 mins to fix
    src/dicom/dicomMeasuredValue.js on lines 90..94
    src/dicom/dicomNumericMeasurement.js on lines 64..67
    src/dicom/dicomNumericMeasurement.js on lines 68..72

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

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

      if (typeof dataElements[TagKeys.NumericValueQualifierCodeSequence] !==
        'undefined') {
        measurement.numericValueQualifierCode = getCode(
          dataElements[TagKeys.NumericValueQualifierCodeSequence].value[0]);
      }
    Severity: Major
    Found in src/dicom/dicomNumericMeasurement.js and 3 other locations - About 50 mins to fix
    src/dicom/dicomImageReference.js on lines 69..72
    src/dicom/dicomMeasuredValue.js on lines 90..94
    src/dicom/dicomNumericMeasurement.js on lines 64..67

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

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

      '0100': {
        '0000': ['UL', '1', 'GenericGroupLength'],
        '0410': ['CS', '1', 'SOPInstanceStatus'],
        '0420': ['DT', '1', 'SOPAuthorizationDateTime'],
        '0424': ['LT', '1', 'SOPAuthorizationComment'],
    Severity: Major
    Found in src/dicom/dictionary.js and 2 other locations - About 50 mins to fix
    src/dicom/dictionary.js on lines 3908..3914
    src/dicom/dictionary.js on lines 4830..4836

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

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

      '2110': {
        '0000': ['UL', '1', 'GenericGroupLength'],
        '0010': ['CS', '1', 'PrinterStatus'],
        '0020': ['CS', '1', 'PrinterStatusInfo'],
        '0030': ['LO', '1', 'PrinterName'],
    Severity: Major
    Found in src/dicom/dictionary.js and 2 other locations - About 50 mins to fix
    src/dicom/dictionary.js on lines 3751..3757
    src/dicom/dictionary.js on lines 4830..4836

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

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

      '300E': {
        '0000': ['UL', '1', 'GenericGroupLength'],
        '0002': ['CS', '1', 'ApprovalStatus'],
        '0004': ['DA', '1', 'ReviewDate'],
        '0005': ['TM', '1', 'ReviewTime'],
    Severity: Major
    Found in src/dicom/dictionary.js and 2 other locations - About 50 mins to fix
    src/dicom/dictionary.js on lines 3751..3757
    src/dicom/dictionary.js on lines 3908..3914

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

    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 (typeof sourceImageSq[j][TagKeys.ReferencedSOPInstanceUID] !==
                'undefined') {
                sourceImage.referencedSOPInstanceUID =
                  sourceImageSq[j][TagKeys.ReferencedSOPInstanceUID].value[0];
              }
    Severity: Major
    Found in src/dicom/dicomSegmentFrameInfo.js - About 45 mins to fix

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

        width, height, sliceIndex,
        imageBuffer, numberOfFrames,
        imageUid) {
      Severity: Minor
      Found in src/image/domReader.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                  if (typeof sourceImageSq[j][TagKeys.ReferencedSOPClassUID] !==
                    'undefined') {
                    sourceImage.referencedSOPClassUID =
                      sourceImageSq[j][TagKeys.ReferencedSOPClassUID].value[0];
                  }
        Severity: Major
        Found in src/dicom/dicomSegmentFrameInfo.js - About 45 mins to fix

          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

            Avoid deeply nested control flow statements.
            Open

                      if (typeof value[valueKey] === 'undefined') {
                        value[valueKey] = {};
                      }
            Severity: Major
            Found in src/utils/operator.js - About 45 mins to fix

              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
                Severity
                Category
                Status
                Source
                Language