CocoaPods/CocoaPods

View on GitHub

Showing 281 of 310 total issues

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

    def validate_swift_version
      return unless uses_swift?
      spec_swift_versions = spec.swift_versions.map(&:to_s)

      unless spec_swift_versions.empty?
Severity: Minor
Found in lib/cocoapods/validator.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

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

      def run(name, context, whitelisted_plugins = nil)
        raise ArgumentError, 'Missing name' unless name
        raise ArgumentError, 'Missing options' unless context

        hooks = hooks_to_run(name, whitelisted_plugins)
Severity: Minor
Found in lib/cocoapods/hooks_manager.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

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 configure_schemes_for_pod_target has 47 lines of code (exceeds 25 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 1 hr to fix

      Method generate_aggregate_target has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

            def generate_aggregate_target(target_definition, target_inspections, pod_targets_by_target_definition)
              if installation_options.integrate_targets?
                target_inspection = target_inspections[target_definition]
                raise "missing inspection for #{target_definition.inspect}" unless target_inspection
                target_requires_64_bit = Analyzer.requires_64_bit_archs?(target_definition.platform, target_inspection.project.object_version)
      Severity: Minor
      Found in lib/cocoapods/installer/analyzer.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

      Method add_specs_to_repo has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

              def add_specs_to_repo
                UI.puts "\nAdding the #{'spec'.pluralize(count)} to the `#{@repo}' repo\n".yellow
                podspec_files.each do |spec_file|
                  spec = Pod::Specification.from_file(spec_file)
                  output_path = @source.pod_path(spec.name) + spec.version.to_s
      Severity: Minor
      Found in lib/cocoapods/command/repo/push.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

      Method results_message has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def results_message
            message = ''
            results.each do |result|
              if result.platforms == [:ios]
                platform_message = '[iOS] '
      Severity: Minor
      Found in lib/cocoapods/validator.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

      Method section_title has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def section_title(spec, current_action)
            if sandbox_state.changed.include?(spec.name) && sandbox.manifest
              current_version = spec.version
              previous_version = sandbox.manifest.version(spec.name)
              has_changed_version = current_version != previous_version
      Severity: Minor
      Found in lib/cocoapods/installer.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

      Method wire_app_native_targets has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

              def wire_app_native_targets(pod_target, installation_result, pod_target_installation_results, project, metadata_cache)
                installation_result.app_specs_by_native_target.each do |app_native_target, app_spec|
                  resource_bundle_native_targets = installation_result.app_resource_bundle_targets[app_spec.name] || []
                  resource_bundle_native_targets.each do |app_resource_bundle_target|
                    app_native_target.add_dependency(app_resource_bundle_target)

      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_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)

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

              def verify_swift_pods_swift_version
                error_message_for_target_definition = lambda do |target_definition|
                  "`#{target_definition.name}` (Swift #{target_definition.swift_version})"
                end
                swift_pod_targets = pod_targets.select(&:uses_swift?)
      Severity: Minor
      Found in lib/cocoapods/installer/xcode/target_validator.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

      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)

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

              def generate_targets(resolver_specs_by_target, target_inspections)
                resolver_specs_by_target = resolver_specs_by_target.reject { |td, _| td.abstract? && !td.platform }
                pod_targets = generate_pod_targets(resolver_specs_by_target, target_inspections)
                pod_targets_by_target_definition = group_pod_targets_by_target_definition(pod_targets, resolver_specs_by_target)
                aggregate_targets = resolver_specs_by_target.keys.reject(&:abstract?).map do |target_definition|
        Severity: Minor
        Found in lib/cocoapods/installer/analyzer.rb - About 1 hr to fix

          Method run has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  def run
                    UI.puts
                    podspecs_to_lint.each do |podspec|
                      validator                = Validator.new(podspec, @source_urls, @platforms)
                      validator.local          = true
          Severity: Minor
          Found in lib/cocoapods/command/lib/lint.rb - About 1 hr to fix

            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 analyze has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                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,
                Severity: Minor
                Found in lib/cocoapods/installer/project_cache/project_cache_analyzer.rb - About 1 hr to fix

                  Method podfile_from_spec has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def podfile_from_spec(platform_name, deployment_target, use_frameworks = true, test_spec_names = [], use_modular_headers = false, use_static_frameworks = false)
                        name     = subspec_name || spec.name
                        podspec  = file.realpath
                        local    = local?
                        urls     = source_urls
                  Severity: Minor
                  Found in lib/cocoapods/validator.rb - About 1 hr to fix

                    Method validate! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                    Open

                          def validate!
                            super
                            raise Informative, 'Existing Podfile found in directory' unless config.podfile_path_in_dir(Pathname.pwd).nil?
                            if @project_path
                              help! "Xcode project at #{@project_path} does not exist" unless File.exist? @project_path
                    Severity: Minor
                    Found in lib/cocoapods/command/init.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