ivmartel/dwv

View on GitHub
decoders/pdfjs/util.js

Summary

Maintainability
F
2 wks
Test Coverage

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

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

          function MessageHandler(name, comObj) {
            this.name = name;
            this.comObj = comObj;
            this.callbackIndex = 1;
            this.postMessageTransfers = true;
          Severity: Minor
          Found in decoders/pdfjs/util.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

          Function StatTimerClosure has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          var StatTimer = (function StatTimerClosure() {
            function rpad(str, pad, length) {
              while (str.length < length) {
                str += pad;
              }
          Severity: Minor
          Found in decoders/pdfjs/util.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

          Function MessageHandler has 55 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function MessageHandler(name, comObj) {
            this.name = name;
            this.comObj = comObj;
            this.callbackIndex = 1;
            this.postMessageTransfers = true;
          Severity: Major
          Found in decoders/pdfjs/util.js - About 2 hrs to fix

            Function StatTimerClosure has 55 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var StatTimer = (function StatTimerClosure() {
              function rpad(str, pad, length) {
                while (str.length < length) {
                  str += pad;
                }
            Severity: Major
            Found in decoders/pdfjs/util.js - About 2 hrs to fix

              Function PageViewport has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
                  this.viewBox = viewBox;
                  this.scale = scale;
                  this.rotation = rotation;
                  this.offsetX = offsetX;
              Severity: Major
              Found in decoders/pdfjs/util.js - About 2 hrs to fix

                Function PageViewportClosure has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                var PageViewport = PDFJS.PageViewport = (function PageViewportClosure() {
                  /**
                   * @constructor
                   * @private
                   * @param viewBox {Array} xMin, yMin, xMax and yMax coordinates.
                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 Promise_all has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  Promise.all = function Promise_all(promises) {
                    var resolveAll, rejectAll;
                    var deferred = new Promise(function (resolve, reject) {
                      resolveAll = resolve;
                      rejectAll = reject;
                Severity: Minor
                Found in decoders/pdfjs/util.js - About 1 hr to fix

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

                    comObj.onmessage = function messageHandlerComObjOnMessage(event) {
                      var data = event.data;
                      if (data.isReply) {
                        var callbackId = data.callbackId;
                        if (data.callbackId in callbacksCapabilities) {
                  Severity: Minor
                  Found in decoders/pdfjs/util.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 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 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 stringToPDFString has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        function stringToPDFString(str) {
                          var i, n = str.length, strBuf = [];
                          if (str[0] === '\xFE' && str[1] === '\xFF') {
                            // UTF16BE BOM
                            for (i = 2; i < n; i += 2) {
                        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 createObjectURLClosure has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        PDFJS.createObjectURL = (function createObjectURLClosure() {
                          // Blob/createObjectURL is not available, falling back to data schema.
                          var digits =
                            'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
                        
                        
                        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 PageViewport has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                          function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
                        Severity: Minor
                        Found in decoders/pdfjs/util.js - About 45 mins to fix

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

                              } else {
                                offsetCanvasX = Math.abs(centerX - viewBox[0]) * scale + offsetX;
                                offsetCanvasY = Math.abs(centerY - viewBox[1]) * scale + offsetY;
                                width = Math.abs(viewBox[2] - viewBox[0]) * scale;
                                height = Math.abs(viewBox[3] - viewBox[1]) * scale;
                          Severity: Major
                          Found in decoders/pdfjs/util.js and 1 other location - About 4 hrs to fix
                          decoders/pdfjs/util.js on lines 839..844

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

                          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 (rotateA === 0) {
                                offsetCanvasX = Math.abs(centerY - viewBox[1]) * scale + offsetX;
                                offsetCanvasY = Math.abs(centerX - viewBox[0]) * scale + offsetY;
                                width = Math.abs(viewBox[3] - viewBox[1]) * scale;
                                height = Math.abs(viewBox[2] - viewBox[0]) * scale;
                          Severity: Major
                          Found in decoders/pdfjs/util.js and 1 other location - About 4 hrs to fix
                          decoders/pdfjs/util.js on lines 844..849

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

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

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

                          var NotImplementedException = (function NotImplementedExceptionClosure() {
                            function NotImplementedException(msg) {
                              this.message = msg;
                            }
                          
                          
                          Severity: Major
                          Found in decoders/pdfjs/util.js and 1 other location - About 2 hrs to fix
                          decoders/pdfjs/util.js on lines 430..440

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

                          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 XRefParseException = (function XRefParseExceptionClosure() {
                            function XRefParseException(msg) {
                              this.message = msg;
                            }
                          
                          
                          Severity: Major
                          Found in decoders/pdfjs/util.js and 1 other location - About 2 hrs to fix
                          decoders/pdfjs/util.js on lines 404..414

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

                          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 MissingPDFException = (function MissingPDFExceptionClosure() {
                            function MissingPDFException(msg) {
                              this.name = 'MissingPDFException';
                              this.message = msg;
                            }
                          Severity: Major
                          Found in decoders/pdfjs/util.js and 1 other location - About 2 hrs to fix
                          decoders/pdfjs/util.js on lines 363..373

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

                          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 InvalidPDFException = (function InvalidPDFExceptionClosure() {
                            function InvalidPDFException(msg) {
                              this.name = 'InvalidPDFException';
                              this.message = msg;
                            }
                          Severity: Major
                          Found in decoders/pdfjs/util.js and 1 other location - About 2 hrs to fix
                          decoders/pdfjs/util.js on lines 376..386

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

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

                              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

                          var StreamType = {
                            UNKNOWN: 0,
                            FLATE: 1,
                            LZW: 2,
                            DCT: 3,
                          Severity: Major
                          Found in decoders/pdfjs/util.js and 1 other location - About 1 hr to fix
                          decoders/pdfjs/util.js on lines 28..39

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

                          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 TextRenderingMode = {
                            FILL: 0,
                            STROKE: 1,
                            FILL_STROKE: 2,
                            INVISIBLE: 3,
                          Severity: Major
                          Found in decoders/pdfjs/util.js and 1 other location - About 1 hr to fix
                          decoders/pdfjs/util.js on lines 53..64

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

                          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 4 locations. Consider refactoring.
                          Open

                                m[3] * v[0] + m[4] * v[1] + m[5] * v[2],
                          Severity: Major
                          Found in decoders/pdfjs/util.js and 3 other locations - About 30 mins to fix
                          decoders/pdfjs/util.js on lines 610..610
                          decoders/pdfjs/util.js on lines 646..646
                          decoders/pdfjs/util.js on lines 648..648

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

                          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 4 locations. Consider refactoring.
                          Open

                              var xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
                          Severity: Major
                          Found in decoders/pdfjs/util.js and 3 other locations - About 30 mins to fix
                          decoders/pdfjs/util.js on lines 646..646
                          decoders/pdfjs/util.js on lines 647..647
                          decoders/pdfjs/util.js on lines 648..648

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

                          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 4 locations. Consider refactoring.
                          Open

                                m[6] * v[0] + m[7] * v[1] + m[8] * v[2]
                          Severity: Major
                          Found in decoders/pdfjs/util.js and 3 other locations - About 30 mins to fix
                          decoders/pdfjs/util.js on lines 610..610
                          decoders/pdfjs/util.js on lines 646..646
                          decoders/pdfjs/util.js on lines 647..647

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

                          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 4 locations. Consider refactoring.
                          Open

                                m[0] * v[0] + m[1] * v[1] + m[2] * v[2],
                          Severity: Major
                          Found in decoders/pdfjs/util.js and 3 other locations - About 30 mins to fix
                          decoders/pdfjs/util.js on lines 610..610
                          decoders/pdfjs/util.js on lines 647..647
                          decoders/pdfjs/util.js on lines 648..648

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

                          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

                          There are no issues that match your filters.

                          Category
                          Status