openSUSE/open-build-service

View on GitHub

Showing 574 of 632 total issues

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 call has a Cognitive Complexity of 32 (exceeds 5 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 _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

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

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

require 'api_error'

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

    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 _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_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

      File maintenance_helper.rb has 326 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 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 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 create has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

              def create
                # FIXME: We should use strong parameters instead of this custom implementation
                params.fetch(:linked_project) { raise ArgumentError, 'Linked Project parameter missing' }
                params.fetch(:linked_package) { raise ArgumentError, 'Linked Package parameter missing' }
        
        
        Severity: Minor
        Found in src/api/app/controllers/webui/packages/branches_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

        File webui_helper.rb has 317 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Webui::WebuiHelper
          include ActionView::Helpers::JavaScriptHelper
          include ActionView::Helpers::AssetTagHelper
          include Webui::BuildresultHelper
        
        
        Severity: Minor
        Found in src/api/app/helpers/webui/webui_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])
          
              comment = "Project release by #{User.session.login}"
          
          
          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 cleanup_before_destroy has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

            def cleanup_before_destroy
              # change all linking repository pathes
              linking_repositories.each do |lrep|
                lrep.path_elements.includes(:link, :repository).find_each do |pe|
                  next unless pe.link == self # this is not pointing to our repo
          Severity: Minor
          Found in src/api/app/models/repository.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

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

            def execute_accept(opts)
              # create package unless it exists already
              target_project = Project.get_by_name(self.target_project)
              if target_package
                target_package = target_project.packages.find_by_name(self.target_package)
          Severity: Minor
          Found in src/api/app/models/bs_request_action_submit.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 evaluate_expr has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

            def evaluate_expr(expr, root, escape = false)
              table = @base_table
              a = []
              until expr.empty?
                token = expr.shift
          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

          Method update_from_xml has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

            def update_from_xml(xml)
              transaction do
                xml.elements('productdefinition') do |pd|
                  # we are either an operating system or an application for CPE
                  sw_class = 'o'
          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