File target_integrator.rb
has 440 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'active_support/core_ext/string/inflections'
require 'cocoapods/xcode/framework_paths'
require 'cocoapods/target/build_settings'
module Pod
Class TargetIntegrator
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class TargetIntegrator
autoload :XCConfigIntegrator, 'cocoapods/installer/user_project_integrator/target_integrator/xcconfig_integrator'
# @return [String] the string to use as prefix for every build phase added to the user project
#
Method update_on_demand_resources_build_settings
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def update_on_demand_resources_build_settings(native_target, category_to_tags)
%w[ON_DEMAND_RESOURCES_INITIAL_INSTALL_TAGS ON_DEMAND_RESOURCES_PREFETCH_ORDER].each do |category_key|
native_target.build_configurations.each do |c|
key = case category_key
when 'ON_DEMAND_RESOURCES_INITIAL_INSTALL_TAGS'
- 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_on_demand_resources
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_on_demand_resources(sandbox, project, native_targets, file_accessors, parent_odr_group,
target_odr_group_name)
category_to_tags = {}
file_accessors = Array(file_accessors)
native_targets = Array(native_targets)
Method reorder_script_phase
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def reorder_script_phase(native_target, script_phase, execution_position)
return if execution_position == :any || execution_position.to_s.empty?
target_phase_type = case execution_position
when :before_compile, :after_compile
Xcodeproj::Project::Object::PBXSourcesBuildPhase
Method create_or_update_user_script_phases
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_or_update_user_script_phases(script_phases, native_target)
script_phase_names = script_phases.map { |k| k[:name] }
# Delete script phases no longer present in the target.
native_target_script_phases = native_target.shell_script_build_phases.select do |bp|
!bp.name.nil? && bp.name.start_with?(USER_BUILD_PHASE_PREFIX)
Method update_on_demand_resources_build_settings
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update_on_demand_resources_build_settings(native_target, category_to_tags)
%w[ON_DEMAND_RESOURCES_INITIAL_INSTALL_TAGS ON_DEMAND_RESOURCES_PREFETCH_ORDER].each do |category_key|
native_target.build_configurations.each do |c|
key = case category_key
when 'ON_DEMAND_RESOURCES_INITIAL_INSTALL_TAGS'
Method reorder_script_phase
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def reorder_script_phase(native_target, script_phase, execution_position)
return if execution_position == :any || execution_position.to_s.empty?
target_phase_type = case execution_position
when :before_compile, :after_compile
Xcodeproj::Project::Object::PBXSourcesBuildPhase
- 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_or_update_shell_script_build_phase
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_or_update_shell_script_build_phase(native_target, script_phase_name, show_env_vars_in_log = '0')
build_phases = native_target.build_phases.grep(Xcodeproj::Project::Object::PBXShellScriptBuildPhase)
build_phases.find { |phase| phase.name && phase.name.end_with?(script_phase_name) }.tap { |p| p.name = script_phase_name if p } ||
native_target.project.new(Xcodeproj::Project::Object::PBXShellScriptBuildPhase).tap do |phase|
UI.message("Adding Build Phase '#{script_phase_name}' to project.") 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 update_on_demand_resources
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def update_on_demand_resources(sandbox, project, native_targets, file_accessors, parent_odr_group,
target_odr_group_name)
Method create_or_update_user_script_phases
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_or_update_user_script_phases(script_phases, native_target)
script_phase_names = script_phases.map { |k| k[:name] }
# Delete script phases no longer present in the target.
native_target_script_phases = native_target.shell_script_build_phases.select do |bp|
!bp.name.nil? && bp.name.start_with?(USER_BUILD_PHASE_PREFIX)
- 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_copy_resources_script_phase
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_copy_resources_script_phase
unless target.includes_resources?
native_targets.each do |native_target|
TargetIntegrator.remove_copy_resources_script_phase_from_target(native_target)
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 add_pods_library
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def add_pods_library
frameworks = user_project.frameworks_group
native_targets.each do |native_target|
build_phase = native_target.frameworks_build_phase
product_name = target.product_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 update_on_demand_resources
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update_on_demand_resources(sandbox, project, native_targets, file_accessors, parent_odr_group,
target_odr_group_name)
category_to_tags = {}
file_accessors = Array(file_accessors)
native_targets = Array(native_targets)
- 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"