ivmartel/dwv

View on GitHub

Showing 386 of 386 total issues

Function quantizeAndInverse has 143 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function quantizeAndInverse(component, blockBufferOffset, p) {
    var qt = component.quantizationTable, blockData = component.blockData;
    var v0, v1, v2, v3, v4, v5, v6, v7;
    var p0, p1, p2, p3, p4, p5, p6, p7;
    var t;
Severity: Major
Found in decoders/pdfjs/jpg.js - About 5 hrs to fix

    Function decodeKeyValueUri has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    export function decodeKeyValueUri(uri, replaceMode) {
      const result = [];
    
      // repeat key replace mode (default to keep key)
      let repeatKeyReplaceMode = 'key';
    Severity: Minor
    Found in src/utils/uri.js - About 5 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 getElementValueAsString has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    function getElementValueAsString(tag, dicomElement, pretty) {
      let str = '';
      const strLenLimit = 65;
    
      // dafault to pretty output
    Severity: Minor
    Found in src/dicom/dicomElementsWrapper.js - About 5 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 ArithmeticDecoderClosure has 138 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var ArithmeticDecoder = (function ArithmeticDecoderClosure() {
      // Table C-2
      var QeTable = [
        {qe: 0x5601, nmps: 1, nlps: 1, switchFlag: 1},
        {qe: 0x3401, nmps: 2, nlps: 6, switchFlag: 0},
    Severity: Major
    Found in decoders/pdfjs/arithmetic_decoder.js - About 5 hrs to fix

      Function getDecayedDose has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
      Open

      function getDecayedDose(elements) {
        let warning = '';
        let warn;
      
        // SeriesDate (type1)
      Severity: Minor
      Found in src/dicom/dicomElementsWrapper.js - About 5 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 getSliceIterator has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

      export function getSliceIterator(
        image, position, isRescaled, viewOrientation) {
        const size = image.getGeometry().getSize();
        // zero-ify non direction index
        let dirMax2Index = 2;
      Severity: Minor
      Found in src/image/iterator.js - About 5 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 getSegmentFrameInfo has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

      export function getSegmentFrameInfo(dataElements) {
        // Derivation Image Sequence
        const derivationImages = [];
        if (typeof dataElements[TagKeys.DerivationImageSequence] !== 'undefined') {
          const derivationImageSq =
      Severity: Minor
      Found in src/dicom/dicomSegmentFrameInfo.js - About 5 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 UtilClosure has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

      var Util = PDFJS.Util = (function UtilClosure() {
        function Util() {}
      
        var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')'];
      
      
      Severity: Minor
      Found in decoders/pdfjs/util.js - About 4 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

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

          } else {
            offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
            offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
            width = Math.abs(viewBox[2] - viewBox[0]) * scale;
            height = Math.abs(viewBox[3] - viewBox[1]) * scale;
      Severity: Major
      Found in decoders/pdfjs/util.js and 1 other location - About 4 hrs to fix
      decoders/pdfjs/util.js on lines 839..844

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

      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

              var r = -122.67195406894 +
                Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr -
                      5.4080610064599e-5 * Y + 0.00048449797120281 * k -
                      0.154362151871126) +
                Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y -
      Severity: Major
      Found in decoders/pdfjs/jpg.js and 1 other location - About 4 hrs to fix
      decoders/pdfjs/jpg.js on lines 955..963

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

      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

              var b = -20.810012546947 +
                Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr +
                      0.0020741088115012 * Y - 0.00288260236853442 * k +
                      0.814272968359295) +
                Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y +
      Severity: Major
      Found in decoders/pdfjs/jpg.js and 1 other location - About 4 hrs to fix
      decoders/pdfjs/jpg.js on lines 935..943

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

      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 (rotateA === 0) {
            offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
            offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
            width = Math.abs(viewBox[3] - viewBox[1]) * scale;
            height = Math.abs(viewBox[2] - viewBox[0]) * scale;
      Severity: Major
      Found in decoders/pdfjs/util.js and 1 other location - About 4 hrs to fix
      decoders/pdfjs/util.js on lines 844..849

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

      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 getShapeFromScoord has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
      Open

      export function getShapeFromScoord(scoord) {
        // extract points
        const dataLength = scoord.graphicData.length;
        if (dataLength % 2 !== 0) {
          throw new Error('Expecting even number of coordinates in scroord data');
      Severity: Minor
      Found in src/dicom/dicomSpatialCoordinate.js - About 4 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

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

        '0034': {
          '0000': ['UL', '1', 'GenericGroupLength'],
          '0001': ['SQ', '1', 'FlowIdentifierSequence'],
          '0002': ['OB', '1', 'FlowIdentifier'],
          '0003': ['UI', '1', 'FlowTransferSyntaxUID'],
      Severity: Major
      Found in src/dicom/dictionary.js and 1 other location - About 4 hrs to fix
      src/dicom/dictionary.js on lines 3874..3888

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

      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

        '2040': {
          '0000': ['UL', '1', 'GenericGroupLength'],
          '0010': ['SQ', '1', 'ReferencedOverlayPlaneSequence'],
          '0011': ['US', '1-99', 'ReferencedOverlayPlaneGroups'],
          '0020': ['SQ', '1', 'OverlayPixelDataSequence'],
      Severity: Major
      Found in src/dicom/dictionary.js and 1 other location - About 4 hrs to fix
      src/dicom/dictionary.js on lines 2319..2333

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

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

      export function mergeObjects(obj1, obj2, idKey, valueKey) {
        const res = {};
        // check id key
        if (!idKey) {
          throw new Error('Cannot merge object with an undefined id key: ' + idKey);
      Severity: Major
      Found in src/utils/operator.js - About 4 hrs to fix

        Function 5 has 103 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        },{"./component-spec.js":1,"./data-stream.js":2}],5:[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: Major
        Found in decoders/rii-mango/lossless.js - About 4 hrs to fix

          Function transformComponents has 102 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function transformComponents(context) {
              var siz = context.SIZ;
              var components = context.components;
              var componentsCount = siz.Csiz;
              var resultImages = [];
          Severity: Major
          Found in decoders/pdfjs/jpx.js - About 4 hrs to fix

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

                  for (n = len + 2; n--; j += 2) {
                    next = gamma * x[j + 1];
                    x[j] -= current + next;
                    if (n--) {
                      j += 2;
            Severity: Major
            Found in decoders/pdfjs/jpx.js and 1 other location - About 4 hrs to fix
            decoders/pdfjs/jpx.js on lines 2177..2187

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

            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

                  for (n = len + 1; n--; j += 2) {
                    next = beta * x[j + 1];
                    x[j] -= current + next;
                    if (n--) {
                      j += 2;
            Severity: Major
            Found in decoders/pdfjs/jpx.js and 1 other location - About 4 hrs to fix
            decoders/pdfjs/jpx.js on lines 2162..2172

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

            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