Showing 336 of 425 total issues
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 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 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 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_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 _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 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)
Method load_from_xml
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_from_xml(patchinfo_xml)
self.binaries = []
patchinfo_xml.elements('binary').each do |binaries|
self.binaries << binaries
end
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 package_command
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def package_command
params[:user] = User.session!.login
raise MissingParameterError, 'POST request without given cmd parameter' unless params[:cmd]
Method default_reviewers
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def default_reviewers
reviews = []
return reviews unless target_project
tprj = Project.get_by_name(target_project)
Method call_diststats
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def call_diststats(bdep, jobs)
@timings = {}
@pngkey = Digest::MD5.hexdigest(params.to_s)
@rebuildtime = 0
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
- 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 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
- 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"