Showing 377 of 529 total issues

Method create has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    
    attr = params[:media_sets] || params[:media_set]
    filter = params[:filter]
    is_saved = true
Severity: Minor
Found in app/controllers/media_sets_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 75 lines of code (exceeds 25 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: Major
Found in public/mozilla-pdf/web/viewer.js - About 3 hrs to fix

    Function StepperManagerClosure has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var StepperManager = (function StepperManagerClosure() {
      var steppers = [];
      var stepperDiv = null;
      var stepperControls = null;
      var stepperChooser = null;
    Severity: Major
    Found in public/mozilla-pdf/web/debugger.js - About 3 hrs to fix

      Function pageViewScrollIntoView has 74 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        this.scrollIntoView = function pageViewScrollIntoView(dest) {
          if (PresentationMode.active) {
            if (PDFView.page !== this.id) {
              // Avoid breaking PDFView.getVisiblePages in presentation mode.
              PDFView.page = this.id;
      Severity: Major
      Found in public/mozilla-pdf/web/viewer.js - About 2 hrs to fix

        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 public/mozilla-pdf/core/pdf.js - About 2 hrs to fix

          Function fontLoaderPrepareFontLoadEvent has 74 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            prepareFontLoadEvent: function fontLoaderPrepareFontLoadEvent(rules,
                                                                          fonts,
                                                                          request) {
                /** Hack begin */
                // There's currently no event when a font has finished downloading so the
          Severity: Major
          Found in public/mozilla-pdf/core/pdf.js - About 2 hrs to fix

            Function webViewerInitialized has a Cognitive Complexity of 21 (exceeds 5 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: Minor
            Found in public/mozilla-pdf/web/viewer.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 CanvasGraphics_beginGroup has 69 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                beginGroup: function CanvasGraphics_beginGroup(group) {
                  this.save();
                  var currentCtx = this.ctx;
                  // TODO non-isolated groups - according to Rik at adobe non-isolated
                  // group results aren't usually that different and they even have tools
            Severity: Major
            Found in public/mozilla-pdf/core/pdf.js - About 2 hrs to fix

              Function updateOperatorList has 68 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  updateOperatorList: function updateOperatorList(operatorList) {
                    var self = this;
              
                    function cboxOnClick() {
                      var x = +this.dataset.idx;
              Severity: Major
              Found in public/mozilla-pdf/web/debugger.js - About 2 hrs to fix

                Function PDFPageProxy_render has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    render: function PDFPageProxy_render(params) {
                      var stats = this.stats;
                      stats.time('Overall');
                
                      // If there was a pending destroy cancel it so no cleanup happens during
                Severity: Major
                Found in public/mozilla-pdf/core/pdf.js - About 2 hrs to fix

                  Function LinkAnnotationClosure has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Function ViewHistoryClosure has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    var ViewHistory = (function ViewHistoryClosure() {
                      function ViewHistory(fingerprint) {
                        this.fingerprint = fingerprint;
                        this.isInitializedPromiseResolved = false;
                        this.initializedPromise =
                    Severity: Major
                    Found in public/mozilla-pdf/web/viewer.js - About 2 hrs to fix

                      Function MetadataClosure has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      var Metadata = PDFJS.Metadata = (function MetadataClosure() {
                        function fixMetadata(meta) {
                          return meta.replace(/>\\376\\377([^<]+)/g, function(all, codes) {
                            var bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g,
                                                      function(code, d1, d2, d3) {
                      Severity: Major
                      Found in public/mozilla-pdf/core/pdf.js - About 2 hrs to fix

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

                          def index
                            @keyword_terms = KeywordTerm \
                              .with_count \
                              .with_users_count \
                              .with_date_of_creation \
                        Severity: Minor
                        Found in app/controllers/app_admin/keywords_controller.rb - 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 CanvasGraphics_setGState has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            setGState: function CanvasGraphics_setGState(states) {
                              for (var i = 0, ii = states.length; i < ii; i++) {
                                var state = states[i];
                                var key = state[0];
                                var value = state[1];
                        Severity: Major
                        Found in public/mozilla-pdf/core/pdf.js - About 2 hrs to fix

                          Function updateViewarea has 63 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          function updateViewarea() {
                          
                            if (!PDFView.initialized) {
                              return;
                            }
                          Severity: Major
                          Found in public/mozilla-pdf/web/viewer.js - About 2 hrs to fix

                            Method the_messy_before_filter has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def the_messy_before_filter 
                                if [:edit_multiple, :update_multiple, :remove_multiple].include? request[:action].to_sym
                                  begin
                                    if !params[:media_set_id].blank?
                                      action = case request[:action].to_sym
                            Severity: Major
                            Found in app/controllers/media_entries_controller.rb - About 2 hrs to fix

                              Function TextWidgetAnnotationClosure has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              var TextWidgetAnnotation = (function TextWidgetAnnotationClosure() {
                                function TextWidgetAnnotation(params) {
                                  WidgetAnnotation.call(this, params);
                              
                                  if (params.data) {
                              Severity: Major
                              Found in public/mozilla-pdf/core/pdf.js - About 2 hrs to fix

                                Function pdfViewGetDestinationHash has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  getDestinationHash: function pdfViewGetDestinationHash(dest) {
                                    if (typeof dest === 'string') {
                                      return PDFView.getAnchorUrl('#' + escape(dest));
                                    }
                                    if (dest instanceof Array) {
                                Severity: Minor
                                Found in public/mozilla-pdf/web/viewer.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

                                Method filter_meta_data has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                                Open

                                      def filter_meta_data(resources, filter)
                                        filter.each_pair do |k,v|
                                          # this is AND implementation
                                          v[:ids].each do |id|
                                            # OPTIMIZE resource.joins(etc...) directly intersecting multiple criteria doesn't work, then we use subqueries
                                Severity: Minor
                                Found in app/models/media_resource_modules/filter.rb - 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

                                Severity
                                Category
                                Status
                                Source
                                Language