Showing 529 of 529 total issues

Method to_tms has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

  def to_tms(xml, io_interface)
    xml.snapshot do
      #old# meta_data.each do |meta_datum|
      meta_data.for_io_interface(io_interface).each do |meta_datum|
        key_map = meta_datum.meta_key.key_map_for(io_interface)
Severity: Minor
Found in app/models/media_entry.rb - About 7 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 StepperClosure has 183 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var Stepper = (function StepperClosure() {
  // Shorter way to create element and optionally set textContent.
  function c(tag, textContent) {
    var d = document.createElement(tag);
    if (textContent) {
Severity: Major
Found in public/mozilla-pdf/web/debugger.js - About 7 hrs to fix

    Method hash_for_filter has 171 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def hash_for_filter(media_resources, filter_types = [:media_files, :permissions, :meta_data, :media_resource_type])
          r = []
    
          if filter_types.include? :media_resource_type
            r << { :filter_type => "media_resources",
    Severity: Major
    Found in app/helpers/json/media_resource_helper.rb - About 6 hrs to fix

      Function PDFPageProxyClosure has 156 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var PDFPageProxy = (function PDFPageProxyClosure() {
        function PDFPageProxy(pageIndex, pageInfo, transport) {
          this.pageIndex = pageIndex;
          this.pageInfo = pageInfo;
          this.transport = transport;
      Severity: Major
      Found in public/mozilla-pdf/core/pdf.js - About 6 hrs to fix

        Function webViewerInitialized has 155 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function webViewerInitialized() {
          var params = PDFView.parseQueryString(document.location.search.substring(1));
          var file = 'file' in params ? params.file : DEFAULT_URL;
        
          var fileInput = document.createElement('input');
        Severity: Major
        Found in public/mozilla-pdf/web/viewer.js - About 6 hrs to fix

          PDFView has 45 functions (exceeds 20 allowed). Consider refactoring.
          Open

          var PDFView = {
            pages: [],
            thumbnails: [],
            currentScale: UNKNOWN_SCALE,
            currentScaleValue: null,
          Severity: Minor
          Found in public/mozilla-pdf/web/viewer.js - About 6 hrs to fix

            Function thumbnailView has 147 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            var ThumbnailView = function thumbnailView(container, id, defaultViewport) {
              var anchor = document.createElement('a');
              anchor.href = PDFView.getAnchorUrl('#page=' + id);
              anchor.title = mozL10n.get('thumb_page_title', {page: id}, 'Page {{page}}');
              anchor.onclick = function stopNavigation() {
            Severity: Major
            Found in public/mozilla-pdf/web/viewer.js - About 5 hrs to fix

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

                var Util = PDFJS.Util = (function UtilClosure() {
                  function Util() {}
                
                  Util.makeCssRgb = function Util_makeCssRgb(rgb) {
                    return 'rgb(' + rgb[0] + ',' + rgb[1] + ',' + rgb[2] + ')';
                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

                              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 public/mozilla-pdf/core/pdf.js and 1 other location - About 4 hrs to fix
                              public/mozilla-pdf/core/pdf.js on lines 811..816

                              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 public/mozilla-pdf/core/pdf.js and 1 other location - About 4 hrs to fix
                              public/mozilla-pdf/core/pdf.js on lines 816..821

                              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

                              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

                              Severity
                              Category
                              Status
                              Source
                              Language