ivmartel/dwv

View on GitHub

Showing 386 of 386 total issues

Function getRegionSliceIterator has 38 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function getRegionSliceIterator(
  image, index, isRescaled, min, max) {
  if (image.getNumberOfComponents() !== 1) {
    throw new Error('Unsupported number of components for region iterator: ' +
      image.getNumberOfComponents());
Severity: Minor
Found in src/image/iterator.js - About 1 hr to fix

    Function getFileListFromDicomDir has 38 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export function getFileListFromDicomDir(data) {
      // parse file
      const parser = new DicomParser();
      parser.parse(data);
      const elements = parser.getDicomElements();
    Severity: Minor
    Found in src/dicom/dicomElementsWrapper.js - About 1 hr to fix

      Function getDicomSegmentItem has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function getDicomSegmentItem(segment) {
        let algoType = segment.algorithmType;
        if (algoType === undefined) {
          algoType = 'MANUAL';
        }
      Severity: Minor
      Found in src/dicom/dicomSegment.js - About 1 hr to fix

        Function 10 has 37 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        },{"./data-stream.js":2,"./scan-component.js":8}],10:[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: Minor
        Found in decoders/rii-mango/lossless.js - About 1 hr to fix

          Function getVariableRegionSliceIterator has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          export function getVariableRegionSliceIterator(
            image, index, isRescaled, regions) {
            if (image.getNumberOfComponents() !== 1) {
              throw new Error('Unsupported number of components for region iterator: ' +
                image.getNumberOfComponents());
          Severity: Minor
          Found in src/image/iterator.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 getTouchesPositions has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          function getTouchesPositions(touches) {
            // get the touch offset from all its parents
            let offsetLeft = 0;
            let offsetTop = 0;
            if (touches.length !== 0 &&
          Severity: Minor
          Found in src/gui/generic.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 checkTag has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

          function checkTag(element, name, values) {
            let warning = '';
            if (typeof element === 'undefined') {
              warning += ' ' + name + ' is undefined,';
            } else if (element.value.length === 0) {
          Severity: Minor
          Found in src/dicom/dicomElementsWrapper.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 decodeRGB has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          jpeg.lossless.Decoder.prototype.decodeRGB = function (prev, temp, index) {
              /*jslint bitwise: true */
          
              var value, actab, dctab, qtab, ctrC, i, k, j;
          
          
          Severity: Minor
          Found in decoders/rii-mango/lossless.js - About 1 hr to fix

            Function read has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            jpeg.lossless.FrameHeader.prototype.read = function (data) {
                /*jslint bitwise: true */
            
                var count = 0, length, i, c, temp;
            
            
            Severity: Minor
            Found in decoders/rii-mango/lossless.js - About 1 hr to fix

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

                  if ((orderedY[0] === rect1[1] && orderedY[1] === rect2[1]) ||
                      (orderedY[0] === rect2[1] && orderedY[1] === rect1[1])) {
                    // Intersection must be between second and third points
                    result[1] = orderedY[1];
                    result[3] = orderedY[2];
              Severity: Major
              Found in decoders/pdfjs/util.js and 1 other location - About 1 hr to fix
              decoders/pdfjs/util.js on lines 710..717

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

              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

                  ImageOrientationPatient: [
                    orientation.get(0, 0),
                    orientation.get(1, 0),
                    orientation.get(2, 0),
                    orientation.get(0, 1),
              Severity: Major
              Found in src/dicom/dicomElementsWrapper.js and 1 other location - About 1 hr to fix
              src/math/orientation.js on lines 223..230

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

              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 ((orderedX[0] === rect1[0] && orderedX[1] === rect2[0]) ||
                      (orderedX[0] === rect2[0] && orderedX[1] === rect1[0])) {
                    // Intersection must be between second and third points
                    result[0] = orderedX[1];
                    result[2] = orderedX[2];
              Severity: Major
              Found in decoders/pdfjs/util.js and 1 other location - About 1 hr to fix
              decoders/pdfjs/util.js on lines 720..727

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

              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

                return [
                  matrix.get(0, 0),
                  matrix.get(1, 0),
                  matrix.get(2, 0),
                  matrix.get(0, 1),
              Severity: Major
              Found in src/math/orientation.js and 1 other location - About 1 hr to fix
              src/dicom/dicomElementsWrapper.js on lines 592..599

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

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

              export function getSuvFactor(elements) {
                let warning = '';
              
                // CorrectedImage (type2): must contain ATTN and DECY
                const corrImageTagStr = 'Corrected Image (00280051)';
              Severity: Minor
              Found in src/dicom/dicomElementsWrapper.js - About 1 hr to fix

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

                  function calculateTileGrids(context, components) {
                    var siz = context.SIZ;
                    // Section B.3 Division into tile and tile-components
                    var tile, tiles = [];
                    var numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
                Severity: Minor
                Found in decoders/pdfjs/jpx.js - About 1 hr to fix

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

                    function ResolutionLayerComponentPositionIterator(context) {
                      var siz = context.SIZ;
                      var tileIndex = context.currentTile.index;
                      var tile = context.tiles[tileIndex];
                      var layersCount = tile.codingStyleDefaultParameters.layersCount;
                  Severity: Minor
                  Found in decoders/pdfjs/jpx.js - About 1 hr to fix

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

                    export function buildMultipart(parts, boundary) {
                      const lineBreak = '\r\n';
                      // build headers and calculate size
                      let partsSize = 0;
                      const headers = [];
                    Severity: Minor
                    Found in src/utils/array.js - About 1 hr to fix

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

                      var Uint32ArrayView = (function Uint32ArrayViewClosure() {
                      
                        function Uint32ArrayView(buffer, length) {
                          this.buffer = buffer;
                          this.byteLength = buffer.length;
                      Severity: Minor
                      Found in decoders/pdfjs/util.js - About 1 hr to fix

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

                          function LayerResolutionComponentPositionIterator(context) {
                            var siz = context.SIZ;
                            var tileIndex = context.currentTile.index;
                            var tile = context.tiles[tileIndex];
                            var layersCount = tile.codingStyleDefaultParameters.layersCount;
                        Severity: Minor
                        Found in decoders/pdfjs/jpx.js - About 1 hr to fix

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

                                  function BitModel_runMagnitudeRefinementPass() {
                                  var decoder = this.decoder;
                                  var width = this.width, height = this.height;
                                  var coefficentsMagnitude = this.coefficentsMagnitude;
                                  var neighborsSignificance = this.neighborsSignificance;
                          Severity: Minor
                          Found in decoders/pdfjs/jpx.js - About 1 hr to fix
                            Severity
                            Category
                            Status
                            Source
                            Language