Method handle_resolver_error
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def handle_resolver_error(error)
message = error.message
type = Informative
unless specs_updated?
specs_update_message = "\n * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`."
- 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
File resolver.rb
has 317 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'molinillo'
require 'cocoapods/podfile'
module Pod
class NoSpecFoundError < Informative
Class Resolver
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class Resolver
require 'cocoapods/resolver/lazy_specification'
require 'cocoapods/resolver/resolver_specification'
# @return [Sandbox] the Sandbox used by the resolver to find external
Method handle_resolver_error
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def handle_resolver_error(error)
message = error.message
type = Informative
unless specs_updated?
specs_update_message = "\n * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`."
Method valid_possibility_version_for_root_name?
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def valid_possibility_version_for_root_name?(requirement, activated, spec)
return true if prerelease_requirement = requirement.prerelease? || requirement.external_source || !spec.version.prerelease?
activated.each do |vertex|
next unless vertex.payload
- 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 sort_dependencies
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def sort_dependencies(dependencies, activated, conflicts)
dependencies.sort_by! do |dependency|
name = name_for(dependency)
[
activated.vertex_named(name).payload ? 0 : 1,
- 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 spec_is_platform_compatible?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def spec_is_platform_compatible?(dependency_graph, dependency, spec)
# This is safe since a pod will only be in locked dependencies if we're
# using the same exact version
return true if locked_dependencies.vertex_named(spec.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 resolver_specs_by_target
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def resolver_specs_by_target
@resolver_specs_by_target ||= {}.tap do |resolver_specs_by_target|
@podfile_dependency_cache.target_definition_list.each do |target|
next if target.abstract? && !target.platform
Consider simplifying this complex logical expression. Open
elsif !conflict.possibility && conflict.locked_requirement && conflict.locked_requirement.external_source && conflict.locked_requirement.external_source[:podspec] &&
conflict.requirement && conflict.requirement.external_source && conflict.requirement.external_source[:podspec]
# The internal version of the Podspec doesn't match the external definition of a podspec
o << "\nIt seems like you've changed the version of the dependency `#{name}` " \
"and it differs from the version stored in `Pods/Local Podspecs`.\nYou should run `pod update #{name} --no-repo-update` to apply " \
Avoid deeply nested control flow statements. Open
dependencies = conflicts.count == 1 ? 'dependency' : 'dependencies'
Method initialize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(sandbox, podfile, locked_dependencies, sources, specs_updated,
podfile_dependency_cache: Installer::Analyzer::PodfileDependencyCache.from_podfile(podfile),
sources_manager: Config.instance.sources_manager)
Method resolve
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def resolve
dependencies = @podfile_dependency_cache.target_definition_list.flat_map do |target|
@podfile_dependency_cache.target_definition_dependencies(target).each do |dep|
next unless target.platform
@platforms_by_dependency[dep].push(target.platform)
- 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 requirement_satisfied_by?
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def requirement_satisfied_by?(requirement, activated, spec)
version = spec.version
return false unless requirement.requirement.satisfied_by?(version)
return false unless valid_possibility_version_for_root_name?(requirement, activated, spec)
return false unless spec_is_platform_compatible?(activated, requirement, 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 validate_platform
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def validate_platform(spec, target)
return unless target_platform = target.platform
return unless @validated_platforms.add?([spec.object_id, target_platform])
unless spec.available_platforms.any? { |p| target_platform.to_sym == p.to_sym }
raise Informative, "The platform of the target `#{target.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"