lib/cocoapods/installer/project_cache/project_cache_analyzer.rb
Method analyze
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def analyze
target_by_label = Hash[(pod_targets + aggregate_targets).map { |target| [target.label, target] }]
cache_key_by_target_label = create_cache_key_mappings(target_by_label)
full_install_results = ProjectCacheAnalysisResult.new(pod_targets, aggregate_targets, cache_key_by_target_label,
Method initialize
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def initialize(sandbox, cache, build_configurations, project_object_version, podfile_plugins, pod_targets, aggregate_targets, installation_options,
clean_install: false)
Method analyze
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
Open
def analyze
target_by_label = Hash[(pod_targets + aggregate_targets).map { |target| [target.label, target] }]
cache_key_by_target_label = create_cache_key_mappings(target_by_label)
full_install_results = ProjectCacheAnalysisResult.new(pod_targets, aggregate_targets, cache_key_by_target_label,
- 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 compute_changed_targets_from_cache
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def compute_changed_targets_from_cache(cache_key_by_target_label, target_by_label, cache)
cache_key_by_target_label.each_with_object([]) do |(label, cache_key), changed_targets|
next unless cache.cache_key_by_target_label[label]
if cache_key.key_difference(cache.cache_key_by_target_label[label]) == :project
changed_targets << target_by_label[label]
- 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"