Showing 377 of 529 total issues

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

    def hash_for_group(group, with = nil)
      h = {
        type: group.type,
        id: group.id,
        name: group.to_s
Severity: Minor
Found in app/helpers/json/group_helper.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 PageViewport has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

  function PageViewport(viewBox, scale, rotation, offsetX, offsetY, dontFlip) {
Severity: Minor
Found in public/mozilla-pdf/core/pdf.js - About 45 mins to fix

    Function setTransform has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        ctx.setTransform = function ctxSetTransform(a, b, c, d, e, f) {
    Severity: Minor
    Found in public/mozilla-pdf/core/pdf.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                   if (mask === 0) {
                     srcByte = src[srcPos++];
                     mask = 128;
                   }
      Severity: Major
      Found in public/mozilla-pdf/core/pdf.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                    for (var i = 0; i < dashArrayLength; i++) {
                      var validNumber = (+dashArray[i] >= 0);
                      if (!validNumber) {
                        isInvalid = true;
                        break;
        Severity: Major
        Found in public/mozilla-pdf/core/pdf.js - About 45 mins to fix

          Function createMeshCanvas has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

            function createMeshCanvas(bounds, combinesScale, coords, colors, figures,
                                      backgroundColor) {
          Severity: Minor
          Found in public/mozilla-pdf/core/pdf.js - About 45 mins to fix

            Function clipBbox has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                clipBbox: function clipBbox(graphics, bbox, x0, y0, x1, y1) {
            Severity: Minor
            Found in public/mozilla-pdf/core/pdf.js - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                      for (j = elemsInThisChunk; j--;) {
                        dest[destPos++] = src[srcPos++];
                        dest[destPos++] = src[srcPos++];
                        dest[destPos++] = src[srcPos++];
                        dest[destPos++] = 255;
              Severity: Major
              Found in public/mozilla-pdf/core/pdf.js - About 45 mins to fix

                Function InternalRenderTask has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                  function InternalRenderTask(callback, params, objs, commonObjs, operatorList,
                                              pageNumber) {
                Severity: Minor
                Found in public/mozilla-pdf/core/pdf.js - About 45 mins to fix

                  Function TilingPattern has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    function TilingPattern(IR, color, ctx, objs, commonObjs, baseTransform) {
                  Severity: Minor
                  Found in public/mozilla-pdf/core/pdf.js - About 45 mins to fix

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

                      def send_file_with_correct_extension(path, filename, content_type)
                        begin
                          raise ArgumentError.new "path must not be nil" unless path
                          raise ArgumentError.new "path must exist" unless File.exists? path
                          e = File.extname(path)
                    Severity: Minor
                    Found in app/controllers/download_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

                    Avoid deeply nested control flow statements.
                    Open

                                redirect_to_primary_custom_url(custom_url) unless (self.class == MediaSetsController)
                    Severity: Major
                    Found in app/controllers/concerns/custom_urls.rb - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                  redirect_to_primary_custom_url(custom_url) unless (self.class == MediaEntriesController)
                      Severity: Major
                      Found in app/controllers/concerns/custom_urls.rb - About 45 mins to fix

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

                          def change_ownership
                            unless transfer_option_available?
                              redirect_to :back, flash: { notice: 'Choose at least one of transfer option.' } and return
                            end
                        
                        
                        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

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

                          def show
                            if Concerns::CustomUrls::UUID_MATCHER.match params[:id]
                              @media_resource= MediaResource.find(params[:id])
                              unless @api_application.authorized?(:view,@media_resource)
                                raise ActiveRecord::RecordNotFound.new(@media_resource) 
                        Severity: Minor
                        Found in app/controllers/api/media_entries_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

                        Avoid deeply nested control flow statements.
                        Open

                                    redirect_to_primary_custom_url(custom_url) unless (self.class == FilterSetsController)
                        Severity: Major
                        Found in app/controllers/concerns/custom_urls.rb - About 45 mins to fix

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

                            def check_and_initialize_for_view
                              # here, everything is initialized that we need everywhere (Tabs!)
                              @media_set = find_media_resource 
                              raise UserUnauthorizedError unless current_user.login.present? || current_user.authorized?(:view, @media_set)
                              raise UserForbiddenError unless current_user.authorized?(:view,@media_set)
                          Severity: Minor
                          Found in app/controllers/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

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

                            def check_and_initialize_for_view
                              @media_entry = find_media_resource
                              raise "Wrong type" unless @media_entry.is_a? MediaEntry
                              raise UserUnauthorizedError if (logged_in? && current_user.login.nil?) && @media_entry.view == false
                              raise UserForbiddenError unless current_user.try(:authorized?, :view, @media_entry) || @media_entry.view == true
                          Severity: Minor
                          Found in app/controllers/media_entries_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

                          Avoid deeply nested control flow statements.
                          Open

                                          case with[:children][:type]
                                            when "media_entry"
                                              media_resources = media_resources.media_entries
                                            when "media_set"
                                              media_resources = media_resources.media_sets
                          Severity: Major
                          Found in app/helpers/json/media_resource_helper.rb - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                            case with[:children][:type]
                                              when "media_entry"
                                                media_resources = media_resources.media_entries
                                              when "media_set"
                                                media_resources = media_resources.media_sets
                            Severity: Major
                            Found in app/helpers/json/media_resource_helper.rb - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language