openSUSE/open-build-service

View on GitHub

Showing 340 of 434 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 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 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 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)) ||
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

Class PackageController has 37 methods (exceeds 20 allowed). Consider refactoring.
Open

class Webui::PackageController < Webui::WebuiController
  include ParsePackageDiff
  include Webui::PackageHelper
  include Webui::ManageRelationships

Severity: Minor
Found in src/api/app/controllers/webui/package_controller.rb - About 4 hrs to fix

    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

    Class ProjectController has 36 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Webui::ProjectController < Webui::WebuiController
      include Webui::RequestHelper
      include Webui::ProjectHelper
      include Webui::ManageRelationships
      include Webui::ProjectBuildResultParsing
    Severity: Minor
    Found in src/api/app/controllers/webui/project_controller.rb - About 4 hrs to fix

      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 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 find has 98 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 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 _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 default_reviewers has a Cognitive Complexity of 29 (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 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 _merge_pkg_into_maintenance_incident has a Cognitive Complexity of 28 (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 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 SearchController has 29 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class SearchController < ApplicationController
          require 'xpath_engine'
        
          class IllegalXpathError < APIError
            setup 'illegal_xpath_error', 400
        Severity: Minor
        Found in src/api/app/controllers/search_controller.rb - About 3 hrs to fix

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

            def change_review_state(new_review_state, opts = {})
              with_lock do
                new_review_state = new_review_state.to_sym
          
                raise InvalidStateError, 'request is not in a changeable state (new, review or declined)' unless state == :review || (state.in?(%i[new declined]) && 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 _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 configure_package_link_target_project has a Cognitive Complexity of 27 (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

          Severity
          Category
          Status
          Source
          Language