CocoaPods/CocoaPods

View on GitHub

Showing 281 of 310 total issues

Method scope_by_specs has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

        def scope_by_specs
          root_spec = variants.first.root_spec
          specs = [root_spec]
          specs += if root_spec.default_subspecs.empty?
                     root_spec.subspecs.compact
Severity: Minor
Found in lib/cocoapods/installer/analyzer/pod_variant_set.rb - About 4 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

Class Sandbox has 32 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Sandbox
    autoload :FileAccessor,  'cocoapods/sandbox/file_accessor'
    autoload :HeadersStore,  'cocoapods/sandbox/headers_store'
    autoload :PathList,      'cocoapods/sandbox/path_list'
    autoload :PodDirCleaner, 'cocoapods/sandbox/pod_dir_cleaner'
Severity: Minor
Found in lib/cocoapods/sandbox.rb - About 4 hrs to fix

    Method script has 98 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def script
            script = <<-SH.strip_heredoc
    #{Pod::Generator::ScriptPhaseConstants::DEFAULT_SCRIPT_PHASE_HEADER}
    if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
      # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
    Severity: Major
    Found in lib/cocoapods/generator/embed_frameworks_script.rb - About 3 hrs to fix

      File resolver.rb has 317 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'molinillo'
      require 'cocoapods/podfile'
      
      module Pod
        class NoSpecFoundError < Informative
      Severity: Minor
      Found in lib/cocoapods/resolver.rb - About 3 hrs to fix

        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 analyze_host_targets_in_podfile has a Cognitive Complexity of 24 (exceeds 5 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: Minor
          Found in lib/cocoapods/installer/analyzer.rb - About 3 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 key_difference has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
          Open

                  def key_difference(other)
                    if other.type != type
                      :project
                    else
                      case type
          Severity: Minor
          Found in lib/cocoapods/installer/project_cache/target_cache_key.rb - About 3 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 create_app_import_source_file has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
          Open

                def self.create_app_import_source_file(project, pod_target, platform, name = 'App')
                  language = pod_target.uses_swift? ? :swift : :objc
          
                  if language == :swift
                    source_file = project.path.dirname.+("#{name}/main.swift")
          Severity: Minor
          Found in lib/cocoapods/generator/app_target_helper.rb - About 3 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 dependencies_for_specs has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

                def dependencies_for_specs(specs, platform, all_specs)
                  dependent_specs = {
                    :debug => Set.new,
                    :release => Set.new,
                  }
          Severity: Minor
          Found in lib/cocoapods/installer/analyzer.rb - About 3 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 podfile_from_spec has a Cognitive Complexity of 22 (exceeds 5 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 3 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 relative_glob has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
          Open

                def relative_glob(patterns, options = {})
                  return [] if patterns.empty?
          
                  dir_pattern = options[:dir_pattern]
                  exclude_patterns = options[:exclude_patterns]
          Severity: Minor
          Found in lib/cocoapods/sandbox/path_list.rb - About 3 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_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)

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

                def script
                  script = <<-SH.strip_heredoc
          #{Pod::Generator::ScriptPhaseConstants::DEFAULT_SCRIPT_PHASE_HEADER}
          
          #{Pod::Generator::ScriptPhaseConstants::RSYNC_PROTECT_TMP_FILES}
          Severity: Major
          Found in lib/cocoapods/generator/copy_xcframework_script.rb - About 2 hrs to fix

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

              Method allowable_project_paths has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
              Open

                        def allowable_project_paths(paths)
                          lproj_paths = Set.new
                          lproj_paths_with_files = Set.new
              
                          # Remove all file ref under .docc folder, but preserve the .docc folder

              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."

              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 Config has 24 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class Config
                  # The default settings for the configuration.
                  #
                  # Users can specify custom settings in `~/.cocoapods/config.yaml`.
                  # An example of the contents of this file might look like:
              Severity: Minor
              Found in lib/cocoapods/config.rb - About 2 hrs to fix

                Method pod has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                      def pod(set, mode = :normal)
                        if mode == :name_and_version
                          puts_indented "#{set.name} #{set.versions.first.version}"
                        else
                          pod = Specification::Set::Presenter.new(set)
                Severity: Minor
                Found in lib/cocoapods/user_interface.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 configure_pod_targets has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    def configure_pod_targets(target_installation_results)
                      target_installation_results.first.values.each do |pod_target_installation_result|
                        pod_target = pod_target_installation_result.target
                        native_target = pod_target_installation_result.native_target
                        native_target.build_configuration_list.build_configurations.each do |build_configuration|
                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 perform_extensive_analysis has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                    def perform_extensive_analysis(spec)
                      if spec.non_library_specification?
                        error('spec', "Validating a non library spec (`#{spec.name}`) is not supported.")
                        return false
                      end
                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

                Severity
                Category
                Status
                Source
                Language