Showing 377 of 529 total issues

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

  def create
    begin
      @media_resource= MediaResource.find params[:id]
      raise UserForbiddenError unless create_url_authorized?
      if not current_user.act_as_uberadmin and 
Severity: Minor
Found in app/controllers/custom_urls_controller.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 update_institutional_groups_from_ldap_localfile has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def update_institutional_groups_from_ldap_localfile
      JSON.parse(File.read("db/ldap.json")).each do |entry|
        entry = entry["myhash"]
        begin
          next unless (entry["name"] and entry["extensionattribute1"] and entry["extensionattribute3"])
Severity: Minor
Found in lib/ldap_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

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

  def check_and_initialize_for_view
    @filter_set = find_media_resource 
    raise "Wrong type" unless @filter_set.is_a? FilterSet
    raise UserUnauthorizedError unless current_user.login.present? || current_user.authorized?(:view, @filter_set)
    raise UserForbiddenError unless current_user.authorized?(:view,@filter_set)
Severity: Minor
Found in app/controllers/filter_sets_controller.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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    begin 
      params[:page] ||= 1
      query_params = params.select{|k| [:page,:type].include? k.to_sym}.clone

Severity: Minor
Found in app/controllers/api/media_resources_controller.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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    @meta_keys = MetaKey.page(params[:page]).per(12)

    if (label = params.try(:[], :filter).try(:[], :label)).present?
      label      = label.strip
Severity: Minor
Found in app/controllers/app_admin/meta_keys_controller.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 index has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def index
    @media_resource= MediaResource.find params[:id]
    raise UserUnauthorizedError unless current_user.login.present? || current_user.authorized?(:view, @media_resource)
    begin
      raise "Forbidden" unless current_user.authorized?(:view, @media_resource)
Severity: Minor
Found in app/controllers/custom_urls_controller.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

Avoid too many return statements within this function.
Open

        return 'other';
Severity: Major
Found in public/mozilla-pdf/web/l10n.js - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

              return 'one';
    Severity: Major
    Found in public/mozilla-pdf/web/l10n.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

                return 'one';
      Severity: Major
      Found in public/mozilla-pdf/web/l10n.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return 'other';
        Severity: Major
        Found in public/mozilla-pdf/web/l10n.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return 'other';
          Severity: Major
          Found in public/mozilla-pdf/web/l10n.js - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return 'other';
            Severity: Major
            Found in public/mozilla-pdf/web/l10n.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                      return WidgetAnnotation;
              Severity: Major
              Found in public/mozilla-pdf/core/pdf.js - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return false;
                Severity: Major
                Found in public/mozilla-pdf/web/viewer.js - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                            return i;
                  Severity: Major
                  Found in public/mozilla-pdf/core/pdf.js - About 30 mins to fix

                    Avoid too many return statements within this function.
                    Open

                              return i;
                    Severity: Major
                    Found in public/mozilla-pdf/core/pdf.js - About 30 mins to fix

                      Avoid too many return statements within this function.
                      Open

                            return null;
                      Severity: Major
                      Found in public/mozilla-pdf/web/viewer.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                            return params;
                        Severity: Major
                        Found in public/mozilla-pdf/web/viewer.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                  return TextWidgetAnnotation;
                          Severity: Major
                          Found in public/mozilla-pdf/core/pdf.js - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                  return Annotation;
                            Severity: Major
                            Found in public/mozilla-pdf/core/pdf.js - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language