ivmartel/dwv

View on GitHub

Showing 209 of 401 total issues

File iterator.js has 462 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {Index} from '../math/index';
import {Point2D} from '../math/point';

// doc imports
/* eslint-disable no-unused-vars */
Severity: Minor
Found in src/image/iterator.js - About 7 hrs to fix

    Function parseTilePackets has 176 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function parseTilePackets(context, data, offset, dataLength) {
        var position = 0;
        var buffer, bufferSize = 0, skipNextBit = false;
        function readBits(count) {
          while (bufferSize < count) {
    Severity: Major
    Found in decoders/pdfjs/jpx.js - About 7 hrs to fix

      Function decode has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
      Open

      dwvdecoder.RleDecoder.prototype.decode = function (buffer,
        bitsAllocated, isSigned, sliceSize, samplesPerPixel, planarConfiguration) {
      
        // bytes per element
        var bpe = bitsAllocated / 8;
      Severity: Minor
      Found in decoders/dwv/rle.js - About 6 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 getElementAsString has 159 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function getElementAsString(tag, dicomElement, prefix) {
        // default prefix
        prefix = prefix || '';
      
        // get tag anme from dictionary
      Severity: Major
      Found in src/dicom/dicomElementsWrapper.js - About 6 hrs to fix

        Function UtilClosure has 150 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var Util = PDFJS.Util = (function UtilClosure() {
          function Util() {}
        
          var rgbBuf = ['rgb(', 0, ',', 0, ',', 0, ')'];
        
        
        Severity: Major
        Found in decoders/pdfjs/util.js - About 6 hrs to fix

          Function ArithmeticDecoderClosure has a Cognitive Complexity of 39 (exceeds 5 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: Minor
          Found in decoders/pdfjs/arithmetic_decoder.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 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 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 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 getDecayedDose has 139 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getDecayedDose(elements) {
              let warning = '';
              let warn;
            
              // SeriesDate (type1)
            Severity: Major
            Found in src/dicom/dicomElementsWrapper.js - About 5 hrs to fix

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

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

                  function getDecayedDose(elements) {
                    let warning = '';
                    let warn;
                  
                    // SeriesDate (type1)
                  Severity: Minor
                  Found in src/dicom/dicomElementsWrapper.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

                  Function mergeObjects has 102 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 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

                      Function buildPackets has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function buildPackets(context) {
                          var siz = context.SIZ;
                          var tileIndex = context.currentTile.index;
                          var tile = context.tiles[tileIndex];
                          var componentsCount = siz.Csiz;
                      Severity: Major
                      Found in decoders/pdfjs/jpx.js - About 3 hrs to fix

                        Function TransformClosure has 98 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          var Transform = (function TransformClosure() {
                            function Transform() {}
                        
                            Transform.prototype.calculate =
                              function transformCalculate(subbands, u0, v0) {
                        Severity: Major
                        Found in decoders/pdfjs/jpx.js - About 3 hrs to fix

                          Function create has 93 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            create(points, style, viewController) {
                              // physical shape
                              const line0 = new Line(points[0], points[1]);
                              // points stored the Konvajs way
                              const pointsArray = [];
                          Severity: Major
                          Found in src/tools/protractor.js - About 3 hrs to fix
                            Severity
                            Category
                            Status
                            Source
                            Language