openSUSE/open-build-service

View on GitHub

Showing 713 of 773 total issues

Method initialize has 220 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def initialize
    @lexer = REXML::Parsers::XPathParser.new

    @tables = {
      'attribute' => 'attribs',
Severity: Major
Found in src/api/lib/xpath_engine.rb - About 1 day to fix

    File xpath_engine.rb has 529 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class XpathEngine
      require 'rexml/parsers/xpathparser'
    
      class IllegalXpathError < APIError
        setup 'illegal_xpath_error', 400
    Severity: Major
    Found in src/api/lib/xpath_engine.rb - About 1 day to fix

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

      class Webui::PackageController < Webui::WebuiController
        require_dependency 'opensuse/validator'
        include ParsePackageDiff
        include Webui::PackageHelper
        include Webui::ManageRelationships
      Severity: Major
      Found in src/api/app/controllers/webui/package_controller.rb - About 1 day to fix

        Method compute_status has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
        Open

          def compute_status(variant)
            all_flag = main_object.flags.find_by('flag = ? AND repo IS NULL AND architecture_id IS NULL', flag)
            repo_flag = main_object.flags.find_by('flag = ? AND repo = ? AND architecture_id IS NULL', flag, repo)
            arch_flag = main_object.flags.find_by('flag = ? AND repo IS NULL AND architecture_id = ?', flag, architecture_id)
            same_flag = main_object.flags.find_by('flag = ? AND repo = ? AND architecture_id = ?', flag, repo, architecture_id)
        Severity: Minor
        Found in src/api/app/models/flag.rb - About 7 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_expand_package has 190 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def create_expand_package(packages, opts = {})
            newactions = []
            incident_suffix = ''
            if is_maintenance_release?
              # The maintenance ID is always the sub project name of the maintenance project
        Severity: Major
        Found in src/api/app/models/bs_request_action.rb - About 7 hrs to fix

          Method update has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
              @issue_tracker = IssueTracker.find_by_name(params[:id])
              unless @issue_tracker
                render_error(status: 404, errorcode: 'not_found', message: "Unable to find issue tracker '#{params[:id]}'") && return
              end
          Severity: Minor
          Found in src/api/app/controllers/issue_trackers_controller.rb - About 7 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_local_repositories has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
          Open

            def branch_local_repositories(project, pkg_to_enable, opts = {})
              # shall we use the repositories from a different project?
              project = project.update_instance('OBS', 'BranchRepositoriesFromProject')
              skip_repos = []
              a = project.find_attribute('OBS', 'BranchSkipRepositories')
          Severity: Minor
          Found in src/api/app/models/project.rb - About 6 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 branch_package.rb has 452 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class BranchPackage
            class InvalidArgument < APIError; end
            class InvalidFilelistError < APIError; end
            class DoubleBranchPackageError < APIError
              attr_reader :project, :package
          Severity: Minor
          Found in src/api/app/models/branch_package.rb - About 6 hrs to fix

            Method project_index has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
            Open

              def project_index
                prj = nil
                unless params[:project] == '_dispatchprios'
                  prj = Project.get_by_name(params[:project])
                end
            Severity: Minor
            Found in src/api/app/controllers/build_controller.rb - About 6 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_binary_releases_via_json has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
            Open

              def self.update_binary_releases_via_json(repository, json, time = Time.now)
                oldlist = where(repository: repository, obsolete_time: nil, modify_time: nil)
                # we can not just remove it from relation, delete would affect the object.
                processed_item = {}
            
            
            Severity: Minor
            Found in src/api/app/models/binary_release.rb - About 6 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 determine_details_about_package_to_branch has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
            Open

              def determine_details_about_package_to_branch(p)
                return unless p[:link_target_project].is_a?(Project) # only for local source projects
            
                check_for_update_project(p) unless params[:ignoredevel]
            
            
            Severity: Minor
            Found in src/api/app/models/branch_package.rb - About 6 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 changestate_accepted has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
            Open

              def changestate_accepted(opts)
                # all maintenance_incident actions go into the same incident project
                incident_project = nil # .where(type: 'maintenance_incident')
                bs_request_actions.each do |action|
                  source_project = Project.find_by_name(action.source_project)
            Severity: Minor
            Found in src/api/app/models/bs_request.rb - About 6 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 5 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 5 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

            Class BsRequestAction has 42 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class BsRequestAction < ApplicationRecord
              #### Includes and extends
              include ParsePackageDiff
              include BsRequestAction::Errors
              #### Constants
            Severity: Minor
            Found in src/api/app/models/bs_request_action.rb - About 5 hrs to fix

              Method check_for_update_project has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
              Open

                def check_for_update_project(p)
                  pkg = p[:package]
                  prj = p[:link_target_project]
                  if pkg.is_a?(Package)
                    logger.debug "Check Package #{p[:package].project.name}/#{p[:package].name}"
              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 cmd_changestate_permissions has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
              Open

                def cmd_changestate_permissions(opts)
                  # We do not support to revert changes from accepted requests (yet)
                  if req.state == :accepted
                    raise PostRequestNoPermission, 'change state from an accepted state is not allowed.'
                  end
              Severity: Minor
              Found in src/api/app/models/bs_request_permission_check.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

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

                class Base < ApplicationRecord
                  self.inheritance_column = 'eventtype'
                  self.table_name = 'events'
              
                  after_create :create_project_log_entry_job, if: -> { (PROJECT_CLASSES | PACKAGE_CLASSES).include?(self.class.name) }
              Severity: Minor
              Found in src/api/app/models/event/base.rb - About 5 hrs to fix

                Method project_command_copy has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
                Open

                  def project_command_copy
                    project_name = params[:project]
                
                    @project = Project.find_by_name(project_name)
                    unless (@project && User.current.can_modify?(@project)) || User.current.can_create_project?(project_name)
                Severity: Minor
                Found in src/api/app/controllers/source_controller.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_grouplist_ldap has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                Open

                  def self.render_grouplist_ldap(grouplist, user = nil)
                    result = []
                    if @@ldap_search_con.nil?
                      @@ldap_search_con = initialize_ldap_con(CONFIG['ldap_search_user'], CONFIG['ldap_search_auth'])
                    end
                Severity: Minor
                Found in src/api/app/models/user_ldap_strategy.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

                Severity
                Category
                Status
                Source
                Language