Showing 336 of 431 total issues
Avoid deeply nested control flow statements. Confirmed
options[:methods] << :attrib_namespace_name unless options[:methods].include?(:attrib_namespace_name)
Avoid deeply nested control flow statements. Confirmed
p[:link_target_project] = p[:package].project unless params[:newinstance]
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?
- 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 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']
- 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_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
- 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
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)
Avoid deeply nested control flow statements. Confirmed
next if pkg2.nil? || @packages.pluck(:package).include?(pkg2) # avoid double instances
Avoid deeply nested control flow statements. Confirmed
self.makeoriginolder = true if tprj.attribs.find_by(attrib_type: at)
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
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
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
Method write_to_backend
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def write_to_backend
reset_cache
raise ArgumentError, 'no commit_user set' unless commit_user
raise InvalidParameterError, 'Project meta file can not be written via package model' if name == '_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 check_action_permission_source!
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def check_action_permission_source!
return unless source_project
sprj = Project.get_by_name(source_project)
raise UnknownProject, "Unknown source project #{source_project}" unless sprj
- 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
raise IllegalRequest, 'Maintenance requests accept only projects as target' if target_package
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
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 update_file
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def update_file
check_permissions_for_file
raise PutFileNoPermission, "Insufficient permissions to store file in package #{@package_name}, project #{@project_name}" unless @allowed
- 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
raise 'We should have expanded a target_project' unless target_project
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
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