ivmartel/dwv

View on GitHub

Showing 386 of 386 total issues

Function PageViewportClosure has 74 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var PageViewport = PDFJS.PageViewport = (function PageViewportClosure() {
  /**
   * @constructor
   * @private
   * @param viewBox {Array} xMin, yMin, xMax and yMax coordinates.
Severity: Major
Found in decoders/pdfjs/util.js - About 2 hrs to fix

    Function Transform_iterate has 73 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        Transform.prototype.iterate = function Transform_iterate(ll, hl_lh_hh,
                                                                 u0, v0) {
          var llWidth = ll.width, llHeight = ll.height, llItems = ll.items;
          var width = hl_lh_hh.width;
          var height = hl_lh_hh.height;
    Severity: Major
    Found in decoders/pdfjs/jpx.js - About 2 hrs to fix

      Function InclusionTreeClosure has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        var InclusionTree = (function InclusionTreeClosure() {
          function InclusionTree(width, height,  defaultValue) {
            var levelsLength = log2(Math.max(width, height)) + 1;
            this.levels = [];
            for (var i = 0; i < levelsLength; i++) {
      Severity: Major
      Found in decoders/pdfjs/jpx.js - About 2 hrs to fix

        Function getSegmentFrameInfo has 71 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function getSegmentFrameInfo(dataElements) {
          // Derivation Image Sequence
          const derivationImages = [];
          if (typeof dataElements[TagKeys.DerivationImageSequence] !== 'undefined') {
            const derivationImageSq =
        Severity: Major
        Found in src/dicom/dicomSegmentFrameInfo.js - About 2 hrs to fix

          Function buildCodeblocks has 70 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function buildCodeblocks(context, subband, dimensions) {
              // Section B.7 Division sub-band into code-blocks
              var xcb_ = dimensions.xcb_;
              var ycb_ = dimensions.ycb_;
              var codeblockWidth = 1 << xcb_;
          Severity: Major
          Found in decoders/pdfjs/jpx.js - About 2 hrs to fix

            Function getShapeFromScoord has 69 lines of code (exceeds 25 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: Major
            Found in src/dicom/dicomSpatialCoordinate.js - About 2 hrs to fix

              Function getElementValueAsString has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function getElementValueAsString(tag, dicomElement, pretty) {
                let str = '';
                const strLenLimit = 65;
              
                // dafault to pretty output
              Severity: Major
              Found in src/dicom/dicomElementsWrapper.js - About 2 hrs to fix

                Function irreversibleTransformFilter has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      function irreversibleTransformFilter(x, offset, length) {
                      var len = length >> 1;
                      offset = offset | 0;
                      var j, n, current, next;
                
                
                Severity: Major
                Found in decoders/pdfjs/jpx.js - About 2 hrs to fix

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

                  var UnknownErrorException = (function UnknownErrorExceptionClosure() {
                    function UnknownErrorException(msg, details) {
                      this.name = 'UnknownErrorException';
                      this.message = msg;
                      this.details = details;
                  Severity: Major
                  Found in decoders/pdfjs/util.js and 2 other locations - About 2 hrs to fix
                  decoders/pdfjs/util.js on lines 335..346
                  decoders/pdfjs/util.js on lines 389..401

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

                  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

                  var PasswordException = (function PasswordExceptionClosure() {
                    function PasswordException(msg, code) {
                      this.name = 'PasswordException';
                      this.message = msg;
                      this.code = code;
                  Severity: Major
                  Found in decoders/pdfjs/util.js and 2 other locations - About 2 hrs to fix
                  decoders/pdfjs/util.js on lines 349..360
                  decoders/pdfjs/util.js on lines 389..401

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

                  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

                  var UnexpectedResponseException =
                      (function UnexpectedResponseExceptionClosure() {
                    function UnexpectedResponseException(msg, status) {
                      this.name = 'UnexpectedResponseException';
                      this.message = msg;
                  Severity: Major
                  Found in decoders/pdfjs/util.js and 2 other locations - About 2 hrs to fix
                  decoders/pdfjs/util.js on lines 335..346
                  decoders/pdfjs/util.js on lines 349..360

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

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

                  export function parseMultipart(arr) {
                    const u8Array = new Uint8Array(arr);
                  
                    const parts = [];
                    // check input
                  Severity: Major
                  Found in src/utils/array.js - About 2 hrs to fix

                    Function getViewFromDOMVideo has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export function getViewFromDOMVideo(
                      video, onloaditem, onload, onprogress, onloadend,
                      origin, dataIndex) {
                      // video size
                      const width = video.videoWidth;
                    Severity: Major
                    Found in src/image/domReader.js - About 2 hrs to fix

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

                        '7FE0': {
                          '0000': ['UL', '1', 'GenericGroupLength'],
                          '0001': ['OV', '1', 'ExtendedOffsetTable'],
                          '0002': ['OV', '1', 'ExtendedOffsetTableLengths'],
                          '0008': ['OF', '1', 'FloatPixelData'],
                      Severity: Major
                      Found in src/dicom/dictionary.js and 1 other location - About 2 hrs to fix
                      src/dicom/dictionary.js on lines 3078..3088

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

                      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

                        '0064': {
                          '0000': ['UL', '1', 'GenericGroupLength'],
                          '0002': ['SQ', '1', 'DeformableRegistrationSequence'],
                          '0003': ['UI', '1', 'SourceFrameOfReferenceUID'],
                          '0005': ['SQ', '1', 'DeformableRegistrationGridSequence'],
                      Severity: Major
                      Found in src/dicom/dictionary.js and 1 other location - About 2 hrs to fix
                      src/dicom/dictionary.js on lines 5216..5226

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

                      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 HLContextLabel = new Uint8Array([
                            0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8,
                            8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3,
                            4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8
                          ]);
                      Severity: Major
                      Found in decoders/pdfjs/jpx.js and 1 other location - About 2 hrs to fix
                      decoders/pdfjs/jpx.js on lines 1660..1664

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

                      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 HHContextLabel = new Uint8Array([
                            0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5,
                            5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8,
                            8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8
                          ]);
                      Severity: Major
                      Found in decoders/pdfjs/jpx.js and 1 other location - About 2 hrs to fix
                      decoders/pdfjs/jpx.js on lines 1655..1659

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

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

                      jpeg.lossless.Decoder.prototype.getn = function (PRED, n, temp, index) {
                          /*jslint bitwise: true */
                      
                          var result, one, n_one, mask, input;
                          one = 1;
                      Severity: Major
                      Found in decoders/rii-mango/lossless.js - About 2 hrs to fix

                        Function decodeACSuccessive has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function decodeACSuccessive(component, offset) {
                              var k = spectralStart;
                              var e = spectralEnd;
                              var r = 0;
                              var s;
                        Severity: Major
                        Found in decoders/pdfjs/jpg.js - About 2 hrs to fix

                          Function parseMultipart has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function parseMultipart(arr) {
                            const u8Array = new Uint8Array(arr);
                          
                            const parts = [];
                            // check input
                          Severity: Minor
                          Found in src/utils/array.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

                          Severity
                          Category
                          Status
                          Source
                          Language