Showing 377 of 529 total issues

Method delete_with_child_media_resources has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def delete_with_child_media_resources
    begin
      ActiveRecord::Base.transaction do
        @media_set = MediaSet.find params[:id]
        @media_set.child_media_resources.each{|mr| raise unless mr.destroy}
Severity: Minor
Found in app/controllers/app_admin/media_sets_controller.rb - About 45 mins 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 PageView has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

var PageView = function pageView(container, id, scale,
                                 navigateTo, defaultViewport) {
Severity: Minor
Found in public/mozilla-pdf/web/viewer.js - About 35 mins to fix

    Function open has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      open: function pdfViewOpen(url, scale, password,
                                 pdfDataRangeTransport, args) {
    Severity: Minor
    Found in public/mozilla-pdf/web/viewer.js - About 35 mins to fix

      Function drawFigures has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

        function drawFigures(width, height, backgroundColor, figures, context) {
      Severity: Minor
      Found in public/mozilla-pdf/core/pdf.js - About 35 mins to fix

        Function appendToOperatorList has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

              annotations, opList, pdfManager, partialEvaluator, intent) {
        Severity: Minor
        Found in public/mozilla-pdf/core/pdf.js - About 35 mins to fix

          Function setupSlider has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            var setupSlider = function (elm, min, max, onMove, onChange) {
          Severity: Minor
          Found in app/assets/javascripts/vocabulary.js - About 35 mins to fix

            Function ProgressBarClosure has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            var ProgressBar = (function ProgressBarClosure() {
            
              function clamp(v, min, max) {
                return Math.min(Math.max(v, min), max);
              }
            Severity: Minor
            Found in public/mozilla-pdf/web/viewer.js - About 35 mins 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 updateMatch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              updateMatch: function(found) {
                var state = FindStates.FIND_NOTFOUND;
                var wrapped = this.offset.wrapped;
                this.offset.wrapped = false;
                if (found) {
            Severity: Minor
            Found in public/mozilla-pdf/web/viewer.js - About 35 mins 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 presentationModeMouseDown has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              mouseDown: function presentationModeMouseDown(evt) {
                var self = PresentationMode;
                if (self.contextMenuOpen) {
                  self.contextMenuOpen = false;
                  evt.preventDefault();
            Severity: Minor
            Found in public/mozilla-pdf/web/viewer.js - About 35 mins 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 checkSetPresenceInImageData has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            (function checkSetPresenceInImageData() {
              if (window.CanvasPixelArray) {
                if (typeof window.CanvasPixelArray.prototype.set !== 'function') {
                  window.CanvasPixelArray.prototype.set = function(arr) {
                    for (var i = 0, ii = this.length; i < ii; i++) {
            Severity: Minor
            Found in public/mozilla-pdf/web/compatibility.js - About 35 mins 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 pdfHistory_pushToHistory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              _pushToHistory: function pdfHistory_pushToHistory(params,
                                                                addPrevious, overwrite) {
                if (!this.initialized) {
                  return;
                }
            Severity: Minor
            Found in public/mozilla-pdf/web/viewer.js - About 35 mins 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 checkXMLHttpRequestResponseCompatibility has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            (function checkXMLHttpRequestResponseCompatibility() {
              var xhrPrototype = XMLHttpRequest.prototype;
              var xhr = new XMLHttpRequest();
              if (!('overrideMimeType' in xhr)) {
                // IE10 might have response, but not overrideMimeType
            Severity: Minor
            Found in public/mozilla-pdf/web/compatibility.js - About 35 mins 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 original_filename_duplicates has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.original_filename_duplicates
            
                files_md5 = Set.new
                duplicate_ids = Set.new
            
            
            Severity: Minor
            Found in app/models/media_entry.rb - About 35 mins 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 original_md5file_duplicates has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.original_md5file_duplicates
            
                files_md5 = Set.new
                duplicate_ids = Set.new
            
            
            Severity: Minor
            Found in app/models/media_entry.rb - About 35 mins 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 for_context has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                      def for_context(context = Context.find("core"), build_if_not_exists = true)
                        meta_keys = context.meta_keys 
                        meta_key_ids = context.meta_key_ids
            
                        mds = where(:meta_key_id => meta_key_ids).eager_load(:meta_key)
            Severity: Minor
            Found in app/models/media_resource_modules/meta_data.rb - About 35 mins 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_permissions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                  def filter_permissions(resources, current_user, filter)
                    filter.each_pair do |k,v|
                      v[:ids].each do |id|
                        resources = case k
                          when :owner
            Severity: Minor
            Found in app/models/media_resource_modules/filter.rb - About 35 mins 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 import_audio_video_metadata has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def import_audio_video_metadata(full_path_file)
                  # TODO: merge with import_image_metadata, make fields configurable in :options hash
                  self.meta_data ||= {}
            
                  # The Tracks: entries describe video, audio or subtitle tracks present in the container. We extract 10
            Severity: Minor
            Found in app/models/media_file_modules/meta_data_extraction.rb - About 35 mins 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 thumb_base64 has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def thumb_base64(size = :small)
                  size = size.to_sym
            
                  preview = case content_type
                            when /video/ then
            Severity: Minor
            Found in app/models/media_file_modules/previews.rb - About 35 mins 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 name has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def name
                a = []
                a << last_name unless last_name.blank? 
                a << first_name unless first_name.blank? 
                r = a.join(", ")
            Severity: Minor
            Found in app/models/person.rb - About 35 mins 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 active_layout has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

              def active_layout
                if params[:layout] == "miniature"
                  "miniature"
                elsif params[:layout] == "list"
                  "list"
            Severity: Minor
            Found in app/helpers/active_layout_helper.rb - About 35 mins 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