openSUSE/open-build-service

View on GitHub

Showing 326 of 426 total issues

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

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

    Method find_packages_to_branch has a Cognitive Complexity of 39 (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 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 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

    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], use_source: 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 31 (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 get_by_project_and_name has a Cognitive Complexity of 31 (exceeds 8 allowed). Consider refactoring.
    Open

      def self.get_by_project_and_name(project_name, package_name, opts = {})
        get_by_project_and_name_defaults = { use_source: true,
                                             follow_project_links: true,
                                             follow_project_scmsync_links: false,
                                             follow_project_remote_links: false,
    Severity: Minor
    Found in src/api/app/models/package.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_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 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_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

      Class Repository has 30 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Repository < ApplicationRecord
        include StatusCheckable
      
        belongs_to :project, foreign_key: :db_project_id, inverse_of: :repositories
      
      
      Severity: Minor
      Found in src/api/app/models/repository.rb - About 3 hrs to fix

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

        class Webui::PackageController < Webui::WebuiController
          include ParsePackageDiff
          include ScmsyncChecker
          include Webui::PackageHelper
          include Webui::ManageRelationships
        Severity: Minor
        Found in src/api/app/controllers/webui/package_controller.rb - About 3 hrs to fix

          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 WebuiController has 29 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Webui::WebuiController < ActionController::Base
            layout 'webui/webui'
          
            Rails.cache.set_domain if Rails.cache.respond_to?(:set_domain)
          
          
          Severity: Minor
          Found in src/api/app/controllers/webui/webui_controller.rb - About 3 hrs to fix

            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
              Severity
              Category
              Status
              Source
              Language