CocoaPods/CocoaPods

View on GitHub

Showing 310 of 310 total issues

File file_accessor.rb has 274 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'cocoapods/xcode/linkage_analyzer'

module Pod
  class Sandbox
    # Resolves the file patterns of a specification against its root directory,
Severity: Minor
Found in lib/cocoapods/sandbox/file_accessor.rb - About 2 hrs to fix

    Method analyze_host_targets_in_podfile has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def analyze_host_targets_in_podfile(aggregate_targets, embedded_aggregate_targets)
            target_definitions_by_uuid = {}
            cli_host_with_dynamic_linkage = []
            cli_product_type = 'com.apple.product-type.tool'
            # Collect aggregate target definitions by uuid to later lookup host target
    Severity: Major
    Found in lib/cocoapods/installer/analyzer.rb - About 2 hrs to fix

      Method group_for_path_in_group has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
      Open

          def group_for_path_in_group(absolute_pathname, group, reflect_file_system_structure, base_path = nil)
            unless absolute_pathname.absolute?
              raise ArgumentError, "Paths must be absolute #{absolute_pathname}"
            end
            unless base_path.nil? || base_path.absolute?
      Severity: Minor
      Found in lib/cocoapods/project.rb - About 2 hrs to fix

      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_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'
      Severity: Minor
      Found in lib/cocoapods/installer/user_project_integrator/target_integrator.rb - About 2 hrs to fix

      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

      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 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`."
      Severity: Major
      Found in lib/cocoapods/resolver.rb - About 2 hrs to fix

        File aggregate_target.rb has 266 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'cocoapods/xcode/framework_paths'
        require 'cocoapods/xcode/xcframework'
        
        module Pod
          # Stores the information relative to the target used to cluster the targets
        Severity: Minor
        Found in lib/cocoapods/target/aggregate_target.rb - About 2 hrs to fix

          Class Project has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Project < Xcodeproj::Project
              # @return [PBXGroup] The group for the support files of the aggregate
              #         targets.
              #
              attr_reader :support_files_group
          Severity: Minor
          Found in lib/cocoapods/project.rb - About 2 hrs to fix

            Method test_pod has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                def test_pod
                  if !xcodebuild_available?
                    UI.warn "Skipping test validation with `xcodebuild` because it can't be found.\n".yellow
                  else
                    UI.message "\nTesting with `xcodebuild`.\n".yellow do
            Severity: Minor
            Found in lib/cocoapods/validator.rb - About 2 hrs to fix

            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 embedded_target_pod_targets_by_host has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                  def embedded_target_pod_targets_by_host(aggregate_target, embedded_aggregate_targets, libraries_only)
                    return {} if aggregate_target.requires_host_target?
                    aggregate_user_target_uuids = Set.new(aggregate_target.user_targets.map(&:uuid))
                    embedded_pod_targets_by_build_config = Hash.new([].freeze)
                    embedded_aggregate_targets.each do |embedded_aggregate_target|
            Severity: Minor
            Found in lib/cocoapods/installer/analyzer.rb - About 2 hrs to fix

            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 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
            Severity: Minor
            Found in lib/cocoapods/resolver.rb - About 2 hrs to fix

            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 verify_swift_pods_have_module_dependencies has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                    def verify_swift_pods_have_module_dependencies
                      error_messages = []
                      pod_targets.each do |pod_target|
                        next unless pod_target.uses_swift? && pod_target.should_build?
            
            
            Severity: Minor
            Found in lib/cocoapods/installer/xcode/target_validator.rb - About 2 hrs to fix

            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 prepare has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
            Open

                    def prepare(sandbox, project, pod_targets, build_configurations, platforms, podfile_path)
                      UI.message "- Creating #{project.project_name} project" do
                        build_configurations.each do |name, type|
                          project.add_build_configuration(name, type)
                        end

            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)

            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 configure_schemes_for_pod_target has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                    def configure_schemes_for_pod_target(project, pod_target, share_scheme, generator_result)
                      # Ignore subspecs because they do not provide a scheme configuration due to the fact that they are always
                      # merged with the root spec scheme.
                      specs = [pod_target.root_spec] + pod_target.test_specs + pod_target.app_specs
                      hosted_test_specs_by_host = Hash.new do |hash, key|
            Severity: Minor
            Found in lib/cocoapods/installer/xcode/pods_project_generator.rb - About 2 hrs to fix

            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 write! has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                    def write!
                      cleanup_projects(projects)
            
                      projects.each do |project|
                        library_product_types = [:framework, :dynamic_library, :static_library]

            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 wire_test_native_target_app_host has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
            Open

                    def wire_test_native_target_app_host(test_native_target, pod_target, pod_target_installation_results, project, metadata_cache, app_host_pod_target_label, app_host_target_label)
                      if dependency_installation_result = pod_target_installation_results[app_host_pod_target_label]
                        unless app_native_target = dependency_installation_result.app_host_target_labelled(app_host_target_label)
                          raise Informative, "Did not find target with label #{app_host_target_label} in the set of targets installed for #{app_host_pod_target_label}."
                        end

            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 generate_pod_targets has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def generate_pod_targets(resolver_specs_by_target, target_inspections)
                      if installation_options.deduplicate_targets?
                        distinct_targets = resolver_specs_by_target.each_with_object({}) do |dependency, hash|
                          target_definition, dependent_specs = *dependency
                          dependent_specs.group_by(&:root).each do |root_spec, resolver_specs|
              Severity: Major
              Found in lib/cocoapods/installer/analyzer.rb - About 2 hrs to fix

                Method run has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                      def run
                        if updates.empty?
                          UI.puts 'No pod updates are available.'.yellow
                        else
                          UI.section 'The color indicates what happens when you run `pod update`' do
                Severity: Minor
                Found in lib/cocoapods/command/outdated.rb - About 1 hr to fix

                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

                Severity
                Category
                Status
                Source
                Language