Showing 339 of 429 total issues
Method statistic
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def statistic
result = backend_statistics
return if result.blank?
disk = result.dig('disk', 'usage')
Method update_generic_relationships
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_generic_relationships(xmlhash)
# we remember the current relationships in a hash
cache = {}
relationships.each do |purr|
next if @updater.ignore?(purr)
Method extend_packages_to_link
has 27 lines of code (exceeds 25 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?
Method create_events
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_events
Event::Base.transaction do
data = type = nil
@last.elements('notification') do |e|
type = e['type']
Method forward
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def forward
forward_object = nil
target_package_object = Package.find_by_project_and_name(target_project, target_package)
if target_package_object
Method has_local_permission?
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def has_local_permission?(perm_string, object)
roles = Role.ids_with_permission(perm_string)
return false unless roles
parent = nil
Method description_text
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def description_text
case @notification.event_type
when 'Event::RequestStatechange', 'Event::RequestCreate', 'Event::ReviewWanted', 'Event::CommentForRequest'
BsRequestActionSourceAndTargetComponent.new(bs_request).call
when 'Event::CommentForProject'
Method run
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run(xmlhash, force = nil)
project.check_write_access!
# check for raising read access permissions, which can't get ensured atm
raise ForbiddenError if !(project.new_record? || project.disabled_for?('access', nil, nil)) && (FlagHelper.xml_disabled_for?(xmlhash, 'access') && !User.admin_session?)
Method branch_remote_repositories
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def branch_remote_repositories(project)
remote_project = Project.new(name: project)
remote_project_meta = Nokogiri::XML(remote_project.meta.content, &:strict)
local_project_meta = Nokogiri::XML(render_xml, &:strict)
Method resample
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.resample(values, samples = 400)
values.sort_by! { |a| a[0] }
result = []
return result if values.empty?
Method release_package_create_main_package
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def release_package_create_main_package(request, source_package, target_package_name, target_project)
base_package_name = target_package_name.gsub(/\.[^.]*$/, '')
# only if package does not contain a _patchinfo file
lpkg = nil
Method index
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def index
if request.post? && !params[:project].nil? && Project.valid_name?(params[:project])
redirect_to project: params[:project]
else
begin
Method create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
authorize @package, :update?
files = params[:files] || []
filename = params[:filename]
Method forbidden_project_ids
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def self.forbidden_project_ids
# Admins don't have forbidden projects
return [0] if User.admin_session?
# This will cache and return a hash like this:
- 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 create_events
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def create_events
Event::Base.transaction do
data = type = nil
@last.elements('notification') do |e|
type = e['type']
- 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_jobhistory
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def update_jobhistory(proj, mypackages)
prjpacks = {}
dname = proj.name
mypackages.each_value do |package|
prjpacks[package.name] = package if package.project == dname
- 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 obsolete_reviews
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def obsolete_reviews(opts)
return false unless opts[:by_user] || opts[:by_group] || opts[:by_project] || opts[:by_package]
reviews.each do |review|
next unless review.reviewable_by?(opts)
- 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 validate_repository_xml_attribute
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def validate_repository_xml_attribute(request_data, project_name)
# Check used repo pathes for existence and read access permissions
request_data.elements('repository') do |repository|
repository.elements('path') do |element|
# permissions check
- 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_flags
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def set_flags
ActiveRecord::Base.transaction do
objects_to_store = Set.new
flags.each do |flag|
main_object = project_or_package(flag)
- 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 import_channel
has a Cognitive Complexity of 12 (exceeds 8 allowed). Consider refactoring. Open
def import_channel(channel, pkg, target_repo = nil)
channel = REXML::Document.new(channel)
channel.elements['/channel'].add_element 'target', 'project' => target_repo.project.name, 'repository' => target_repo.name if target_repo
- 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"