openSUSE/open-build-service

View on GitHub

Showing 335 of 431 total issues

Class IssueTracker has 22 methods (exceeds 20 allowed). Consider refactoring.
Open

class IssueTracker < ApplicationRecord
  has_many :issues, dependent: :destroy

  class NotFoundError < APIError
    setup 'issue_tracker_not_found', 404, 'Issue Tracker not found'
Severity: Minor
Found in src/api/app/models/issue_tracker.rb - About 2 hrs to fix

    Method parse_status has 57 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def parse_status(project_name, package)
        comments_to_clear = []
        outs = []
        sortkey = "9-ok-#{package['name']}"
        age = age_from_devel(package['develmtime'].to_i)
    Severity: Major
    Found in src/api/app/helpers/webui/projects/status_helper.rb - About 2 hrs to fix

      Method project_index has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def project_index
          prj = nil
          prj = Project.get_by_name(params[:project]) unless params[:project] == '_dispatchprios'
      
          if request.get?
      Severity: Major
      Found in src/api/app/controllers/build_controller.rb - About 2 hrs to fix

        Method copy_binaries has a Cognitive Complexity of 20 (exceeds 8 allowed). Consider refactoring.
        Open

          def copy_binaries(filter_source_repository, filter_architecture, source_package, target_package_name,
                            target_project, multibuild_container, setrelease, manual)
            update_ids = []
            source_package.project.repositories.each do |source_repo|
              next if filter_source_repository && filter_source_repository != source_repo
        Severity: Minor
        Found in src/api/app/helpers/maintenance_helper.rb - About 2 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 monitor_parse_result has a Cognitive Complexity of 20 (exceeds 8 allowed). Consider refactoring.
        Open

          def monitor_parse_result(result)
            repo = result['repository']
            arch = result['arch']
        
            return unless @repo_filter.nil? || @repo_filter.include?(repo)

        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 56 lines of code (exceeds 25 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: Major
        Found in src/api/app/models/user_ldap_strategy.rb - About 2 hrs to fix

          Method notifiable_link_text has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def notifiable_link_text
              case @notification.event_type
              when 'Event::RequestStatechange', 'Event::RequestCreate', 'Event::ReviewWanted'
                "#{helpers.request_type_of_action(@notification.notifiable)} Request ##{@notification.notifiable.number}"
              when 'Event::CommentForRequest'
          Severity: Major
          Found in src/api/app/components/notification_notifiable_link_component.rb - About 2 hrs to fix

            Method assignreview has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
            Open

              def assignreview(opts = {})
                raise InvalidStateError, 'request is not in review state' unless state == :review || state == :new
            
                reviewer = User.find_by_login!(opts[:reviewer])
            
            
            Severity: Minor
            Found in src/api/app/models/bs_request.rb - About 2 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 put_userinfo has a Cognitive Complexity of 19 (exceeds 8 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 2 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 new_tracker has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
            Open

              def new_tracker
                # collection with all informations of the new issues
                issue_collection = []
                error = ''
                invalid_format = ''
            Severity: Minor
            Found in src/api/app/controllers/webui/patchinfo_controller.rb - About 2 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 52 lines of code (exceeds 25 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: Major
            Found in src/api/app/controllers/webui/packages/branches_controller.rb - About 2 hrs to fix

              Method notifiable_link_path has 52 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def notifiable_link_path
                  case @notification.event_type
                  when 'Event::RequestStatechange', 'Event::RequestCreate', 'Event::ReviewWanted'
                    Rails.application.routes.url_helpers.request_show_path(@notification.notifiable.number, notification_id: @notification.id)
                  when 'Event::CommentForRequest'
              Severity: Major
              Found in src/api/app/components/notification_notifiable_link_component.rb - About 2 hrs to fix

                Method search has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def search(what, render_all)
                    if render_all && params[:match].blank?
                      render_error status: 400, errorcode: 'empty_match',
                                   message: 'No predicate found in match argument'
                      return
                Severity: Minor
                Found in src/api/app/controllers/search_controller.rb - About 2 hrs to fix

                  Method image_params has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        def image_params
                          preferences_attributes = %i[
                            id
                            type_image
                            type_containerconfig_name
                  Severity: Minor
                  Found in src/api/app/controllers/webui/kiwi/images_controller.rb - About 1 hr to fix

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

                          def build
                            # the target is by default the _link target
                            # maintenance_release creates new packages instance, but are changing the source only according to the link
                            provided_in_other_action = check_for_local_linked_packages(source_package)
                            # fallback name as last resort
                    Severity: Minor
                    Found in src/api/app/models/bs_request_action/differ/query_builder.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 extend_packages_to_link has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
                    Open

                      def extend_packages_to_link(p)
                        return unless p[:package].is_a?(Package) # only for local packages
                    
                        pkg = p[:package]
                        if pkg.is_link?
                    Severity: Minor
                    Found in src/api/app/models/branch_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 create_branch_project has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
                    Open

                      def create_branch_project
                        if Project.exists_by_name(@target_project)
                          raise CreateProjectNoPermission, "The destination project already exists, so the api can't make it not readable" if @noaccess
                    
                          tprj = Project.get_by_name(@target_project)
                    Severity: Minor
                    Found in src/api/app/models/branch_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 check_accepted_action has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
                    Open

                      def check_accepted_action(action, opts)
                        raise NotExistingTarget, "Unable to process project #{action.target_project}; it does not exist." unless @target_project
                    
                        check_action_target(action)
                    
                    
                    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 auto_accept has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
                    Open

                      def auto_accept
                        # do not run for processed requests. Ignoring review on purpose since this
                        # must also work when people do not react anymore
                        return unless state == :new || state == :review
                    
                    
                    Severity: Minor
                    Found in src/api/app/models/bs_request.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 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

                    Severity
                    Category
                    Status
                    Source
                    Language