Showing 377 of 529 total issues

File media_resource_helper.rb has 333 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Json
  module MediaResourceHelper

    def hash_for_media_resource(media_resource, with = nil)
      h = {
Severity: Minor
Found in app/helpers/json/media_resource_helper.rb - About 4 hrs to fix

    Function PDFBugClosure has 99 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var PDFBug = (function PDFBugClosure() {
      var panelWidth = 300;
      var buttons = [];
      var activePanel = null;
    
    
    Severity: Major
    Found in public/mozilla-pdf/web/debugger.js - About 3 hrs to fix

      Function TextAnnotation_getHtmlElement has 98 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          getHtmlElement: function TextAnnotation_getHtmlElement(commonObjs) {
            assert(!isWorker, 'getHtmlElement() shall be called from main thread');
      
            var item = this.data;
            var rect = item.rect;
      Severity: Major
      Found in public/mozilla-pdf/core/pdf.js - About 3 hrs to fix

        Function pdfViewLoad has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

          load: function pdfViewLoad(pdfDocument, scale) {
            var self = this;
            var isOnePageRenderedResolved = false;
            var resolveOnePageRendered = null;
            var onePageRendered = new Promise(function (resolve) {
        Severity: Minor
        Found in public/mozilla-pdf/web/viewer.js - About 3 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 redirect_to_primary_url has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
        Open

            def redirect_to_primary_url
              if UUID_MATCHER.match params[:id] # id is a UUID; redirect if there is a custom primary url
                if (@media_resource=MediaResource.find(params[:id])) and (primary_custom_url= @media_resource.primary_custom_url)
                  redirect_to_primary_custom_url(primary_custom_url)
                end
        Severity: Minor
        Found in app/controllers/concerns/custom_urls.rb - About 3 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 putBinaryImageData has 94 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          function putBinaryImageData(ctx, imgData) {
            if (typeof ImageData !== 'undefined' && imgData instanceof ImageData) {
              ctx.putImageData(imgData, 0, 0);
              return;
            }
        Severity: Major
        Found in public/mozilla-pdf/core/pdf.js - About 3 hrs to fix

          Method index has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

            def index
              respond_to do |format|
                format.json do
                  groups = Group.where('name ilike :query OR institutional_group_name ilike :query',
                                        {:query => "%#{params[:query]}%"})
          Severity: Minor
          Found in app/controllers/app_admin/groups_controller.rb - About 3 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 InternalRenderTaskClosure has 92 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          var InternalRenderTask = (function InternalRenderTaskClosure() {
          
            function InternalRenderTask(callback, params, objs, commonObjs, operatorList,
                                        pageNumber) {
              this.callback = callback;
          Severity: Major
          Found in public/mozilla-pdf/core/pdf.js - About 3 hrs to fix

            Function pdfViewInitialize has 91 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              initialize: function pdfViewInitialize() {
                var self = this;
                var container = this.container = document.getElementById('viewerContainer');
                this.pageViewScroll = {};
                this.watchScroll(container, this.pageViewScroll, updateViewarea);
            Severity: Major
            Found in public/mozilla-pdf/web/viewer.js - About 3 hrs to fix

              Function addContextCurrentTransform has 91 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function addContextCurrentTransform(ctx) {
                // If the context doesn't expose a `mozCurrentTransform`, add a JS based on.
                if (!ctx.mozCurrentTransform) {
                  // Store the original context
                  ctx._scaleX = ctx._scaleX || 1.0;
              Severity: Major
              Found in public/mozilla-pdf/core/pdf.js - About 3 hrs to fix

                Function DownloadManagerClosure has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                Open

                var DownloadManager = (function DownloadManagerClosure() {
                
                  function download(blobUrl, filename) {
                    var a = document.createElement('a');
                    if (a.click) {
                Severity: Minor
                Found in public/mozilla-pdf/web/viewer.js - About 3 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 index has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
                Open

                  def index
                    respond_to do |format|
                      format.json {
                        users = Person.hacky_search(params[:query]).map(&:user).compact
                        render :json => view_context.json_for(users)
                Severity: Minor
                Found in app/controllers/app_admin/users_controller.rb - About 3 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 pdfHistoryInitialize has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                  initialize: function pdfHistoryInitialize(fingerprint) {
                    if (PDFJS.disableHistory || PDFView.isViewerEmbedded) {
                      // The browsing history is only enabled when the viewer is standalone,
                      // i.e. not when it is embedded in a web page.
                      return;
                Severity: Minor
                Found in public/mozilla-pdf/web/viewer.js - About 3 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 ViewHistoryClosure has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                Open

                var ViewHistory = (function ViewHistoryClosure() {
                  function ViewHistory(fingerprint) {
                    this.fingerprint = fingerprint;
                    this.isInitializedPromiseResolved = false;
                    this.initializedPromise =
                Severity: Minor
                Found in public/mozilla-pdf/web/viewer.js - About 3 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 parseResource has 82 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function parseResource(href, lang, successCallback, failureCallback) {
                    var baseURL = href.replace(/[^\/]*$/, '') || './';
                
                    // handle escaped characters (backslashes) in a string
                    function evalString(text) {
                Severity: Major
                Found in public/mozilla-pdf/web/l10n.js - About 3 hrs to fix

                  Function FontInspectorClosure has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
                  Open

                  var FontInspector = (function FontInspectorClosure() {
                    var fonts;
                    var active = false;
                    var fontAttribute = 'data-font-name';
                    function removeSelection() {
                  Severity: Minor
                  Found in public/mozilla-pdf/web/debugger.js - About 3 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 textLayerBuilder_renderMatches has 80 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    this.renderMatches = function textLayerBuilder_renderMatches(matches) {
                      // Early exit if there is nothing to render.
                      if (matches.length === 0) {
                        return;
                      }
                  Severity: Major
                  Found in public/mozilla-pdf/web/viewer.js - About 3 hrs to fix

                    Method update has 79 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def update
                    
                        groups= Array(params[:groups].is_a?(Hash) ? params[:groups].values : params[:groups])
                    
                        users = Array(params[:users].is_a?(Hash) ? params[:users].values : params[:users]) 
                    Severity: Major
                    Found in app/controllers/permissions_controller.rb - About 3 hrs to fix

                      Function checkTypedArrayCompatibility has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                      (function checkTypedArrayCompatibility() {
                        if (typeof Uint8Array !== 'undefined') {
                          // Support: iOS<6.0
                          if (typeof Uint8Array.prototype.subarray === 'undefined') {
                              Uint8Array.prototype.subarray = function subarray(start, end) {
                      Severity: Minor
                      Found in public/mozilla-pdf/web/compatibility.js - About 3 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 mozPrintCallbackPolyfillClosure has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
                      Open

                      (function mozPrintCallbackPolyfillClosure() {
                        if ('mozPrintCallback' in document.createElement('canvas')) {
                          return;
                        }
                        // Cause positive result on feature-detection:
                      Severity: Minor
                      Found in public/mozilla-pdf/web/viewer.js - About 3 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