openSUSE/open-build-service

View on GitHub

Showing 338 of 424 total issues

Method render_xml has a Cognitive Complexity of 39 (exceeds 8 allowed). Consider refactoring.
Open

  def render_xml
    builder = Nokogiri::XML::Builder.new
    builder.binary(render_attributes) do |binary|
      binary.operation(operation)

Severity: Minor
Found in src/api/app/models/binary_release.rb - About 5 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 sync_repository_pathes has a Cognitive Complexity of 38 (exceeds 8 allowed). Consider refactoring.
Open

  def sync_repository_pathes
    # check all my repositories and ..
    repositories.each do |repo|
      cycle_detection = {}
      repo.path_elements.each do |path|
Severity: Minor
Found in src/api/app/models/project.rb - About 5 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 find_packages_to_branch has a Cognitive Complexity of 38 (exceeds 8 allowed). Consider refactoring.
Open

  def find_packages_to_branch
    @packages = []
    if params[:request]
      # find packages from request
      req = BsRequest.find_by_number(params[:request])
Severity: Minor
Found in src/api/app/models/branch_package.rb - About 5 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 default_reviewers has a Cognitive Complexity of 38 (exceeds 8 allowed). Consider refactoring.
Open

  def default_reviewers
    reviews = []
    return reviews unless target_project

    tprj = Project.get_by_name(target_project)
Severity: Minor
Found in src/api/app/models/bs_request_action.rb - About 5 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 project_command_copy has a Cognitive Complexity of 36 (exceeds 8 allowed). Consider refactoring.
Open

  def project_command_copy
    project_name = params[:project]

    @project = Project.find_by_name(project_name)
    raise CmdExecutionNoPermission, "no permission to execute command 'copy'" unless (@project && User.session!.can_modify?(@project)) || User.session!.can_create_project?(project_name)
Severity: Minor
Found in src/api/app/controllers/source_controller.rb - About 4 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 binary_packages has a Cognitive Complexity of 35 (exceeds 8 allowed). Consider refactoring.
Open

  def binary_packages
    check_package_access(params[:project], params[:package], false)
    @pkg = Package.find_by_project_and_name(params[:project], params[:package])

    begin
Severity: Minor
Found in src/api/app/controllers/public_controller.rb - About 4 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 update has a Cognitive Complexity of 33 (exceeds 8 allowed). Consider refactoring.
Open

  def update
    respond_to do |format|
      xml = Nokogiri::XML(request.raw_post, &:strict).root
      attribs = {}
      attribs[:name] = xml.xpath('name[1]/text()').to_s unless xml.xpath('name[1]/text()').empty?
Severity: Minor
Found in src/api/app/controllers/issue_trackers_controller.rb - About 4 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 verify_xml! has a Cognitive Complexity of 32 (exceeds 8 allowed). Consider refactoring.
Open

  def self.verify_xml!(xmlhash)
    xmlhash = Xmlhash.parse(xmlhash) if xmlhash.is_a?(String)
    xmlhash.elements('target') do |p|
      prj = Project.get_by_name(p['project'])
      raise UnknownRepository, "Repository does not exist #{prj.name}/#{p['repository']}" unless prj.repositories.find_by_name(p['repository'])
Severity: Minor
Found in src/api/app/models/channel.rb - About 4 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 render_grouplist_ldap has a Cognitive Complexity of 32 (exceeds 8 allowed). Consider refactoring.
Open

  def self.render_grouplist_ldap(grouplist, user = nil)
    result = []
    @@ldap_search_con = initialize_ldap_con(CONFIG['ldap_search_user'], CONFIG['ldap_search_auth']) if @@ldap_search_con.nil?
    ldap_con = @@ldap_search_con
    if ldap_con.nil?
Severity: Minor
Found in src/api/app/models/user_ldap_strategy.rb - About 4 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 _merge_pkg_into_maintenance_incident has a Cognitive Complexity of 31 (exceeds 8 allowed). Consider refactoring.
Open

  def _merge_pkg_into_maintenance_incident(incident_project)
    # recreate package based on link target and throw everything away, except source changes
    # silently as maintenance teams requests ...
    new_pkg = nil

