src/parsers/parsers.dicom.js

Summary

Maintainability
F
1 wk
Test Coverage

File parsers.dicom.js has 865 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/** * Imports ***/
import UtilsCore from '../core/core.utils';
import ParsersVolume from './parsers.volume';

import * as OpenJPEG from 'OpenJPEG.js/dist/openJPEG-DynamicMemory-browser.js';
Severity: Major
Found in src/parsers/parsers.dicom.js - About 2 days to fix

    ParsersDicom has 72 functions (exceeds 20 allowed). Consider refactoring.
    Open

    export default class ParsersDicom extends ParsersVolume {
      constructor(data, id) {
        super();
    
        this._id = id;
    Severity: Major
    Found in src/parsers/parsers.dicom.js - About 1 day to fix

      Function _decodeOpenJPEG has 75 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        _decodeOpenJPEG(frameIndex = 0) {
          const encodedPixelData = this.getEncapsulatedImageFrame(frameIndex);
          const bytesPerPixel = this.bitsAllocated(frameIndex) <= 8 ? 1 : 2;
          const signed = this.pixelRepresentation(frameIndex) === 1;
          const dataPtr = openJPEG._malloc(encodedPixelData.length);
      Severity: Major
      Found in src/parsers/parsers.dicom.js - About 3 hrs to fix

        Function _convertColorSpace has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

          _convertColorSpace(uncompressedData) {
            let rgbData = null;
            let photometricInterpretation = this.photometricInterpretation();
            let planarConfiguration = this.planarConfiguration();
            if  (planarConfiguration === null) {
        Severity: Minor
        Found in src/parsers/parsers.dicom.js - About 2 hrs 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 _decodeUncompressed has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          _decodeUncompressed(frameIndex = 0) {
            let pixelRepresentation = this.pixelRepresentation(frameIndex);
            let bitsAllocated = this.bitsAllocated(frameIndex);
            let pixelDataElement = this._dataSet.elements.x7fe00010;
            let pixelDataOffset = pixelDataElement.dataOffset;
        Severity: Major
        Found in src/parsers/parsers.dicom.js - About 2 hrs to fix

          Function _decodeOpenJPEG has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

            _decodeOpenJPEG(frameIndex = 0) {
              const encodedPixelData = this.getEncapsulatedImageFrame(frameIndex);
              const bytesPerPixel = this.bitsAllocated(frameIndex) <= 8 ? 1 : 2;
              const signed = this.pixelRepresentation(frameIndex) === 1;
              const dataPtr = openJPEG._malloc(encodedPixelData.length);
          Severity: Minor
          Found in src/parsers/parsers.dicom.js - About 2 hrs 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 _decodeUncompressed has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

            _decodeUncompressed(frameIndex = 0) {
              let pixelRepresentation = this.pixelRepresentation(frameIndex);
              let bitsAllocated = this.bitsAllocated(frameIndex);
              let pixelDataElement = this._dataSet.elements.x7fe00010;
              let pixelDataOffset = pixelDataElement.dataOffset;
          Severity: Minor
          Found in src/parsers/parsers.dicom.js - About 2 hrs 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 _convertColorSpace has 64 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            _convertColorSpace(uncompressedData) {
              let rgbData = null;
              let photometricInterpretation = this.photometricInterpretation();
              let planarConfiguration = this.planarConfiguration();
              if  (planarConfiguration === null) {
          Severity: Major
          Found in src/parsers/parsers.dicom.js - About 2 hrs to fix

            Function _decodePixelData has 33 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              _decodePixelData(frameIndex = 0) {
                // if compressed..?
                let transferSyntaxUID = this.transferSyntaxUID();
            
                // find compression scheme
            Severity: Minor
            Found in src/parsers/parsers.dicom.js - About 1 hr to fix

              Function dimensionIndexValues has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                dimensionIndexValues(frameIndex = 0) {
                  let dimensionIndexValues = null;
              
                  // try to get it from enhanced MR images
                  // per-frame functionnal group sequence
              Severity: Minor
              Found in src/parsers/parsers.dicom.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 instanceNumber has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                instanceNumber(frameIndex = 0) {
                  let instanceNumber = null;
                  // first look for frame!
                  // per frame functionnal group sequence
                  let perFrameFunctionnalGroupSequence = this._dataSet.elements.x52009230;
              Severity: Minor
              Found in src/parsers/parsers.dicom.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

              Consider simplifying this complex logical expression.
              Open

                  if (
                    !(
                      photometricInterpretation !== 'RGB' &&
                      photometricInterpretation !== 'PALETTE COLOR' &&
                      photometricInterpretation !== 'YBR_FULL' &&
              Severity: Major
              Found in src/parsers/parsers.dicom.js - About 1 hr to fix

                Function pixelSpacing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  pixelSpacing(frameIndex = 0) {
                    // expect frame index to start at 0!
                    let pixelSpacing = this._findStringEverywhere('x00289110', 'x00280030', frameIndex);
                
                    if (pixelSpacing === null) {
                Severity: Minor
                Found in src/parsers/parsers.dicom.js - About 35 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 _decodePixelData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  _decodePixelData(frameIndex = 0) {
                    // if compressed..?
                    let transferSyntaxUID = this.transferSyntaxUID();
                
                    // find compression scheme
                Severity: Minor
                Found in src/parsers/parsers.dicom.js - About 35 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 too many return statements within this function.
                Open

                            return newArray;
                Severity: Major
                Found in src/parsers/parsers.dicom.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                        return this._decodeUncompressed(frameIndex);
                  Severity: Major
                  Found in src/parsers/parsers.dicom.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                          return this._swapFrame(frame);
                    Severity: Major
                    Found in src/parsers/parsers.dicom.js - About 30 mins to fix

                      Function _decodeJPEGLossless has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        _decodeJPEGLossless(frameIndex = 0) {
                          let encodedPixelData = this.getEncapsulatedImageFrame(frameIndex);
                          let pixelRepresentation = this.pixelRepresentation(frameIndex);
                          let bitsAllocated = this.bitsAllocated(frameIndex);
                          let byteOutput = bitsAllocated <= 8 ? 1 : 2;
                      Severity: Minor
                      Found in src/parsers/parsers.dicom.js - About 25 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 _swapFrame has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                      Open

                        _swapFrame(frame) {
                          // swap bytes ( if 8bits (1byte), nothing to swap)
                          let bitsAllocated = this.bitsAllocated();
                      
                          if (bitsAllocated === 16) {
                      Severity: Minor
                      Found in src/parsers/parsers.dicom.js - About 25 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

                        inStackPositionNumber(frameIndex = 0) {
                          let inStackPositionNumber = null;
                      
                          // try to get it from enhanced MR images
                          // per-frame functionnal group sequence
                      Severity: Major
                      Found in src/parsers/parsers.dicom.js and 1 other location - About 4 hrs to fix
                      src/parsers/parsers.dicom.js on lines 656..674

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

                      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

                        stackID(frameIndex = 0) {
                          let stackID = null;
                      
                          // try to get it from enhanced MR images
                          // per-frame functionnal group sequence
                      Severity: Major
                      Found in src/parsers/parsers.dicom.js and 1 other location - About 4 hrs to fix
                      src/parsers/parsers.dicom.js on lines 636..654

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

                      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

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

                            if (uncompressedData instanceof Int8Array) {
                              rgbData = new Int8Array(uncompressedData.length);
                            } else if (uncompressedData instanceof Uint8Array) {
                              rgbData = new Uint8Array(uncompressedData.length);
                            } else if (uncompressedData instanceof Int16Array) {
                      Severity: Major
                      Found in src/parsers/parsers.dicom.js and 1 other location - About 3 hrs to fix
                      src/parsers/parsers.dicom.js on lines 1196..1207

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

                      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

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

                            if (uncompressedData instanceof Int8Array) {
                              rgbData = new Int8Array(uncompressedData.length);
                            } else if (uncompressedData instanceof Uint8Array) {
                              rgbData = new Uint8Array(uncompressedData.length);
                            } else if (uncompressedData instanceof Int16Array) {
                      Severity: Major
                      Found in src/parsers/parsers.dicom.js and 1 other location - About 3 hrs to fix
                      src/parsers/parsers.dicom.js on lines 1172..1183

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

                      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

                          } else if (signed) {
                            if (Int16Array.from) {
                              pixelData = Int16Array.from(src32);
                            } else {
                              pixelData = new Int16Array(length);
                      Severity: Major
                      Found in src/parsers/parsers.dicom.js and 1 other location - About 2 hrs to fix
                      src/parsers/parsers.dicom.js on lines 940..965

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

                      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 (bytesPerPixel === 1) {
                            if (Uint8Array.from) {
                              pixelData = Uint8Array.from(src32);
                            } else {
                              pixelData = new Uint8Array(length);
                      Severity: Major
                      Found in src/parsers/parsers.dicom.js and 1 other location - About 2 hrs to fix
                      src/parsers/parsers.dicom.js on lines 949..965

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

                      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

                        rows(frameIndex = 0) {
                          let rows = this._dataSet.uint16('x00280010');
                      
                          if (typeof rows === 'undefined') {
                            rows = null;
                      Severity: Major
                      Found in src/parsers/parsers.dicom.js and 1 other location - About 1 hr to fix
                      src/parsers/parsers.dicom.js on lines 534..543

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

                      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

                        columns(frameIndex = 0) {
                          let columns = this._dataSet.uint16('x00280011');
                      
                          if (typeof columns === 'undefined') {
                            columns = null;
                      Severity: Major
                      Found in src/parsers/parsers.dicom.js and 1 other location - About 1 hr to fix
                      src/parsers/parsers.dicom.js on lines 523..532

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

                      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

                        pixelPaddingValue(frameIndex = 0) {
                          let padding = this._dataSet.int16('x00280120');
                      
                          if (typeof padding === 'undefined') {
                            padding = null;
                      Severity: Major
                      Found in src/parsers/parsers.dicom.js and 1 other location - About 1 hr to fix
                      src/parsers/parsers.dicom.js on lines 598..606

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

                      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

                        spacingBetweenSlices(frameIndex = 0) {
                          let spacing = this._dataSet.floatString('x00180088');
                      
                          if (typeof spacing === 'undefined') {
                            spacing = null;
                      Severity: Major
                      Found in src/parsers/parsers.dicom.js and 1 other location - About 1 hr to fix
                      src/parsers/parsers.dicom.js on lines 556..564

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

                      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

                          } else if (bitsAllocated === 32) {
                            for (let i = 0; i < frame.length; i++) {
                              frame[i] = this._swap32(frame[i]);
                            }
                          }
                      Severity: Minor
                      Found in src/parsers/parsers.dicom.js and 1 other location - About 55 mins to fix
                      src/parsers/parsers.dicom.js on lines 1239..1247

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

                      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 (bitsAllocated === 16) {
                            for (let i = 0; i < frame.length; i++) {
                              frame[i] = this._swap16(frame[i]);
                            }
                          } else if (bitsAllocated === 32) {
                      Severity: Minor
                      Found in src/parsers/parsers.dicom.js and 1 other location - About 55 mins to fix
                      src/parsers/parsers.dicom.js on lines 1243..1247

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

                      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

                      There are no issues that match your filters.

                      Category
                      Status