openSUSE/open-build-service

View on GitHub

Showing 342 of 433 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

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

    class Webui::UsersController < Webui::WebuiController
      # TODO: Remove this when we'll refactor kerberos_auth
      before_action :kerberos_auth, only: %i[index edit destroy update change_password edit_account]
      before_action :authorize_user, only: %i[index edit destroy change_password edit_account]
      before_action :require_admin, only: %i[index edit destroy]
    Severity: Minor
    Found in src/api/app/controllers/webui/users_controller.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 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 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 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 forward has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
            Open

              def forward
                forward_object = nil
                target_package_object = Package.find_by_project_and_name(target_project, target_package)
            
                if target_package_object
            Severity: Minor
            Found in src/api/app/models/bs_request_action_submit.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 cmd_changestate_permissions has 51 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: Major
              Found in src/api/app/models/bs_request_permission_check.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 notifiable_link_text has 50 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: Minor
                  Found in src/api/app/components/notification_notifiable_link_component.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 show has 48 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 notifiable_link_path has 48 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: Minor
                        Found in src/api/app/components/notification_notifiable_link_component.rb - About 1 hr to fix

                          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 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

                          Severity
                          Category
                          Status
                          Source
                          Language