openSUSE/open-build-service

View on GitHub

Showing 333 of 429 total issues

Avoid deeply nested control flow statements.
Confirmed

          p[:link_target_project] = p[:package].project unless params[:newinstance]
Severity: Minor
Found in src/api/app/models/branch_package.rb - About 45 mins to fix

    Method can_be_unlocked? has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
    Open

      def can_be_unlocked?(with_exception = true)
        if is_maintenance_incident?
          requests = BsRequest.where(state: %i[new review declined]).joins(:bs_request_actions)
          maintenance_release_requests = requests.where(bs_request_actions: { type: 'maintenance_release', source_project: name })
          if maintenance_release_requests.exists?
    Severity: Minor
    Found in src/api/app/models/project.rb - About 45 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

    Avoid deeply nested control flow statements.
    Confirmed

              options[:methods] << :attrib_namespace_name unless options[:methods].include?(:attrib_namespace_name)
    Severity: Minor
    Found in src/api/app/models/attrib_type.rb - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

              if prj.is_a?(Project) && prj.find_attribute('OBS', 'BranchTarget')
                @copy_from_devel = true
              elsif pkg
                prj = pkg.project
                tpkg_name ||= pkg.releasename
      Severity: Minor
      Found in src/api/app/models/branch_package.rb - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Confirmed

                  package_hash[:link_target_project] = update_pkg_via_devel_project.project if !link_target_project_valid? && !@copy_from_devel
        Severity: Minor
        Found in src/api/app/models/branch_package/check_for_update.rb - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Confirmed

                    p[:target_package] = params[:target_package] if params[:target_package]
          Severity: Minor
          Found in src/api/app/models/branch_package.rb - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Confirmed

                      next if pkg2.nil? || @packages.pluck(:package).include?(pkg2) # avoid double instances
            Severity: Minor
            Found in src/api/app/models/branch_package.rb - About 45 mins to fix

              Method package_existence_consistency_check has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
              Open

                def package_existence_consistency_check(project, fix = false)
                  begin
                    project.reload
                  rescue ActiveRecord::RecordNotFound
                    # project disappeared ... may happen in running system
              Severity: Minor
              Found in src/api/app/jobs/consistency_check_job.rb - About 45 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

              Avoid deeply nested control flow statements.
              Confirmed

                      raise NotMissingError, "Branch call with missingok parameter but branched source (#{params[:project]}/#{params[:package]}) exists." if Package.exists_by_project_and_name(params[:project], params[:package],
                                                                                                                                                                                                allow_remote_packages: true)
              Severity: Minor
              Found in src/api/app/models/branch_package.rb - About 45 mins to fix

                Method update_patchinfo has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                Open

                  def update_patchinfo(project, patchinfo, opts = {})
                    project.check_write_access!
                    @patchinfo = patchinfo
                
                    opts[:enfore_issue_update] ||= false
                Severity: Minor
                Found in src/api/app/models/patchinfo.rb - About 45 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

                Avoid deeply nested control flow statements.
                Confirmed

                        elsif options[:methods] != :attrib_namespace_name
                          options[:methods] = [options[:methods]] + [:attrib_namespace_name]
                Severity: Minor
                Found in src/api/app/models/attrib_type.rb - About 45 mins to fix

                  Method clone_repository_from has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                  Open

                    def clone_repository_from(source_repository)
                      source_repository.repository_architectures.each do |ra|
                        repository_architectures.create(architecture: ra.architecture, position: ra.position)
                      end
                  
                  
                  Severity: Minor
                  Found in src/api/app/models/repository.rb - About 45 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

                  Avoid deeply nested control flow statements.
                  Confirmed

                          if r.by_package
                            pkg = Package.find_by_project_and_name(r.by_project, r.by_package)
                            return true if pkg && user.can_modify?(pkg)
                          else
                            prj = Project.find_by_name(r.by_project)
                  Severity: Minor
                  Found in src/api/app/models/bs_request.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Confirmed

                              ltprj = pkg2.project if ltprj.find_attribute('OBS', 'BranchTarget').nil?
                    Severity: Minor
                    Found in src/api/app/models/branch_package.rb - About 45 mins to fix

                      Method query has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                      Open

                            def query
                              query = {}
                              query[:view] = :xml if options[:view].to_s == 'xml'
                              query[:withissues] = 1 if options[:withissues].present?
                              if options[:nodiff].present?
                      Severity: Minor
                      Found in src/api/app/models/bs_request_action/differ/for_source.rb - About 45 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 call has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                      Open

                        def call(options)
                          set_triggered_at
                          @scm_webhook = options[:scm_webhook]
                          workflow_run = options[:workflow_run]
                          raise Token::Errors::MissingPayload, 'A payload is required' if @scm_webhook.payload.blank?
                      Severity: Minor
                      Found in src/api/app/models/token/workflow.rb - About 45 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 parse_single_bugzilla_issue has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                      Open

                        def parse_single_bugzilla_issue(bugzilla_response)
                          issue = Issue.find_by_name_and_tracker(bugzilla_response['id'].to_s, name)
                          return unless issue
                      
                          issue.state = if bugzilla_response['is_open']
                      Severity: Minor
                      Found in src/api/app/models/issue_tracker.rb - About 45 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

                      Avoid deeply nested control flow statements.
                      Confirmed

                            if Package.exists_by_project_and_name(incident_project.name, source_package, follow_project_links: false)
                              new_pkg = Package.get_by_project_and_name(incident_project.name, source_package, use_source: false, follow_project_links: false)
                            else
                              new_pkg = Package.new(name: source_package, title: pkg.title, description: pkg.description)
                              incident_project.packages << new_pkg
                      Severity: Minor
                      Found in src/api/app/models/bs_request_action_maintenance_incident.rb - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Confirmed

                                  if action[:forward]
                                    action[:forward].each do |forward|
                                      if forward[:project] == lprj && forward[:package] == lpkg
                                        link_is_already_devel = true
                                        break
                        Severity: Minor
                        Found in src/api/app/models/bs_request.rb - About 45 mins to fix

                          Method obj_roles has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
                          Open

                              def obj_roles(obj, role)
                                # old/deleted obj
                                return [] unless obj || role.blank?
                          
                                rel = obj.relationships.where(role: Role.hashed[role])
                          Severity: Minor
                          Found in src/api/app/models/event/base.rb - About 45 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

                          Severity
                          Category
                          Status
                          Source
                          Language