File pod_target_installer.rb
has 779 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'active_support/core_ext/array'
require 'active_support/core_ext/string/inflections'
require 'cocoapods/xcode'
module Pod
Method install!
has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring. Open
def install!
UI.message "- Installing target `#{target.name}` #{target.platform}" do
create_support_files_dir
library_file_accessors = target.file_accessors.select { |fa| fa.spec.library_specification? }
test_file_accessors = target.file_accessors.select { |fa| fa.spec.test_specification? }
- 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 PodTargetInstaller
has 45 methods (exceeds 20 allowed). Consider refactoring. Open
class PodTargetInstaller < TargetInstaller
require 'cocoapods/installer/xcode/pods_project_generator/app_host_installer'
# @return [Array<Pathname>] Array of umbrella header paths in the headers directory
#
Method install!
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
def install!
UI.message "- Installing target `#{target.name}` #{target.platform}" do
create_support_files_dir
library_file_accessors = target.file_accessors.select { |fa| fa.spec.library_specification? }
test_file_accessors = target.file_accessors.select { |fa| fa.spec.test_specification? }
Method add_resources_bundle_targets
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def add_resources_bundle_targets(file_accessors)
file_accessors.each_with_object({}) do |file_accessor, hash|
hash[file_accessor.spec.name] = file_accessor.resource_bundles.map do |bundle_name, paths|
label = target.resources_bundle_target_label(bundle_name)
resource_bundle_target = project.new_resources_bundle(label, file_accessor.spec_consumer.platform_name, nil, bundle_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 validate_xcframeworks
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def validate_xcframeworks
target.xcframeworks.each_value do |xcframeworks|
xcframeworks.each do |xcframework|
if xcframework.slices.empty?
raise Informative, "Unable to install vendored xcframework `#{xcframework.name}` for Pod `#{target.label}` because it does not contain any binaries."
- 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 add_files_to_build_phases
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def add_files_to_build_phases(library_native_target, test_native_targets, app_native_targets)
target.file_accessors.each do |file_accessor|
consumer = file_accessor.spec_consumer
native_target = case consumer.spec.spec_type
- 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 add_header
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def add_header(file_accessor, build_file, public_headers, project_headers, private_headers, native_target)
file_ref = build_file.file_ref
acl = if !target.build_as_framework? # Headers are already rooted at ${PODS_ROOT}/Headers/P*/[pod]/...
'Project'
elsif public_headers.include?(file_ref.real_path)
- 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 add_files_to_build_phases
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_files_to_build_phases(library_native_target, test_native_targets, app_native_targets)
target.file_accessors.each do |file_accessor|
consumer = file_accessor.spec_consumer
native_target = case consumer.spec.spec_type
Method add_test_targets
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_test_targets
target.test_specs.map do |test_spec|
spec_consumer = test_spec.consumer(target.platform)
test_type = spec_consumer.test_type
product_type = target.product_type_for_test_type(test_type)
- 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 add_app_targets
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_app_targets
target.app_specs.each_with_object({}) do |app_spec, hash|
spec_consumer = app_spec.consumer(target.platform)
spec_name = app_spec.parent.name
subspec_name = target.subspec_label(app_spec)
- 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 add_app_targets
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_app_targets
target.app_specs.each_with_object({}) do |app_spec, hash|
spec_consumer = app_spec.consumer(target.platform)
spec_name = app_spec.parent.name
subspec_name = target.subspec_label(app_spec)
Method add_test_targets
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_test_targets
target.test_specs.map do |test_spec|
spec_consumer = test_spec.consumer(target.platform)
test_type = spec_consumer.test_type
product_type = target.product_type_for_test_type(test_type)
Method add_resources_bundle_targets
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_resources_bundle_targets(file_accessors)
file_accessors.each_with_object({}) do |file_accessor, hash|
hash[file_accessor.spec.name] = file_accessor.resource_bundles.map do |bundle_name, paths|
label = target.resources_bundle_target_label(bundle_name)
resource_bundle_target = project.new_resources_bundle(label, file_accessor.spec_consumer.platform_name, nil, bundle_name)
Method add_header
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def add_header(file_accessor, build_file, public_headers, project_headers, private_headers, native_target)
file_ref = build_file.file_ref
acl = if !target.build_as_framework? # Headers are already rooted at ${PODS_ROOT}/Headers/P*/[pod]/...
'Project'
elsif public_headers.include?(file_ref.real_path)
Method validate_xcframeworks
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def validate_xcframeworks
target.xcframeworks.each_value do |xcframeworks|
xcframeworks.each do |xcframework|
if xcframework.slices.empty?
raise Informative, "Unable to install vendored xcframework `#{xcframework.name}` for Pod `#{target.label}` because it does not contain any binaries."
Method create_app_target_embed_frameworks_script
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_app_target_embed_frameworks_script(app_spec)
path = target.embed_frameworks_script_path_for_spec(app_spec)
framework_paths_by_config = target.user_build_configurations.each_with_object({}) do |(config_name, config), paths_by_config|
paths_by_config[config_name] = target.dependent_targets_for_app_spec(app_spec, :configuration => config).flat_map do |pod_target|
spec_paths_to_include = pod_target.library_specs.map(&: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 create_test_target_embed_frameworks_script
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def create_test_target_embed_frameworks_script(test_spec)
path = target.embed_frameworks_script_path_for_spec(test_spec)
host_target_spec_names = target.app_host_dependent_targets_for_spec(test_spec).flat_map do |pt|
pt.specs.map(&:name)
end.uniq
- 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 add_header
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_header(file_accessor, build_file, public_headers, project_headers, private_headers, native_target)
Method compiler_flags_for_consumer
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def compiler_flags_for_consumer(consumer, arc, language)
flags = consumer.compiler_flags.dup
if !arc && language == :objc
flags << '-fno-objc-arc'
else
- 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 create_module_map
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_module_map(native_target)
return super(native_target) unless custom_module_map
path = target.module_map_path_to_write
UI.message "- Copying module map file to #{UI.path(path)}" 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 filter_resource_file_references
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def filter_resource_file_references(resource_file_references)
file_references = resource_file_references.map do |resource_file_reference|
ref = project.reference_for_path(resource_file_reference)
# Some nested files are not directly present in the Xcode project, such as the contents
- 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 info_plist_bundle_id
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def info_plist_bundle_id
return @plist_bundle_id if defined?(@plist_bundle_id)
unless target.info_plist_entries.nil?
@plist_bundle_id = target.info_plist_entries['CFBundleIdentifier']
unless @plist_bundle_id.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 project_file_references_array
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def project_file_references_array(files, file_type)
error_message_for_missing_reference = lambda do |sf, target|
"Unable to find #{file_type} ref for `#{sf.basename}` for target `#{target.name}`."
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
framework_paths_by_config = target.user_build_configurations.each_with_object({}) do |(config_name, config), paths_by_config|
paths_by_config[config_name] = target.dependent_targets_for_test_spec(test_spec, :configuration => config).flat_map do |pod_target|
spec_paths_to_include = pod_target.library_specs.map(&:name)
spec_paths_to_include -= host_target_spec_names
spec_paths_to_include << test_spec.name if pod_target == target
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 47.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
xcframeworks_by_config = target.user_build_configurations.each_with_object({}) do |(config_name, config), paths_by_config|
paths_by_config[config_name] = target.dependent_targets_for_test_spec(test_spec, :configuration => config).flat_map do |pod_target|
spec_paths_to_include = pod_target.library_specs.map(&:name)
spec_paths_to_include -= host_target_spec_names
spec_paths_to_include << test_spec.name if pod_target == target
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 47.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
framework_paths_by_config = target.user_build_configurations.each_with_object({}) do |(config_name, config), paths_by_config|
paths_by_config[config_name] = target.dependent_targets_for_app_spec(app_spec, :configuration => config).flat_map do |pod_target|
spec_paths_to_include = pod_target.library_specs.map(&:name)
spec_paths_to_include << app_spec.name if pod_target == target
pod_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact.uniq
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 43.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
xcframeworks_by_config = target.user_build_configurations.each_with_object({}) do |(config_name, config), paths_by_config|
paths_by_config[config_name] = target.dependent_targets_for_app_spec(app_spec, :configuration => config).flat_map do |pod_target|
spec_paths_to_include = pod_target.library_specs.map(&:name)
spec_paths_to_include << app_spec.name if pod_target == target
pod_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact.uniq
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 43.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76