openSUSE/open-build-service

View on GitHub

Showing 339 of 427 total issues

Method branch_copy_flags has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
Open

  def branch_copy_flags(project)
    # Copy the flags from the other project, adjusting them appropriately
    # for this one being a branch of it:
    #
    # - enable building
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 perform has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
Open

  def perform
    if semaphore.locked?
      Rails.logger.debug 'skip lastnotifications, still locked'
      return
    end
Severity: Minor
Found in src/api/app/models/update_notification_events.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 instantiate_container has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
Open

  def instantiate_container(project, opackage, opts = {})
    opkg = opackage.origin_container
    pkg_name = opkg_name = opkg.name
    if opkg.is_a?(Package) && opkg.project.is_maintenance_release?
      # strip incident suffix
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 check_for_expand_errors! has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
Open

  def check_for_expand_errors!(add_revision)
    return unless action_type.in?(%i[submit release maintenance_incident maintenance_release])

    # validate that the sources are not broken
    begin
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 start has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
Open

    def self.start(options = {})
      return unless Rails.env.test?
      return if @backend
      return if ENV['BACKEND_STARTED']

Severity: Minor
Found in src/api/app/lib/backend/test.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 rdiff has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring.
Open

  def rdiff
    @last_rev = @package.dir_hash['rev']
    @linkinfo = @package.linkinfo
    if params[:oproject]
      @oproject = ::Project.find_by_name(params[:oproject])
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

Method render_xml has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def render_xml
    builder = Nokogiri::XML::Builder.new
    builder.binary(render_attributes) do |binary|
      binary.operation(operation)

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

    Method check_action_permission! has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def check_action_permission!(skip_source = nil)
        # find objects if specified or report error
        role = nil
        sprj = nil
        if person_name
    Severity: Minor
    Found in src/api/app/models/bs_request_action.rb - About 1 hr to fix

      Method update has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def update
          @configuration = ::Configuration.fetch
      
          xml = Xmlhash.parse(request.raw_post) || {}
          attribs = {}
      Severity: Minor
      Found in src/api/app/controllers/configurations_controller.rb - About 1 hr to fix

        Method show has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def show
            project_name = params[:project]
            if params.key?(:deleted)
              unless Project.find_by_name(project_name) || Project.is_remote_project?(project_name)
                # project is deleted or not accessible
        Severity: Minor
        Found in src/api/app/controllers/source_project_controller.rb - About 1 hr to fix

          Method show has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def show
                  logger.info("Statistics for RebuildTimesController#show: #{User.possibly_nobody.login}")
                  @repository = params[:repository]
                  @arch = params[:arch]
                  @hosts = (params[:hosts] || 40).to_i
          Severity: Minor
          Found in src/api/app/controllers/webui/projects/rebuild_times_controller.rb - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                if Flipper.enabled?(:request_show_redesign, User.session)
                  @history_elements = @bs_request.history_elements.includes(:user)
                  @active_tab = 'conversation'
                  render :beta_show
                else
            Severity: Critical
            Found in src/api/app/controllers/webui/request_controller.rb - About 1 hr to fix

              Method update_from_xml has 33 lines of code (exceeds 25 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

                Method build has 33 lines of code (exceeds 25 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

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

                    def check_action_permission_target!
                      return unless target_project
                  
                      tprj = Project.get_by_name(target_project)
                      if tprj.is_a?(Project)
                  Severity: Minor
                  Found in src/api/app/models/bs_request_action.rb - About 1 hr to fix

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

                      def release_package(source_package, target, target_package_name, opts = {})
                        filter_source_repository = opts[:filter_source_repository]
                        filter_architecture      = opts[:filter_architecture]
                        multibuild_container     = opts[:multibuild_container]
                        action                   = opts[:action]
                    Severity: Minor
                    Found in src/api/app/helpers/maintenance_helper.rb - About 1 hr to fix

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

                        def find_changed_issues
                          # no expand=1, so only branches are tracked
                          query = { cmd: :diff, orev: 0, onlyissues: 1, linkrev: :base, view: :xml }
                          issue_change = parse_issues_xml(query, 'kept')
                          # issues introduced by local changes
                      Severity: Minor
                      Found in src/api/app/models/package.rb - About 1 hr to fix

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

                            Severity
                            Category
                            Status
                            Source
                            Language