Showing 377 of 529 total issues

Function pdfjsWrapper has a Cognitive Complexity of 1973 (exceeds 5 allowed). Consider refactoring.
Open

(function pdfjsWrapper() {
  // Use strict in our context only - users might not want it
  'use strict';

/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
Severity: Minor
Found in public/mozilla-pdf/core/pdf.js - About 1 mo 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 pdfjsWrapper has 5257 lines of code (exceeds 25 allowed). Consider refactoring.
Open

(function pdfjsWrapper() {
  // Use strict in our context only - users might not want it
  'use strict';

/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
Severity: Major
Found in public/mozilla-pdf/core/pdf.js - About 3 wks to fix

    File pdf.js has 5275 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 public/mozilla-pdf/core/pdf.js - About 2 wks to fix

      File viewer.js has 4599 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 public/mozilla-pdf/web/viewer.js - About 1 wk to fix

        Function webL10n has a Cognitive Complexity of 367 (exceeds 5 allowed). Consider refactoring.
        Open

        document.webL10n = (function(window, document, undefined) {
          var gL10nData = {};
          var gTextData = '';
          var gTextProp = 'textContent';
          var gLanguage = '';
        Severity: Minor
        Found in public/mozilla-pdf/web/l10n.js - About 1 wk to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function CanvasGraphicsClosure has 1391 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        var CanvasGraphics = (function CanvasGraphicsClosure() {
          // Defines the time the executeOperatorList is going to be executing
          // before it stops and shedules a continue of execution.
          var EXECUTION_TIME = 15;
        
        
        Severity: Major
        Found in public/mozilla-pdf/core/pdf.js - About 6 days to fix

          File en-US.js has 2332 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          if (window.i18n == undefined) window.i18n = {};
          // Generated by CoffeeScript 1.3.3
          (function() {
          
            i18n.date = {
          Severity: Major
          Found in app/assets/javascripts/i18n/locale/en-US.js - About 6 days to fix

            Function webL10n has 776 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            document.webL10n = (function(window, document, undefined) {
              var gL10nData = {};
              var gTextData = '';
              var gTextProp = 'textContent';
              var gLanguage = '';
            Severity: Major
            Found in public/mozilla-pdf/web/l10n.js - About 3 days to fix

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

              if (window.i18n == undefined) window.i18n = {};
              // Generated by CoffeeScript 1.3.3
              (function() {
              
                i18n.date = {
              Severity: Major
              Found in app/assets/javascripts/i18n/locale/de-CH.js - About 3 days to fix

                File en-GB.js has 1174 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                if (window.i18n == undefined) window.i18n = {};
                // Generated by CoffeeScript 1.3.3
                (function() {
                
                  i18n.date = {
                Severity: Major
                Found in app/assets/javascripts/i18n/locale/en-GB.js - About 3 days to fix

                  Method hash_for_media_resource has a Cognitive Complexity of 135 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def hash_for_media_resource(media_resource, with = nil)
                        h = {
                          id: media_resource.id,
                          created_at: media_resource.created_at.iso8601,
                          updated_at: media_resource.updated_at.iso8601,
                  Severity: Minor
                  Found in app/helpers/json/media_resource_helper.rb - About 2 days 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 pageView has 544 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  var PageView = function pageView(container, id, scale,
                                                   navigateTo, defaultViewport) {
                    this.id = id;
                  
                    this.rotation = 0;
                  Severity: Major
                  Found in public/mozilla-pdf/web/viewer.js - About 2 days to fix

                    Function pageView has a Cognitive Complexity of 133 (exceeds 5 allowed). Consider refactoring.
                    Open

                    var PageView = function pageView(container, id, scale,
                                                     navigateTo, defaultViewport) {
                      this.id = id;
                    
                      this.rotation = 0;
                    Severity: Minor
                    Found in public/mozilla-pdf/web/viewer.js - About 2 days to fix

                    Cognitive Complexity

                    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                    A method's cognitive complexity is based on a few simple rules:

                    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                    • Code is considered more complex for each "break in the linear flow of the code"
                    • Code is considered more complex when "flow breaking structures are nested"

                    Further reading

                    File gsw-CH.js has 875 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    if (window.i18n == undefined) window.i18n = {};
                    // Generated by CoffeeScript 1.3.3
                    (function() {
                    
                      i18n.date = {
                    Severity: Major
                    Found in app/assets/javascripts/i18n/locale/gsw-CH.js - About 2 days to fix

                      Function textLayerBuilder has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
                      Open

                      var TextLayerBuilder = function textLayerBuilder(options) {
                        var textLayerFrag = document.createDocumentFragment();
                      
                        this.textLayerDiv = options.textLayerDiv;
                        this.layoutDone = false;
                      Severity: Minor
                      Found in public/mozilla-pdf/web/viewer.js - About 2 days 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 getPluralRules has 385 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function getPluralRules(lang) {
                          var locales2rules = {
                            'af': 3,
                            'ak': 4,
                            'am': 4,
                      Severity: Major
                      Found in public/mozilla-pdf/web/l10n.js - About 1 day to fix

                        File l10n.js has 779 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        /**
                         * Copyright (c) 2011-2013 Fabien Cazenave, Mozilla.
                         *
                         * Permission is hereby granted, free of charge, to any person obtaining a copy
                         * of this software and associated documentation files (the "Software"), to
                        Severity: Major
                        Found in public/mozilla-pdf/web/l10n.js - About 1 day to fix

                          Function WorkerTransportClosure has 356 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          var WorkerTransport = (function WorkerTransportClosure() {
                            function WorkerTransport(workerInitializedCapability, workerReadyCapability,
                                                     pdfDataRangeTransport, progressCallback) {
                              this.pdfDataRangeTransport = pdfDataRangeTransport;
                          
                          
                          Severity: Major
                          Found in public/mozilla-pdf/core/pdf.js - About 1 day to fix

                            Function WebGLUtilsClosure has 347 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            var WebGLUtils = (function WebGLUtilsClosure() {
                              function loadShader(gl, code, shaderType) {
                                var shader = gl.createShader(shaderType);
                                gl.shaderSource(shader, code);
                                gl.compileShader(shader);
                            Severity: Major
                            Found in public/mozilla-pdf/core/pdf.js - About 1 day to fix

                              Function keydown has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
                              Open

                              window.addEventListener('keydown', function keydown(evt) {
                                if (OverlayManager.active) {
                                  return;
                                }
                              
                              
                              Severity: Minor
                              Found in public/mozilla-pdf/web/viewer.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

                              Severity
                              Category
                              Status
                              Source
                              Language