openSUSE/open-build-service

View on GitHub

Showing 336 of 425 total issues

Method create_events has 27 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create_events
    Event::Base.transaction do
      data = type = nil
      @last.elements('notification') do |e|
        type = e['type']
Severity: Minor
Found in src/api/app/models/update_notification_events.rb - About 1 hr to fix

    Method has_local_permission? has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def has_local_permission?(perm_string, object)
        roles = Role.ids_with_permission(perm_string)
        return false unless roles
    
        parent = nil
    Severity: Minor
    Found in src/api/app/models/user.rb - About 1 hr to fix

      Method description_text has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def description_text
          case @notification.event_type
          when 'Event::RequestStatechange', 'Event::RequestCreate', 'Event::ReviewWanted', 'Event::CommentForRequest'
            BsRequestActionSourceAndTargetComponent.new(bs_request).call
          when 'Event::CommentForProject'
      Severity: Minor
      Found in src/api/app/components/notification_action_description_component.rb - About 1 hr to fix

        Method run has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def run(xmlhash, force = nil)
              project.check_write_access!
        
              # check for raising read access permissions, which can't get ensured atm
              raise ForbiddenError if !(project.new_record? || project.disabled_for?('access', nil, nil)) && (FlagHelper.xml_disabled_for?(xmlhash, 'access') && !User.admin_session?)
        Severity: Minor
        Found in src/api/app/models/project/update_from_xml_command.rb - About 1 hr to fix

          Method branch_remote_repositories has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def branch_remote_repositories(project)
              remote_project = Project.new(name: project)
              remote_project_meta = Nokogiri::XML(remote_project.meta.content, &:strict)
              local_project_meta = Nokogiri::XML(render_xml, &:strict)
          
          
          Severity: Minor
          Found in src/api/app/models/project.rb - About 1 hr to fix

            Method release_package_create_main_package has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def release_package_create_main_package(request, source_package, target_package_name, target_project)
                base_package_name = target_package_name.gsub(/\.[^.]*$/, '')
            
                # only if package does not contain a _patchinfo file
                lpkg = nil
            Severity: Minor
            Found in src/api/app/helpers/maintenance_helper.rb - About 1 hr to fix

              Method resample has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.resample(values, samples = 400)
                  values.sort_by! { |a| a[0] }
              
                  result = []
                  return result if values.empty?
              Severity: Minor
              Found in src/api/app/helpers/status_helper.rb - About 1 hr to fix

                Method create has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def create
                        authorize @package, :update?
                
                        files = params[:files] || []
                        filename = params[:filename]
                Severity: Minor
                Found in src/api/app/controllers/webui/packages/files_controller.rb - About 1 hr to fix

                  Method index has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    def index
                      if request.post? && !params[:project].nil? && Project.valid_name?(params[:project])
                        redirect_to project: params[:project]
                      else
                        begin
                  Severity: Minor
                  Found in src/api/app/controllers/webui/monitor_controller.rb - About 1 hr to fix

                    Method obsolete_reviews has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                    Open

                      def obsolete_reviews(opts)
                        return false unless opts[:by_user] || opts[:by_group] || opts[:by_project] || opts[:by_package]
                    
                        reviews.each do |review|
                          next unless review.reviewable_by?(opts)
                    Severity: Minor
                    Found in src/api/app/models/bs_request.rb - About 55 mins 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 validate_repository_xml_attribute has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                    Open

                        def validate_repository_xml_attribute(request_data, project_name)
                          # Check used repo pathes for existence and read access permissions
                          request_data.elements('repository') do |repository|
                            repository.elements('path') do |element|
                              # permissions check
                    Severity: Minor
                    Found in src/api/app/models/project.rb - About 55 mins 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 forbidden_project_ids has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                    Open

                      def self.forbidden_project_ids
                        # Admins don't have forbidden projects
                        return [0] if User.admin_session?
                    
                        # This will cache and return a hash like this:
                    Severity: Minor
                    Found in src/api/app/models/relationship.rb - About 55 mins 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_events has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                    Open

                      def create_events
                        Event::Base.transaction do
                          data = type = nil
                          @last.elements('notification') do |e|
                            type = e['type']
                    Severity: Minor
                    Found in src/api/app/models/update_notification_events.rb - About 55 mins 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_flags has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                    Open

                      def set_flags
                        ActiveRecord::Base.transaction do
                          objects_to_store = Set.new
                          flags.each do |flag|
                            main_object = project_or_package(flag)
                    Severity: Minor
                    Found in src/api/app/models/workflow/step/set_flags.rb - About 55 mins 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_jobhistory has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                    Open

                        def update_jobhistory(proj, mypackages)
                          prjpacks = {}
                          dname = proj.name
                          mypackages.each_value do |package|
                            prjpacks[package.name] = package if package.project == dname
                    Severity: Minor
                    Found in src/api/app/models/project_status/calculator.rb - About 55 mins 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 has_local_permission? has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                    Open

                      def has_local_permission?(perm_string, object)
                        roles = Role.ids_with_permission(perm_string)
                        return false unless roles
                    
                        parent = nil
                    Severity: Minor
                    Found in src/api/app/models/user.rb - About 55 mins 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 post_userinfo has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                    Open

                      def post_userinfo
                        authorize @user, :update?
                    
                        login = params[:login]
                        # just for permission checking
                    Severity: Minor
                    Found in src/api/app/controllers/person_controller.rb - About 55 mins 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 import_channel has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring.
                    Open

                      def import_channel(channel, pkg, target_repo = nil)
                        channel = REXML::Document.new(channel)
                    
                        channel.elements['/channel'].add_element 'target', 'project' => target_repo.project.name, 'repository' => target_repo.name if target_repo
                    
                    
                    Severity: Minor
                    Found in src/api/app/helpers/maintenance_helper.rb - About 55 mins 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 copy_single_binary has 8 arguments (exceeds 5 allowed). Consider refactoring.
                    Open

                      def copy_single_binary(arch, target_repository, source_project_name, source_package_name, source_repo,
                                             target_package_name, update_info_id, setrelease)
                    Severity: Major
                    Found in src/api/app/helpers/maintenance_helper.rb - About 50 mins to fix

                      Method copy_binaries has 8 arguments (exceeds 5 allowed). Consider refactoring.
                      Open

                        def copy_binaries(filter_source_repository, filter_architecture, source_package, target_package_name,
                                          target_project, multibuild_container, setrelease, manual)
                      Severity: Major
                      Found in src/api/app/helpers/maintenance_helper.rb - About 50 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language