Showing 377 of 529 total issues

Function DownloadManagerClosure has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

var DownloadManager = (function DownloadManagerClosure() {

  function download(blobUrl, filename) {
    var a = document.createElement('a');
    if (a.click) {
Severity: Major
Found in public/mozilla-pdf/web/viewer.js - About 2 hrs to fix

    Method initilize_resources_and_more has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def initilize_resources_and_more
        @action = params['_action'].to_sym
    
    
        @all_media_resources= if params[:media_resource_id] # the case where we edit one 

      Method hash_for_media_resources_with_pagination has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def hash_for_media_resources_with_pagination(media_resources, pagination, with = nil, type_totals = false)
            page = (pagination.is_a?(Hash) ? pagination[:page] : nil) || 1
            per_page = [((pagination.is_a?(Hash) ? pagination[:per_page] : nil) || PER_PAGE.first).to_i.abs, PER_PAGE.last].min
            paginated_media_resources = media_resources.page(page).per(per_page)
            
      Severity: Minor
      Found in app/helpers/json/media_resource_helper.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

      Method hash_for_meta_datum has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def hash_for_meta_datum(meta_datum, with = nil)
            h = { 
              name: "#{meta_datum.meta_key.label}",
              value: ((s = meta_datum.to_s).blank? ? nil : s),
              raw_value: meta_datum.is_a?(MetaDatumString) ? meta_datum.value(current_user) : hash_for(meta_datum.value),
      Severity: Minor
      Found in app/helpers/json/meta_datum_helper.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 pdfViewError has 52 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        error: function pdfViewError(message, moreInfo) {
          var moreInfoText = mozL10n.get('error_version_info',
            {version: PDFJS.version || '?', build: PDFJS.build || '?'},
            'PDF.js v{{version}} (build: {{build}})') + '\n';
          if (moreInfo) {
      Severity: Major
      Found in public/mozilla-pdf/web/viewer.js - About 2 hrs to fix

        Function WorkerTransport has 52 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          Function pdfViewOpen has 51 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            open: function pdfViewOpen(url, scale, password,
                                       pdfDataRangeTransport, args) {
              if (this.pdfDocument) {
                // Reload the preferences if a document was previously opened.
                Preferences.reload();
          Severity: Major
          Found in public/mozilla-pdf/web/viewer.js - About 2 hrs to fix

            Function fontAdded has 51 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                fontAdded: function fontAdded(fontObj, url) {
                  function properties(obj, list) {
                    var moreInfo = document.createElement('table');
                    for (var i = 0; i < list.length; i++) {
                      var tr = document.createElement('tr');
            Severity: Major
            Found in public/mozilla-pdf/web/debugger.js - About 2 hrs to fix

              Function genericComposeSMask has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function genericComposeSMask(maskCtx, layerCtx, width, height,
                                             subtype, backdrop) {
                  var addBackdropFn;
                  if (backdrop) {
                    addBackdropFn = function (r0, g0, b0, bytes) {
              Severity: Major
              Found in public/mozilla-pdf/core/pdf.js - About 2 hrs to fix

                Function WidgetAnnotationClosure has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

                  Function PageViewport has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
                      this.viewBox = viewBox;
                      this.scale = scale;
                      this.rotation = rotation;
                      this.offsetX = offsetX;
                  Severity: Major
                  Found in public/mozilla-pdf/core/pdf.js - About 2 hrs to fix

                    Method filter has 51 lines of code (exceeds 25 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: Major
                    Found in app/models/media_resource_modules/filter.rb - About 2 hrs to fix

                      Method index has 51 lines of code (exceeds 25 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: Major
                      Found in app/controllers/app_admin/users_controller.rb - About 2 hrs to fix

                        Function pdfHistoryPush has 50 lines of code (exceeds 25 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 2 hrs to fix

                          Function Annotation has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            function Annotation(params) {
                              if (params.data) {
                                this.data = params.data;
                                return;
                              }
                          Severity: Minor
                          Found in public/mozilla-pdf/core/pdf.js - About 2 hrs to fix

                            Method login_from_session has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def login_from_session
                                user = nil
                            
                                if session[:user_id]
                            
                            
                            Severity: Minor
                            Found in app/controllers/application_controller.rb - About 2 hrs to fix

                              Function loadLocale has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                function loadLocale(lang, callback) {
                                  callback = callback || function _callback() {};
                              
                                  clear();
                                  gLanguage = lang;
                              Severity: Minor
                              Found in public/mozilla-pdf/web/l10n.js - About 1 hr to fix

                                Function createMeshCanvas has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  function createMeshCanvas(bounds, combinesScale, coords, colors, figures,
                                                            backgroundColor) {
                                    // we will increase scale on some weird factor to let antialiasing take
                                    // care of "rough" edges
                                    var EXPECTED_SCALE = 1.1;
                                Severity: Minor
                                Found in public/mozilla-pdf/core/pdf.js - About 1 hr to fix

                                  Method index has 48 lines of code (exceeds 25 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 1 hr to fix

                                    Function StepperManagerClosure has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                                    Open

                                    var StepperManager = (function StepperManagerClosure() {
                                      var steppers = [];
                                      var stepperDiv = null;
                                      var stepperControls = null;
                                      var stepperChooser = null;
                                    Severity: Minor
                                    Found in public/mozilla-pdf/web/debugger.js - About 1 hr 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