ivmartel/dwv

View on GitHub

Showing 218 of 386 total issues

Function JpxImageClosure has a Cognitive Complexity of 1144 (exceeds 5 allowed). Consider refactoring.
Open

var JpxImage = (function JpxImageClosure() {
  // Table E.1
  var SubbandsGainLog2 = {
    'LL': 0,
    'LH': 1,
Severity: Minor
Found in decoders/pdfjs/jpx.js - About 3 wks 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

File dictionary.js has 5458 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/* eslint-disable @stylistic/js/quote-props */
/* eslint @stylistic/js/max-len:0 */

/**
 * DICOM tag dictionary 2022a.
Severity: Major
Found in src/dicom/dictionary.js - About 2 wks to fix

    Function JpxImageClosure has 1992 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var JpxImage = (function JpxImageClosure() {
      // Table E.1
      var SubbandsGainLog2 = {
        'LL': 0,
        'LH': 1,
    Severity: Major
    Found in decoders/pdfjs/jpx.js - About 1 wk to fix

      Function jpegImage has a Cognitive Complexity of 480 (exceeds 5 allowed). Consider refactoring.
      Open

      var JpegImage = (function jpegImage() {
        var dctZigZag = new Uint8Array([
           0,
           1,  8,
          16,  9,  2,
      Severity: Minor
      Found in decoders/pdfjs/jpg.js - About 1 wk 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

      File jpx.js has 1995 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
      /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
      /* Copyright 2012 Mozilla Foundation
       *
       * Licensed under the Apache License, Version 2.0 (the "License");
      Severity: Major
      Found in decoders/pdfjs/jpx.js - About 5 days to fix

        Function jpegImage has 902 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var JpegImage = (function jpegImage() {
          var dctZigZag = new Uint8Array([
             0,
             1,  8,
            16,  9,  2,
        Severity: Major
        Found in decoders/pdfjs/jpg.js - About 4 days to fix

          File util.js has 1218 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
          /* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
          /* Copyright 2012 Mozilla Foundation
           *
           * Licensed under the Apache License, Version 2.0 (the "License");
          Severity: Major
          Found in decoders/pdfjs/util.js - About 3 days to fix

            Function 3 has 572 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            },{}],3:[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 2 days to fix

              File lossless.js has 977 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jpeg = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[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 2 days to fix

                File jpg.js has 905 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                
                /* Copyright 2014 Mozilla Foundation
                 *
                 * Licensed under the Apache License, Version 2.0 (the 'License');
                 * you may not use this file except in compliance with the License.
                Severity: Major
                Found in decoders/pdfjs/jpg.js - About 2 days to fix

                  Function PromiseClosure has a Cognitive Complexity of 92 (exceeds 5 allowed). Consider refactoring.
                  Open

                  (function PromiseClosure() {
                    if (globalScope.Promise) {
                      // Promises existing in the DOM/Worker, checking presence of all/resolve
                      if (typeof globalScope.Promise.all !== 'function') {
                        globalScope.Promise.all = function (iterable) {
                  Severity: Minor
                  Found in decoders/pdfjs/util.js - About 1 day 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

                  File dicomElementsWrapper.js has 686 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import {
                    DicomParser,
                    getTransferSyntaxName
                  } from './dicomParser';
                  import {
                  Severity: Major
                  Found in src/dicom/dicomElementsWrapper.js - About 1 day to fix

                    Function BitModelClosure has 299 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      var BitModel = (function BitModelClosure() {
                        var UNIFORM_CONTEXT = 17;
                        var RUNLENGTH_CONTEXT = 18;
                        // Table D-1
                        // The index is binary presentation: 0dddvvhh, ddd - sum of Di (0..4),
                    Severity: Major
                    Found in decoders/pdfjs/jpx.js - About 1 day to fix

                      Function mergeObjects has a Cognitive Complexity of 66 (exceeds 5 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: Minor
                      Found in src/utils/operator.js - About 1 day 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 JpxImage_parseCodestream has 253 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          parseCodestream: function JpxImage_parseCodestream(data, start, end) {
                            var context = {};
                            try {
                              var doNotRecover = false;
                              var position = start;
                      Severity: Major
                      Found in decoders/pdfjs/jpx.js - About 1 day to fix

                        Function PromiseClosure has 248 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        (function PromiseClosure() {
                          if (globalScope.Promise) {
                            // Promises existing in the DOM/Worker, checking presence of all/resolve
                            if (typeof globalScope.Promise.all !== 'function') {
                              globalScope.Promise.all = function (iterable) {
                        Severity: Major
                        Found in decoders/pdfjs/util.js - About 1 day to fix

                          Function decodeScan has 243 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            function decodeScan(data, offset, frame, components, resetInterval,
                                                spectralStart, spectralEnd, successivePrev, successive) {
                              var mcusPerLine = frame.mcusPerLine;
                              var progressive = frame.progressive;
                          
                          
                          Severity: Major
                          Found in decoders/pdfjs/jpg.js - About 1 day to fix

                            Function parse has 237 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                parse: function parse(data) {
                            
                                  function readUint16() {
                                    var value = (data[offset] << 8) | data[offset + 1];
                                    offset += 2;
                            Severity: Major
                            Found in decoders/pdfjs/jpg.js - About 1 day to fix

                              Function getElementAsString has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
                              Open

                              function getElementAsString(tag, dicomElement, prefix) {
                                // default prefix
                                prefix = prefix || '';
                              
                                // get tag anme from dictionary
                              Severity: Minor
                              Found in src/dicom/dicomElementsWrapper.js - About 1 day 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 decode has 213 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              jpeg.lossless.Decoder.prototype.decode = function (buffer, offset, length, numBytes) {
                                  /*jslint bitwise: true */
                              
                                  var current, scanNum = 0, pred = [], i, compN, temp = [], index = [], mcuNum;
                              
                              
                              Severity: Major
                              Found in decoders/rii-mango/lossless.js - About 1 day to fix
                                Severity
                                Category
                                Status
                                Source
                                Language