Method create_expand_package
has a Cognitive Complexity of 176 (exceeds 8 allowed). Consider refactoring. Open
def create_expand_package(packages, opts = {})
newactions = []
incident_suffix = ''
# The maintenance ID is always the sub project name of the maintenance 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
Class BsRequestAction
has 65 methods (exceeds 20 allowed). Consider refactoring. Open
class BsRequestAction < ApplicationRecord
#### Includes and extends
include ParsePackageDiff
include BsRequestAction::Errors
#### Constants
Method create_expand_package
has 160 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_expand_package(packages, opts = {})
newactions = []
incident_suffix = ''
# The maintenance ID is always the sub project name of the maintenance project
Method check_action_permission!
has a Cognitive Complexity of 41 (exceeds 8 allowed). Consider refactoring. Open
def check_action_permission!(skip_source = nil)
# find objects if specified or report error
role = nil
sprj = nil
if person_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
Method default_reviewers
has a Cognitive Complexity of 29 (exceeds 8 allowed). Consider refactoring. Open
def default_reviewers
reviews = []
return reviews unless target_project
tprj = Project.get_by_name(target_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 store_from_xml
has a Cognitive Complexity of 26 (exceeds 8 allowed). Consider refactoring. Open
def store_from_xml(hash)
source = hash.delete('source')
if source
self.source_package = source.delete('package')
self.source_project = source.delete('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_target!
has a Cognitive Complexity of 24 (exceeds 8 allowed). Consider refactoring. Open
def check_action_permission_target!
return unless target_project
tprj = Project.get_by_name(target_project)
if tprj.is_a?(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 render_xml
has a Cognitive Complexity of 18 (exceeds 8 allowed). Consider refactoring. Open
def render_xml(builder)
builder.action(type: action_type) do |action|
render_xml_attributes(action)
if sourceupdate || updatelink || makeoriginolder
action.options do
- 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 store_from_xml
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def store_from_xml(hash)
source = hash.delete('source')
if source
self.source_package = source.delete('package')
self.source_project = source.delete('project')
Method check_sanity
has a Cognitive Complexity of 17 (exceeds 8 allowed). Consider refactoring. Open
def check_sanity
if action_type.in?(%i[submit release maintenance_incident maintenance_release change_devel])
errors.add(:source_project, "should not be empty for #{action_type} requests") if source_project.blank?
errors.add(:source_package, "should not be empty for #{action_type} requests") if !is_maintenance_incident? && source_package.blank?
errors.add(:target_project, "should not be empty for #{action_type} requests") if target_project.blank?
- 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 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 check_for_expand_errors!
has a Cognitive Complexity of 15 (exceeds 8 allowed). Consider refactoring. Open
def check_for_expand_errors!(add_revision)
return unless action_type.in?(%i[submit release maintenance_incident maintenance_release])
# validate that the sources are not broken
begin
- 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!
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_action_permission!(skip_source = nil)
# find objects if specified or report error
role = nil
sprj = nil
if person_name
Method check_action_permission_target!
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_action_permission_target!
return unless target_project
tprj = Project.get_by_name(target_project)
if tprj.is_a?(Project)
Method check_patchinfo
has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring. Open
def check_patchinfo(pkg)
pkg.project.repositories.collect do |repo|
firstarch = repo.architectures.first
next unless firstarch
- 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 expand_targets
has a Cognitive Complexity of 14 (exceeds 8 allowed). Consider refactoring. Open
def expand_targets(ignore_build_state, ignore_delegate)
expand_target_project if action_type == :submit && ignore_delegate.blank? && target_project.present?
# empty submission protection
if action_type.in?(%i[submit maintenance_incident]) && (target_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 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 'We should have expanded a target_project' unless target_project
Avoid deeply nested control flow statements. Confirmed
raise IllegalRequest, 'Maintenance requests accept only projects as target' if target_package
Avoid deeply nested control flow statements. Confirmed
self.makeoriginolder = true if tprj.attribs.find_by(attrib_type: at)
Avoid deeply nested control flow statements. Open
missing_ok_link = true if data_linkinfo['missingok']
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 source_access_check!
has a Cognitive Complexity of 10 (exceeds 8 allowed). Consider refactoring. Open
def source_access_check!
sp = Package.find_by_project_and_name(source_project, source_package)
if sp.nil?
# either not there or read permission problem
if Package.exists_on_backend?(source_package, source_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"