Showing 398 of 432 total issues
Method request_action_header
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def request_action_header(action, creator)
source_project_hash = { project: action[:sprj], package: action[:spkg], trim_to: nil }
description = case action[:type]
when :submit
Method request_command_diff
has 43 lines of code (exceeds 25 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}."
Method to_xml
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_xml(project, package)
self.issues = []
issueid.to_a.each_with_index do |new_issue, index|
issues << [
new_issue,
Method put_userinfo
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def put_userinfo
login = params[:login]
user = User.find_by_login(login) if login
unless ::Configuration.accounts_editable?(user)
Method change_state
has 41 lines of code (exceeds 25 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'
Method update
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
params[:user] = User.session!.login
begin
project = Project.get_by_name(@request_data['name'])
rescue Project::UnknownObjectError
Method notifiable_link_path
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def notifiable_link_path
case @notification.event_type
when 'Event::RequestStatechange', 'Event::RequestCreate', 'Event::ReviewWanted'
Rails.application.routes.url_helpers.request_show_path(@notification.notifiable.number, notification_id: @notification.id)
when 'Event::CommentForRequest'
Method branch_local_repositories
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def branch_local_repositories(project, pkg_to_enable, opts = {})
# shall we use the repositories from a different project?
project = project.update_instance_or_self('OBS', 'BranchRepositoriesFromProject')
skip_repos = []
a = project.find_attribute('OBS', 'BranchSkipRepositories')
Method binary_packages
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def binary_packages
check_package_access(params[:project], params[:package], false)
@pkg = Package.find_by_project_and_name(params[:project], params[:package])
begin
Method update_build_log
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_build_log
# Make sure objects don't contain invalid chars (eg. '../')
@repo = @project.repositories.find_by(name: params[:repository]).try(:name)
unless @repo
@errors = "Couldn't find repository '#{params[:repository]}'. We don't have build log for this repository"
Method evaluate_expr
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def evaluate_expr(expr, root, escape: false)
table = @base_table
a = []
until expr.empty?
token = expr.shift
Method parse_predicate
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def parse_predicate(root, stack)
# logger.debug "------------------ predicate ---------------"
# logger.debug "-- pred_array: #{stack.inspect} --"
raise IllegalXpathError, 'invalid predicate' if stack.nil?
Method parse_develproject
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
def parse_develproject(xmlhash)
project.develproject = nil
devel = xmlhash['devel']
if devel
prj_name = devel['project']
- Read upRead up
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 release_package
has a Cognitive Complexity of 16 (exceeds 8 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]
- Read upRead up
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_repository_by_product
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
def set_repository_by_product(flag, status, product_name, patchlevel = nil)
validate_type flag
prj = self
prj = project if is_a?(Package)
- Read upRead up
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 post_userinfo
has a Cognitive Complexity of 16 (exceeds 8 allowed). Consider refactoring. Open
def post_userinfo
authorize @user, :update?
login = params[:login]
# just for permission checking
- Read upRead up
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_pool
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _update_from_xml_register_pool(rxml)
rxml.elements('pool') do |u|
medium = {}
product_media.each do |pm|
key = "#{pm.repository.id}/#{pm.name}"
Method validate
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate(opt, content)
case opt
when String, Symbol
schema_file = opt.to_s
when Hash, ActiveSupport::HashWithIndifferentAccess
Method subscriptions
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def subscriptions(channel = :instant_email)
receivers_and_subscriptions = {}
event.class.receiver_roles.each do |receiver_role|
# Find the users/groups who are receivers for this event
Method render_xml
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_xml(opts = {})
builder = Nokogiri::XML::Builder.new
builder.request(id: number, creator: creator) do |r|
bs_request_actions.includes([:bs_request_action_accept_info]).find_each do |action|
action.render_xml(r)