Severity: Minor
Found in src/api/app/models/bs_request_action_maintenance_incident.rb - About 4 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 check_action_permission_target! has a Cognitive Complexity of 31 (exceeds 8 allowed). Consider refactoring.
Open

  def check_action_permission_target!
    return unless target_project

    tprj = Project.get_by_name(target_project)
    if tprj.is_a?(Project)
Severity: Minor
Found in src/api/app/models/bs_request_action.rb - About 4 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 call has a Cognitive Complexity of 31 (exceeds 8 allowed). Consider refactoring.
Open

  def call(env)
    logger = Rails.logger
    GC.start
    before = `ps -orss= -p#{$PROCESS_ID}`.to_i
    file = File.new("/tmp/memprof-#{$PROCESS_ID}.log", 'w')
Severity: Minor
Found in src/api/lib/memory_debugger.rb - About 4 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 update_from_xml has a Cognitive Complexity of 30 (exceeds 8 allowed). Consider refactoring.
Open

  def update_from_xml(xmlhash)
    xmlhash = Xmlhash.parse(xmlhash) if xmlhash.is_a?(String)

    self.disabled = xmlhash.key?('disabled')
    _update_from_xml_targets(xmlhash)
Severity: Minor
Found in src/api/app/models/channel.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

Method _update_from_xml_register_update has a Cognitive Complexity of 30 (exceeds 8 allowed). Consider refactoring.
Open

  def _update_from_xml_register_update(rxml)
    rxml.elements('updates') do |u|
      update = {}
      product_update_repositories.each do |pu|
        next unless pu.repository # it may be remote or not yet exist
Severity: Minor
Found in src/api/app/models/product.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

Method find has 96 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def find(xpath)
    # logger.debug "---------------------- parsing xpath: #{xpath} -----------------------"

    begin
      @stack = @lexer.parse xpath
Severity: Major
Found in src/api/lib/xpath_engine.rb - About 3 hrs to fix

    Method _update_from_xml_register_pool has a Cognitive Complexity of 29 (exceeds 8 allowed). Consider refactoring.
    Open

      def _update_from_xml_register_pool(rxml)
        rxml.elements('pool') do |u|
          medium = {}
          product_media.each do |pm|
            key = "#{pm.repository.id}/#{pm.name}"
    Severity: Minor
    Found in src/api/app/models/product.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

    Method configure_package_link_target_project has a Cognitive Complexity of 28 (exceeds 8 allowed). Consider refactoring.
    Open

      def configure_package_link_target_project(pkg_name, update_project)
        package_to_update = update_project.packages.find_by(name: pkg_name)
    
        if package_to_update
          # We have a package in the update project already, take that
    Severity: Minor
    Found in src/api/app/models/branch_package/check_for_update.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

    Class Review has 29 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Review < ApplicationRecord
      include ActiveModel::Validations
    
      class NotFoundError < APIError
        setup 'review_not_found', 404, 'Review not found'
    Severity: Minor
    Found in src/api/app/models/review.rb - About 3 hrs to fix

      Method _assignreview_update_reviews has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring.
      Open

        def _assignreview_update_reviews(reviewer, opts, new_review = nil)
          review_comment = nil
          reviews.reverse_each do |review|
            next if review.by_user
            next if review.by_group && review.by_group != opts[:by_group]
      Severity: Minor
      Found in src/api/app/models/bs_request.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

      Method find_changed_issues has a Cognitive Complexity of 27 (exceeds 8 allowed). Consider refactoring.
      Open

        def find_changed_issues
          # no expand=1, so only branches are tracked
          query = { cmd: :diff, orev: 0, onlyissues: 1, linkrev: :base, view: :xml }
          issue_change = parse_issues_xml(query, 'kept')
          # issues introduced by local changes
      Severity: Minor
      Found in src/api/app/models/package.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

      Severity
      Category
      Status
      Source
      Language