openSUSE/open-build-service

View on GitHub

Showing 393 of 426 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 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 changerequest has a Cognitive Complexity of 19 (exceeds 8 allowed). Consider refactoring.
          Open

            def changerequest
              changestate = (%w[accepted commented declined revoked new] & params.keys).last
          
              if changestate == 'commented'
          
          
          Severity: Minor
          Found in src/api/app/controllers/webui/request_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 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

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

              def status_options
                if @initial_report
                  { context: 'OBS SCM/CI Workflow Integration started',
                    target_url: Rails.application.routes.url_helpers.token_workflow_run_url(@workflow_run.token_id, @workflow_run.id, host: Configuration.obs_url) }
                elsif @event_type == 'Event::RequestStatechange'
            Severity: Major
            Found in src/api/app/services/gitea_status_reporter.rb and 2 other locations - About 2 hrs to fix
            src/api/app/services/github_status_reporter.rb on lines 47..57
            src/api/app/services/gitlab_status_reporter.rb on lines 38..48

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 78.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

              def status_options
                if @initial_report
                  { context: 'OBS SCM/CI Workflow Integration started',
                    target_url: Rails.application.routes.url_helpers.token_workflow_run_url(@workflow_run.token_id, @workflow_run.id, host: Configuration.obs_url) }
                elsif @event_type == 'Event::RequestStatechange'
            Severity: Major
            Found in src/api/app/services/github_status_reporter.rb and 2 other locations - About 2 hrs to fix
            src/api/app/services/gitea_status_reporter.rb on lines 32..42
            src/api/app/services/gitlab_status_reporter.rb on lines 38..48

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 78.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Identical blocks of code found in 3 locations. Consider refactoring.
            Open

              def status_options
                if @initial_report
                  { context: 'OBS SCM/CI Workflow Integration started',
                    target_url: Rails.application.routes.url_helpers.token_workflow_run_url(@workflow_run.token_id, @workflow_run.id, host: Configuration.obs_url) }
                elsif @event_type == 'Event::RequestStatechange'
            Severity: Major
            Found in src/api/app/services/gitlab_status_reporter.rb and 2 other locations - About 2 hrs to fix
            src/api/app/services/gitea_status_reporter.rb on lines 32..42
            src/api/app/services/github_status_reporter.rb on lines 47..57

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 78.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            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 check_accepted_action has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring.
                Open

                  def check_accepted_action(action)
                    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 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 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

                Severity
                Category
                Status
                Source
                Language