Showing 342 of 432 total issues
Avoid deeply nested control flow statements. Open
missing_ok_link = true if data_linkinfo['missingok']
Avoid deeply nested control flow statements. Confirmed
unless allowed
render_error status: 403, errorcode: 'execute_cmd_no_permission',
message: "No permission to execute command on package #{pack_name} in project #{prj.name}"
return
end
Method show
has a Cognitive Complexity of 11 (exceeds 8 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
- 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_read_access_of_deleted_package
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def validate_read_access_of_deleted_package(project, name)
prj = Project.get_by_name(project)
if prj.is_a?(Project)
raise Project::ReadAccessError, project.to_s if prj.disabled_for?('access', nil, nil)
raise Package::ReadSourceAccessError, "#{target_project_name}/#{target_package_name}" if prj.disabled_for?('sourceaccess', nil, nil)
- 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
Avoid deeply nested control flow statements. Confirmed
unless allowed
render_error status: 403, errorcode: 'execute_cmd_no_permission',
message: "No permission to execute command on package #{pack_name}"
return
end
Avoid deeply nested control flow statements. Confirmed
elsif r.instance_of?(Package)
next if reviews.any? { |a| a.by_project == r.project.name && a.by_package == r.name }
reviews.new(by_project: r.project.name, by_package: r.name, state: :new)
else
Method update_product_list
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def update_product_list
# short cut to ensure that no products are left over
unless is_product?
products.destroy_all
return
- 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
Avoid deeply nested control flow statements. Open
raise IncidentHasNoMaintenanceProject, 'incident projects shall only create below maintenance projects' unless prj.kind.in?(%w[maintenance maintenance_incident])
Method update_from_xml
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def update_from_xml(xmlhash, ignore_lock = nil)
check_write_access!(ignore_lock)
Package.transaction do
self.title = xmlhash.value('title')
- 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 find_assignees
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def find_assignees(binary_name)
projects = @rootproject.expand_all_projects
# binary search via all projects
data = Xmlhash.parse(Backend::Api::Search.binary(projects.map(&:name), binary_name))
- 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
Avoid deeply nested control flow statements. Confirmed
elsif @last_key && @attribs[table][@last_key][:double]
@condition_values_needed.times { @condition_values << [value, value] }
else
@condition_values_needed.times { @condition_values << value }
Method update
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def update
authorize @package, :update?
@patchinfo = Patchinfo.new(patchinfo_params)
if @patchinfo.valid?
xml = @patchinfo.to_xml(@project, @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
Avoid deeply nested control flow statements. Open
if qtype == :predicate
parse_predicate(root, stack[0])
stack.shift
elsif qtype.nil? || qtype == :qname
# just a plain existence test
Method build_query_from_hash
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def self.build_query_from_hash(hash, key_list = nil)
key_list ||= hash.keys
query = key_list.map do |key|
next unless hash.key?(key)
- 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
Avoid deeply nested control flow statements. Confirmed
target = if tpkg
Package.find_by_project_and_name(tprj, tpkg)
else
Project.find_by_name(tprj)
end
Avoid deeply nested control flow statements. Confirmed
target.add_maintainer(@bs_request.creator) if target.can_be_modified_by?(User.possibly_nobody)
Method rpmlint_result
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Confirmed
def rpmlint_result
@repo_arch_hash = {}
@buildresult = Buildresult.find_hashed(project: @project.to_param, package: @package.to_param, view: 'status')
repos = [] # Temp var
if @buildresult
- 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 involved_packages_and_projects
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def involved_packages_and_projects
involved_items = []
roles = roles_to_filter
involved_items.concat(involved_items_as_owner) if filter_by_owner?
- 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
Avoid deeply nested control flow statements. Open
raise IllegalXpathError, 'attributes must be $NAMESPACE:$NAME' if tvalues.size != 2
Method fileinfo_ext
has 6 arguments (exceeds 5 allowed). Consider refactoring. Open
def self.fileinfo_ext(project_name, package_name, repository, arch, filename, options = {})