openSUSE/open-build-service

View on GitHub

Showing 398 of 432 total issues

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

  def internal_register
    if ::Configuration.ldap_enabled?
      render_error(
        status: 403,
        errorcode: 'permission_denied',
Severity: Minor
Found in src/api/app/controllers/person_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 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

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

  def changerequest
    changestate = (%w[accepted declined revoked new] & params.keys).last

    if change_state(changestate, params)
      # TODO: Make this work for each submit action individually
Severity: Minor
Found in src/api/app/controllers/webui/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 determine_details_about_package_to_branch has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def determine_details_about_package_to_branch(p)
    return unless p[:link_target_project].is_a?(Project) # only for local source projects

    check_for_update_project(p) unless params[:ignoredevel]

Severity: Minor
Found in src/api/app/models/branch_package.rb - About 1 hr to fix

    Method store_from_xml has 46 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def store_from_xml(hash)
        source = hash.delete('source')
        if source
          self.source_package = source.delete('package')
          self.source_project = source.delete('project')
    Severity: Minor
    Found in src/api/app/models/bs_request_action.rb - About 1 hr to fix

      Method _update_from_xml_binary_lists has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
      Open

        def _update_from_xml_binary_lists(xmlhash)
          # sync binary lists
          hasharray = []
          xmlhash.elements('binaries').each do |p|
            repository = nil
      Severity: Minor
      Found in src/api/app/models/channel.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 cmd_changereviewstate_permissions has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
      Open

        def cmd_changereviewstate_permissions(opts)
          # Basic validations of given parameters
          by_user = User.find_by_login!(opts[:by_user]) if opts[:by_user]
          by_group = Group.find_by_title!(opts[:by_group]) if opts[:by_group]
          if opts[:by_project] && opts[:by_package]
      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 extra_permissions_check_changestate has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
      Open

        def extra_permissions_check_changestate
          err =
            case opts[:newstate]
            when 'superseded'
              # Is the user involved in any project or package ?
      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 update_from_xml has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
      Open

        def update_from_xml(xmlhash)
          with_lock do
            self.email = xmlhash.value('email')
          end
          save!
      Severity: Minor
      Found in src/api/app/models/group.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_repositories has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
      Open

          def remove_repositories(repositories, opts = {})
            deleted_repository = Repository.deleted_instance
      
            repositories.each do |repo|
              linking_repositories = repo.linking_repositories
      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 check_sanity has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
      Open

        def check_sanity
          if action_type.in?(%i[submit release maintenance_incident maintenance_release change_devel])
            errors.add(:source_project, "should not be empty for #{action_type} requests") if source_project.blank?
            errors.add(:source_package, "should not be empty for #{action_type} requests") if !is_maintenance_incident? && source_package.blank?
            errors.add(:target_project, "should not be empty for #{action_type} requests") if target_project.blank?
      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 package_command_release has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
      Open

        def package_command_release
          pkg = Package.get_by_project_and_name(params[:project], params[:package], follow_project_links: false, follow_multibuild: true)
          multibuild_container = nil
          multibuild_container = params[:package].gsub(/^.*:/, '') if params[:package].include?(':') && !params[:package].starts_with?('_product:')
      
      
      Severity: Minor
      Found in src/api/app/controllers/source_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 delete_on_backend has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
      Open

        def delete_on_backend
          # lock this package object to avoid that dependend objects get created in parallel
          # for example a backend_package
          reload(lock: true)
      
      
      Severity: Minor
      Found in src/api/app/models/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 update has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
      Open

        def update
          @configuration = ::Configuration.first
      
          xml = Xmlhash.parse(request.raw_post) || {}
          attribs = {}
      Severity: Minor
      Found in src/api/app/controllers/configurations_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 set_file_details has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring.
      Open

        def set_file_details
          @forced_unexpand ||= ''
      
          # check source access
          @files = []
      Severity: Minor
      Found in src/api/app/controllers/webui/package_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

      Severity
      Category
      Status
      Source
      Language