openSUSE/open-build-service

View on GitHub

Showing 336 of 431 total issues

Method render_xml has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
Open

  def render_xml(builder)
    builder.action(type: action_type) do |action|
      render_xml_attributes(action)
      if sourceupdate || updatelink || makeoriginolder
        action.options do
Severity: Minor
Found in src/api/app/models/bs_request_action.rb - About 1 hr 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 internal_register has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
Open

  def internal_register
    if ::Configuration.ldap_enabled?
      render_error(
        status: 403,
        errorcode: 'permission_denied',
Severity: Minor
Found in src/api/app/controllers/person_controller.rb - About 1 hr 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 47 lines of code (exceeds 25 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 1 hr to fix

    Method cmd_changestate_permissions has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def cmd_changestate_permissions(opts)
        # We do not support to revert changes from accepted requests (yet)
        raise PostRequestNoPermission, 'change state from an accepted state is not allowed.' if req.state == :accepted
    
        # need to check for accept permissions
    Severity: Minor
    Found in src/api/app/models/bs_request_permission_check.rb - About 1 hr to fix

      Method store_from_xml has 46 lines of code (exceeds 25 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 1 hr to fix

        Method show has 45 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def show
            # FIXME: Remove this statement when scmsync is fully supported
            if @project.scmsync.present?
              flash[:error] = "Package sources for project #{@project.name} are received through scmsync.
                               This is not yet fully supported by the OBS frontend"
        Severity: Minor
        Found in src/api/app/controllers/webui/package_controller.rb - About 1 hr to fix

          Method extra_permissions_check_changestate has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
          Open

            def extra_permissions_check_changestate
              err =
                case opts[:newstate]
                when 'superseded'
                  # Is the user involved in any project or package ?
          Severity: Minor
          Found in src/api/app/models/bs_request_permission_check.rb - About 1 hr 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 17 (exceeds 8 allowed). Consider refactoring.
          Open

            def update_from_xml(xmlhash)
              with_lock do
                self.email = xmlhash.value('email')
              end
              save!
          Severity: Minor
          Found in src/api/app/models/group.rb - About 1 hr 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_changereviewstate_permissions has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
          Open

            def cmd_changereviewstate_permissions(opts)
              # Basic validations of given parameters
              by_user = User.find_by_login!(opts[:by_user]) if opts[:by_user]
              by_group = Group.find_by_title!(opts[:by_group]) if opts[:by_group]
              if opts[:by_project] && opts[:by_package]
          Severity: Minor
          Found in src/api/app/models/bs_request_permission_check.rb - About 1 hr 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 remove_repositories has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
          Open

              def remove_repositories(repositories, opts = {})
                deleted_repository = Repository.deleted_instance
          
                repositories.each do |repo|
                  linking_repositories = repo.linking_repositories
          Severity: Minor
          Found in src/api/app/models/project.rb - About 1 hr 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_binary_lists has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
          Open

            def _update_from_xml_binary_lists(xmlhash)
              # sync binary lists
              hasharray = []
              xmlhash.elements('binaries').each do |p|
                repository = nil
          Severity: Minor
          Found in src/api/app/models/channel.rb - About 1 hr 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 check_sanity has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
          Open

            def check_sanity
              if action_type.in?(%i[submit release maintenance_incident maintenance_release change_devel])
                errors.add(:source_project, "should not be empty for #{action_type} requests") if source_project.blank?
                errors.add(:source_package, "should not be empty for #{action_type} requests") if !is_maintenance_incident? && source_package.blank?
                errors.add(:target_project, "should not be empty for #{action_type} requests") if target_project.blank?
          Severity: Minor
          Found in src/api/app/models/bs_request_action.rb - About 1 hr 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 delete_on_backend has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
          Open

            def delete_on_backend
              # lock this package object to avoid that dependend objects get created in parallel
              # for example a backend_package
              reload(lock: true)
          
          
          Severity: Minor
          Found in src/api/app/models/package.rb - About 1 hr 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 package_command_release has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
          Open

            def package_command_release
              pkg = Package.get_by_project_and_name(params[:project], params[:package], follow_project_links: false, follow_multibuild: true)
              multibuild_container = nil
              multibuild_container = params[:package].gsub(/^.*:/, '') if params[:package].include?(':') && !params[:package].starts_with?('_product:')
          
          
          Severity: Minor
          Found in src/api/app/controllers/source_controller.rb - About 1 hr 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 17 (exceeds 8 allowed). Consider refactoring.
          Open

            def update
              @configuration = ::Configuration.fetch
          
              xml = Xmlhash.parse(request.raw_post) || {}
              attribs = {}
          Severity: Minor
          Found in src/api/app/controllers/configurations_controller.rb - About 1 hr 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 set_file_details has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
          Open

            def set_file_details
              @forced_unexpand ||= ''
          
              # check source access
              @files = []
          Severity: Minor
          Found in src/api/app/controllers/webui/package_controller.rb - About 1 hr 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 request_action_header has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def request_action_header(action, creator)
              source_project_hash = { project: action[:sprj], package: action[:spkg], trim_to: nil }
          
              description = case action[:type]
                            when :submit
          Severity: Minor
          Found in src/api/app/helpers/webui/request_helper.rb - About 1 hr to fix

            Method request_command_diff has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def request_command_diff
                req = BsRequest.find_by_number!(params[:id])
                superseded_request = req.superseding.find_by_number(params[:diff_to_superseded])
                if params[:diff_to_superseded].present? && superseded_request.blank?
                  msg = "Request #{params[:diff_to_superseded]} does not exist or is not superseded by request #{req.number}."
            Severity: Minor
            Found in src/api/app/controllers/request_controller.rb - About 1 hr to fix

              Method to_xml has 42 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def to_xml(project, package)
                  self.issues = []
                  issueid.to_a.each_with_index do |new_issue, index|
                    issues << [
                      new_issue,
              Severity: Minor
              Found in src/api/app/models/patchinfo.rb - About 1 hr to fix

                Method put_userinfo has 42 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def put_userinfo
                    login = params[:login]
                    user = User.find_by_login(login) if login
                
                    unless ::Configuration.accounts_editable?(user)
                Severity: Minor
                Found in src/api/app/controllers/person_controller.rb - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language