openSUSE/open-build-service

View on GitHub

Showing 339 of 429 total issues

Method parse_one_diff has 33 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def parse_one_diff(sourcediff)
    # Sort files into categories by their ending and add all of them to a hash. We
    # will later use the sorted and concatenated categories as key index into the per action file hash.
    changes_file_keys = []
    spec_file_keys = []
Severity: Minor
Found in src/api/app/mixins/parse_package_diff.rb - About 1 hr to fix

    Method sync_hash_with_model has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def sync_hash_with_model(entry_class, dblist, inhasharray)
        keys = entry_class._sync_keys
        entries = {}
    
        dblist.each do |e|
    Severity: Minor
    Found in src/api/app/helpers/model_helper.rb - About 1 hr to fix

      Method update_generic_relationships has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

        def update_generic_relationships(xmlhash)
          # we remember the current relationships in a hash
          cache = {}
          relationships.each do |purr|
            next if @updater.ignore?(purr)
      Severity: Minor
      Found in src/api/app/models/concerns/has_relationships.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_xml has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

        def create_xml(options = {})
          channel = channel_binary_list.channel
      
          builder = Nokogiri::XML::Builder.new
          attributes = {
      Severity: Minor
      Found in src/api/app/models/channel_binary.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 as_json has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

        def as_json(options = nil)
          if options
            if options.key?(:methods)
              if options[:methods].is_a?(Array)
                options[:methods] << :attrib_namespace_name unless options[:methods].include?(:attrib_namespace_name)
      Severity: Minor
      Found in src/api/app/models/attrib_type.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 change_state has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

        def change_state(opts)
          with_lock do
            permission_check_change_state!(opts)
            changestate_revoked(opts) if opts[:newstate] == 'revoked'
            changestate_accepted(opts) if opts[:newstate] == 'accepted'
      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 write_to_backend has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

        def write_to_backend
          # expire cache
          reset_cache
      
          raise ArgumentError, 'no commit_user set' unless @commit_opts[:no_backend_write] || @commit_opts[:login] || @commit_user
      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_path_elements has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

          def update_path_elements(current_repo, xml_hash)
            # destroy all current pathelements
            current_repo.path_elements.destroy_all
            return unless xml_hash['path'] || xml_hash['hostsystem']
      
      
      Severity: Minor
      Found in src/api/app/models/project/update_from_xml_command.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_flag has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

        def remove_flag(flag, repository, arch = nil)
          validate_type flag
          flaglist = flags.of_type(flag)
          arch = Architecture.find_by_name(arch) if arch
      
      
      Severity: Minor
      Found in src/api/app/helpers/flag_helper.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 expand_targets has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

        def expand_targets(ignore_build_state, ignore_delegate)
          expand_target_project if action_type == :submit && ignore_delegate.blank? && target_project.present?
      
          # empty submission protection
          if action_type.in?(%i[submit maintenance_incident]) && (target_package &&
      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 check_patchinfo has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

        def check_patchinfo(pkg)
          pkg.project.repositories.collect do |repo|
            firstarch = repo.architectures.first
            next unless firstarch
      
      
      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 request_command_diff has a Cognitive Complexity of 14 (exceeds 8 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

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

        def gather_exception_defaults(opt)
          if opt[:message]
            @summary = opt[:message].to_s
          elsif @exception
            @summary = @exception.message
      Severity: Minor
      Found in src/api/app/controllers/application_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 get_updateinfo_id has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

        def get_updateinfo_id(source_package, target_repo)
          return unless source_package.is_patchinfo?
      
          # check for patch name inside of _patchinfo file
          xml = Patchinfo.new.read_patchinfo_xmlhash(source_package)
      Severity: Minor
      Found in src/api/app/helpers/maintenance_helper.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 call has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring.
      Open

        def call
          github_client = Octokit::Client.new(access_token: @scm_token,
                                              api_endpoint: @event_subscription_payload[:api_endpoint])
          # https://docs.github.com/en/rest/reference/repos#create-a-commit-status
          github_client.create_status(@event_subscription_payload[:target_repository_full_name],
      Severity: Minor
      Found in src/api/app/services/github_status_reporter.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_register_update has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def _update_from_xml_register_update(rxml)
          rxml.elements('updates') do |u|
            update = {}
            product_update_repositories.each do |pu|
              next unless pu.repository # it may be remote or not yet exist
      Severity: Minor
      Found in src/api/app/models/product.rb - About 1 hr to fix

        Method new_release_request has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def new_release_request
            if params[:skiprequest]
              # FIXME2.3: do it directly here, api function missing
            else
              begin
        Severity: Minor
        Found in src/api/app/controllers/webui/project_controller.rb - About 1 hr to fix

          Method set_permissions_for_action has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def set_permissions_for_action(action, new_state = nil)
              # general write permission check on the target on accept
              @write_permission_in_this_action = false
          
              # all action types need a target project in any case for accept
          Severity: Minor
          Found in src/api/app/models/bs_request_permission_check.rb - About 1 hr to fix

            Method change_review_state has 30 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def change_review_state(new_review_state, opts = {})
                with_lock do
                  new_review_state = new_review_state.to_sym
            
                  raise InvalidStateError, 'request is not in a changeable state (new, review or declined)' unless state == :review || (state.in?(%i[new declined]) && new_review_state == :new)
            Severity: Minor
            Found in src/api/app/models/bs_request.rb - About 1 hr to fix

              Method new_tracker has 30 lines of code (exceeds 25 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 1 hr to fix
                Severity
                Category
                Status
                Source
                Language