openSUSE/open-build-service

View on GitHub

Showing 621 of 670 total issues

Method render_xml has a Cognitive Complexity of 33 (exceeds 5 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 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 5 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'])
      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 summary has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def summary
      return @summary if @summary
      building = false
      failed = 0
      final = 0
Severity: Minor
Found in src/api/app/presenters/obs_factory/obs_project_presenter.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 32 (exceeds 5 allowed). Consider refactoring.
Open

  def call(env)
    logger = Rails.logger
    GC.start
    before = %x(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 _merge_pkg_into_maintenance_incident has a Cognitive Complexity of 31 (exceeds 5 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 update_from_xml has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

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

    _update_from_xml_targets(xmlhash)
    _update_from_xml_binary_lists(xmlhash)
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

File application_controller.rb has 347 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_dependency 'opensuse/validator'
require_dependency 'api_error'
require_dependency 'authenticator'

class ApplicationController < ActionController::Base
Severity: Minor
Found in src/api/app/controllers/application_controller.rb - About 4 hrs to fix

    Method package_existence_consistency_check has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

      def package_existence_consistency_check(project, fix = nil)
        errors = ''
        begin
          project.reload
        rescue ActiveRecord::RecordNotFound
    Severity: Minor
    Found in src/api/app/jobs/consistency_check_job.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_register_pool has a Cognitive Complexity of 29 (exceeds 5 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 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 find has 104 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 4 hrs to fix

      Method find_changed_issues has a Cognitive Complexity of 27 (exceeds 5 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

      Method _assignreview_update_reviews has a Cognitive Complexity of 27 (exceeds 5 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_with_ldap has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.find_with_ldap(login, password)
          Rails.logger.debug("Looking for #{login} using ldap")
      
          # When the server closes the connection, @@ldap_search_con.nil? doesn't catch it
          # @@ldap_search_con.bound? doesn't catch it as well. So when an error occurs, we
      Severity: Minor
      Found in src/api/app/models/user_ldap_strategy.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 store_from_xml has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        def store_from_xml(hash)
          source = hash.delete('source')
          if source
            self.source_package = source.delete('package')
            self.source_project = source.delete('project')
      Severity: Minor
      Found in src/api/app/models/bs_request_action.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 change_review_state has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        def change_review_state(new_review_state, opts = {})
          with_lock do
            new_review_state = new_review_state.to_sym
      
            unless state == :review || (state == :new && new_review_state == :new)
      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 branch has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        def branch
          params.fetch(:linked_project) { raise ArgumentError, 'Linked Project parameter missing' }
          params.fetch(:linked_package) { raise ArgumentError, 'Linked Package parameter missing' }
      
          # Full permission check happens in BranchPackage.new(branch_params).branch command
      Severity: Minor
      Found in src/api/app/controllers/webui/package_controller.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 parse_predicate has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
      Open

        def parse_predicate(root, stack)
          # logger.debug "------------------ predicate ---------------"
          # logger.debug "-- pred_array: #{stack.inspect} --"
      
          raise IllegalXpathError, 'invalid predicate' if stack.nil?
      Severity: Minor
      Found in src/api/lib/xpath_engine.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

      File maintenance_helper.rb has 320 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module MaintenanceHelper
        include ValidationHelper
      
        class MissingAction < APIError
          setup 400, 'The request contains no actions. Submit requests without source changes may have skipped!'
      Severity: Minor
      Found in src/api/app/helpers/maintenance_helper.rb - About 3 hrs to fix

        Method do_project_release has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
        Open

          def do_project_release(params)
            User.session ||= User.find_by!(login: params[:user])
        
            # uniq timestring for all targets
            time_now = Time.now.utc
        Severity: Minor
        Found in src/api/app/models/project.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 25 (exceeds 5 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

        Severity
        Category
        Status
        Source
        Language