ivmartel/dwv

View on GitHub

Showing 386 of 386 total issues

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

    var numprecinctshigh = (resolution.try1 > resolution.try0 ?
      Math.ceil(resolution.try1 / precinctHeight) -
      Math.floor(resolution.try0 / precinctHeight) : 0);
Severity: Major
Found in decoders/pdfjs/jpx.js and 1 other location - About 1 hr to fix
decoders/pdfjs/jpx.js on lines 490..492

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

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 numprecinctswide = (resolution.trx1 > resolution.trx0 ?
      Math.ceil(resolution.trx1 / precinctWidth) -
      Math.floor(resolution.trx0 / precinctWidth) : 0);
Severity: Major
Found in decoders/pdfjs/jpx.js and 1 other location - About 1 hr to fix
decoders/pdfjs/jpx.js on lines 493..495

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

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

    runHandlers: function runHandlers() {
      var RUN_TIMEOUT = 1; // ms
      var timeoutAt = Date.now() + RUN_TIMEOUT;
      while (this.handlers.length > 0) {
        var handler = this.handlers.shift();
Severity: Minor
Found in decoders/pdfjs/util.js - About 1 hr to fix

    Function JpxImage_nextPacket has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        this.nextPacket = function JpxImage_nextPacket() {
          // Section B.12.1.5 Component-position-resolution-layer
          for (; c < componentsCount; ++c) {
            var component = tile.components[c];
            var precinctsIterationSizes = precinctsSizes.components[c];
    Severity: Minor
    Found in decoders/pdfjs/jpx.js - About 1 hr to fix

      Function decodeManifest has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function decodeManifest(manifest, nslices) {
        const result = [];
        // wado url
        const wadoElement = manifest.getElementsByTagName('wado_query');
        const wadoURL = wadoElement[0].getAttribute('wadoURL');
      Severity: Minor
      Found in src/utils/uri.js - About 1 hr to fix

        Function JpxImage_nextPacket has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            this.nextPacket = function JpxImage_nextPacket() {
              // Section B.12.1.4 Position-component-resolution-layer
              for (; py < precinctsIterationSizes.maxNumHigh; py++) {
                for (; px < precinctsIterationSizes.maxNumWide; px++) {
                  for (; c < componentsCount; c++) {
        Severity: Minor
        Found in decoders/pdfjs/jpx.js - About 1 hr to fix

          Function BitModel_setNeighborsSignificance has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function BitModel_setNeighborsSignificance(row, column, index) {
                  var neighborsSignificance = this.neighborsSignificance;
                  var width = this.width, height = this.height;
                  var left = (column > 0);
                  var right = (column + 1 < width);
          Severity: Minor
          Found in decoders/pdfjs/jpx.js - About 1 hr to fix

            Function getScoordFromShape has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            export function getScoordFromShape(shape) {
              const scoord = new SpatialCoordinate();
            
              if (shape instanceof Point2D) {
                scoord.graphicData = [
            Severity: Minor
            Found in src/dicom/dicomSpatialCoordinate.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 splitKeyValueString has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            export function splitKeyValueString(inputStr) {
              // result
              const result = {};
              // check input string
              if (inputStr) {
            Severity: Minor
            Found in src/utils/string.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 getVectorStringLPS has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            function getVectorStringLPS(vector) {
              let abs = new Vector3D(
                Math.abs(vector.getX()),
                Math.abs(vector.getY()),
                Math.abs(vector.getZ())
            Severity: Minor
            Found in src/math/orientation.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 combineUrl has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
            Open

            function combineUrl(baseUrl, url) {
              if (!url) {
                return baseUrl;
              }
              if (/^[a-z][a-z0-9+\-.]*:/i.test(url)) {
            Severity: Minor
            Found in decoders/pdfjs/util.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 getVectorStringLPS has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getVectorStringLPS(vector) {
              let abs = new Vector3D(
                Math.abs(vector.getX()),
                Math.abs(vector.getY()),
                Math.abs(vector.getZ())
            Severity: Minor
            Found in src/math/orientation.js - About 1 hr to fix

              Function buildHuffTable has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              jpeg.lossless.HuffmanTable.prototype.buildHuffTable = function(tab, L, V) {
                  /*jslint bitwise: true */
              
                  var currentTable, temp, k, i, j, n;
                  temp = 256;
              Severity: Minor
              Found in decoders/rii-mango/lossless.js - About 1 hr to fix

                Function getViewFromDOMImage has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export function getViewFromDOMImage(domImage, origin, index) {
                  // image size
                  const width = domImage.width;
                  const height = domImage.height;
                
                
                Severity: Minor
                Found in src/image/domReader.js - About 1 hr to fix

                  Identical blocks of code found in 4 locations. Consider refactoring.
                  Open

                          if (input === 0xFF) {
                              this.marker = this.stream.get8();
                              if (this.marker !== 0) {
                                  this.markerIndex = 9;
                              }
                  Severity: Major
                  Found in decoders/rii-mango/lossless.js and 3 other locations - About 1 hr to fix
                  decoders/rii-mango/lossless.js on lines 680..685
                  decoders/rii-mango/lossless.js on lines 703..708
                  decoders/rii-mango/lossless.js on lines 785..790

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

                  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 (typeof dataElements[TagKeys.CodingSchemeDesignator] !== 'undefined') {
                        code.schemeDesignator =
                          dataElements[TagKeys.CodingSchemeDesignator].value[0];
                      } else {
                        throw new Error(
                  Severity: Major
                  Found in src/dicom/dicomCode.js and 1 other location - About 1 hr to fix
                  src/dicom/dicomCode.js on lines 104..109

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

                  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

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

                    if (isRescaled) {
                      dataAccessor = function (offset) {
                        return image.getRescaledValueAtOffset(offset);
                      };
                    } else {
                  Severity: Major
                  Found in src/image/iterator.js and 2 other locations - About 1 hr to fix
                  src/image/iterator.js on lines 402..410
                  src/image/iterator.js on lines 520..528

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

                  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

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

                    if (isRescaled) {
                      dataAccessor = function (offset) {
                        return image.getRescaledValueAtOffset(offset);
                      };
                    } else {
                  Severity: Major
                  Found in src/image/iterator.js and 2 other locations - About 1 hr to fix
                  src/image/iterator.js on lines 520..528
                  src/image/iterator.js on lines 578..586

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

                  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

                  Identical blocks of code found in 4 locations. Consider refactoring.
                  Open

                          if (input === 0xFF) {
                              this.marker = this.stream.get8();
                              if (this.marker !== 0) {
                                  this.markerIndex = 9;
                              }
                  Severity: Major
                  Found in decoders/rii-mango/lossless.js and 3 other locations - About 1 hr to fix
                  decoders/rii-mango/lossless.js on lines 703..708
                  decoders/rii-mango/lossless.js on lines 766..771
                  decoders/rii-mango/lossless.js on lines 785..790

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

                  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

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

                    if (isRescaled) {
                      dataAccessor = function (offset) {
                        return image.getRescaledValueAtOffset(offset);
                      };
                    } else {
                  Severity: Major
                  Found in src/image/iterator.js and 2 other locations - About 1 hr to fix
                  src/image/iterator.js on lines 402..410
                  src/image/iterator.js on lines 578..586

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

                  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