Showing 377 of 529 total issues

Function createMeshCanvasClosure has 146 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var createMeshCanvas = (function createMeshCanvasClosure() {
  function drawTriangle(data, context, p1, p2, p3, c1, c2, c3) {
    // Very basic Gouraud-shaded triangle rasterization algorithm.
    var coords = context.coords, colors = context.colors;
    var bytes = data.data, rowSize = data.width * 4;
Severity: Major
Found in public/mozilla-pdf/core/pdf.js - About 5 hrs to fix

    Function GrabToPanClosure has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    var GrabToPan = (function GrabToPanClosure() {
      /**
       * Construct a GrabToPan instance for a given HTML element.
       * @param options.element {Element}
       * @param options.ignoreTarget {function} optional. See `ignoreTarget(node)`
    Severity: Minor
    Found in public/mozilla-pdf/web/viewer.js - About 5 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 pageviewDraw has 138 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      this.draw = function pageviewDraw(callback) {
        var pdfPage = this.pdfPage;
    
        if (this.pagePdfPromise) {
          return;
    Severity: Major
    Found in public/mozilla-pdf/web/viewer.js - About 5 hrs to fix

      Function pdfViewSetHash has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

        setHash: function pdfViewSetHash(hash) {
          if (!hash) {
            return;
          }
      
      
      Severity: Minor
      Found in public/mozilla-pdf/web/viewer.js - About 5 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 FontInspectorClosure has 128 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var FontInspector = (function FontInspectorClosure() {
        var fonts;
        var active = false;
        var fontAttribute = 'data-font-name';
        function removeSelection() {
      Severity: Major
      Found in public/mozilla-pdf/web/debugger.js - About 5 hrs to fix

        Function compileType3Glyph has 127 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function compileType3Glyph(imgData) {
          var POINT_TO_PROCESS_LIMIT = 1000;
        
          var width = imgData.width, height = imgData.height;
          var i, j, j0, width1 = width + 1;
        Severity: Major
        Found in public/mozilla-pdf/core/pdf.js - About 5 hrs to fix

          Function TextAnnotationClosure has 126 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var TextAnnotation = (function TextAnnotationClosure() {
            function TextAnnotation(params) {
              InteractiveAnnotation.call(this, params);
          
              if (params.data) {
          Severity: Major
          Found in public/mozilla-pdf/core/pdf.js - About 5 hrs to fix

            File compatibility.js has 374 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: Minor
            Found in public/mozilla-pdf/web/compatibility.js - About 5 hrs to fix

              Function GrabToPanClosure has 122 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              var GrabToPan = (function GrabToPanClosure() {
                /**
                 * Construct a GrabToPan instance for a given HTML element.
                 * @param options.element {Element}
                 * @param options.ignoreTarget {function} optional. See `ignoreTarget(node)`
              Severity: Major
              Found in public/mozilla-pdf/web/viewer.js - About 4 hrs to fix

                Function PDFBugClosure has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
                Open

                var PDFBug = (function PDFBugClosure() {
                  var panelWidth = 300;
                  var buttons = [];
                  var activePanel = null;
                
                
                Severity: Minor
                Found in public/mozilla-pdf/web/debugger.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 vocabulary has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                window.App.vocabulary = function (config) {
                  
                  // This includes support for filterbar and slider on 
                  // all 'vocabulary' pages (contexts and set/contexts).
                  
                Severity: Major
                Found in app/assets/javascripts/vocabulary.js - About 4 hrs to fix

                  Function setupAnnotations has 109 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function setupAnnotations(pageDiv, pdfPage, viewport) {
                  
                      function bindLink(link, dest) {
                        link.href = PDFView.getDestinationHash(dest);
                        link.onclick = function pageViewSetupLinksOnclick() {
                  Severity: Major
                  Found in public/mozilla-pdf/web/viewer.js - About 4 hrs to fix

                    Method included has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def self.included(base)
                          base.class_eval do 
                    
                            # to build joins over to meta_terms from a media resource
                            has_many :meta_data_meta_terms, 
                    Severity: Major
                    Found in app/models/media_resource_modules/meta_data.rb - About 4 hrs to fix

                      Function drawFigures has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function drawFigures(width, height, backgroundColor, figures, context) {
                          if (!figuresCache) {
                            initFiguresGL();
                          }
                          var cache = figuresCache, canvas = cache.canvas, gl = cache.gl;
                      Severity: Major
                      Found in public/mozilla-pdf/core/pdf.js - About 4 hrs to fix

                        Function TilingPatternClosure has 107 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        var TilingPattern = (function TilingPatternClosure() {
                          var PaintType = {
                            COLORED: 1,
                            UNCOLORED: 2
                          };
                        Severity: Major
                        Found in public/mozilla-pdf/core/pdf.js - About 4 hrs to fix

                          Function pdfHistoryPush has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                          Open

                            push: function pdfHistoryPush(params, isInitialBookmark) {
                              if (!(this.initialized && this.historyUnlocked)) {
                                return;
                              }
                              if (params.dest && !params.hash) {
                          Severity: Minor
                          Found in public/mozilla-pdf/web/viewer.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

                          Method filter has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def filter(current_user, filter_opts)
                                  filter_opts = filter_opts.delete_if {|k,v| v.blank?}.deep_symbolize_keys
                                  raise "invalid option" unless filter_opts.is_a?(Hash) 
                          
                                  ############################################################
                          Severity: Minor
                          Found in app/models/media_resource_modules/filter.rb - 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

                          Method hash_for_media_resource has 106 lines of code (exceeds 25 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: Major
                          Found in app/helpers/json/media_resource_helper.rb - About 4 hrs to fix

                            Function mozPrintCallbackPolyfillClosure has 104 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            (function mozPrintCallbackPolyfillClosure() {
                              if ('mozPrintCallback' in document.createElement('canvas')) {
                                return;
                              }
                              // Cause positive result on feature-detection:
                            Severity: Major
                            Found in public/mozilla-pdf/web/viewer.js - About 4 hrs to fix

                              Function CanvasGraphics_showText has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  showText: function CanvasGraphics_showText(glyphs) {
                                    var current = this.current;
                                    var font = current.font;
                                    if (font.isType3Font) {
                                      return this.showType3Text(glyphs);
                              Severity: Major
                              Found in public/mozilla-pdf/core/pdf.js - About 4 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language