Method cleanup_before_destroy
has a Cognitive Complexity of 25 (exceeds 8 allowed). Consider refactoring. Open
def cleanup_before_destroy
# change all linking repository pathes
linking_repositories.each do |lrep|
lrep.path_elements.includes(:link, :repository).find_each do |pe|
next unless pe.link == self # this is not pointing to our 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"
Further reading
Class Repository
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class Repository < ApplicationRecord
include StatusCheckable
belongs_to :project, foreign_key: :db_project_id, inverse_of: :repositories
Method cleanup_before_destroy
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cleanup_before_destroy
# change all linking repository pathes
linking_repositories.each do |lrep|
lrep.path_elements.includes(:link, :repository).find_each do |pe|
next unless pe.link == self # this is not pointing to our repo
Method clone_repository_from
has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring. Open
def clone_repository_from(source_repository)
source_repository.repository_architectures.each do |ra|
repository_architectures.create(architecture: ra.architecture, position: ra.position)
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"
Further reading
Method check_valid_release_target!
has a Cognitive Complexity of 9 (exceeds 8 allowed). Consider refactoring. Open
def check_valid_release_target!(target_repository, architecture_filter = nil)
# first architecture must be the same
# not using "architectures" here becasue the position is critical
unless repository_architectures.first.architecture == target_repository.repository_architectures.first.architecture
raise ArchitectureOrderMissmatch, "Repository '#{name}' and releasetarget " \
- 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"