CocoaPods/CocoaPods

View on GitHub

Showing 310 of 310 total issues

Method header_mappings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def header_mappings(file_accessor, headers)
      consumer = file_accessor.spec_consumer
      header_mappings_dir = consumer.header_mappings_dir
      dir = headers_sandbox
      dir += consumer.header_dir if consumer.header_dir
Severity: Minor
Found in lib/cocoapods/target/pod_target.rb - About 35 mins 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 install! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

          def install!
            UI.message "- Installing target `#{target.name}` #{target.platform}" do
              native_target = add_target
              create_support_files_dir
              create_support_files_group

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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        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
  # frameworks to, so exit 0 (signalling the script phase was successful).
Severity: Minor
Found in lib/cocoapods/generator/embed_frameworks_script.rb and 1 other location - About 30 mins to fix
lib/cocoapods/generator/copy_dsyms_script.rb on lines 39..43

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        script = <<-SH.strip_heredoc
#{Pod::Generator::ScriptPhaseConstants::DEFAULT_SCRIPT_PHASE_HEADER}
#{Pod::Generator::ScriptPhaseConstants::STRIP_INVALID_ARCHITECTURES_METHOD}
#{Pod::Generator::ScriptPhaseConstants::RSYNC_PROTECT_TMP_FILES}
#{Pod::Generator::ScriptPhaseConstants::INSTALL_DSYM_METHOD}
Severity: Minor
Found in lib/cocoapods/generator/copy_dsyms_script.rb and 1 other location - About 30 mins to fix
lib/cocoapods/generator/embed_frameworks_script.rb on lines 54..135

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 33.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid too many return statements within this method.
Open

          return true if sandbox.predownloaded?(pod)
Severity: Major
Found in lib/cocoapods/installer/analyzer/sandbox_analyzer.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

              return true if folder_empty?(pod)
    Severity: Major
    Found in lib/cocoapods/installer/analyzer/sandbox_analyzer.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return :project if this_resources != other_resources
      Severity: Major
      Found in lib/cocoapods/installer/project_cache/target_cache_key.rb - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return :project if this_build_settings != other_build_settings
        Severity: Major
        Found in lib/cocoapods/installer/project_cache/target_cache_key.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return :project if this_checkout_options != other_checkout_options
          Severity: Major
          Found in lib/cocoapods/installer/project_cache/target_cache_key.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                        return :project if this_files != other_files
            Severity: Major
            Found in lib/cocoapods/installer/project_cache/target_cache_key.rb - About 30 mins to fix

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                          framework_paths = dependent_targets.flat_map do |dependent_target|
                            spec_paths_to_include = dependent_target.library_specs.map(&:name)
                            spec_paths_to_include -= host_target_spec_names
                            spec_paths_to_include << spec.name if dependent_target == target
                            dependent_target.framework_paths.values_at(*spec_paths_to_include).flatten.compact
              lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb on lines 81..85
              lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb on lines 138..142

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 32.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                          xcframework_paths = dependent_targets.flat_map do |dependent_target|
                            spec_paths_to_include = dependent_target.library_specs.map(&:name)
                            spec_paths_to_include -= host_target_spec_names
                            spec_paths_to_include << spec.name if dependent_target == target
                            dependent_target.xcframeworks.values_at(*spec_paths_to_include).flatten.compact
              lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb on lines 81..85
              lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb on lines 132..136

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 32.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 3 locations. Consider refactoring.
              Open

                          resource_paths = dependent_targets.flat_map do |dependent_target|
                            spec_paths_to_include = dependent_target.library_specs.map(&:name)
                            spec_paths_to_include -= host_target_spec_names
                            spec_paths_to_include << spec.name if dependent_target == target
                            dependent_target.resource_paths.values_at(*spec_paths_to_include).flatten.compact
              lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb on lines 132..136
              lib/cocoapods/installer/xcode/pods_project_generator/pod_target_integrator.rb on lines 138..142

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 32.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Method initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def initialize(use_user_settings = true)
                    configure_with(DEFAULTS)
              
                    unless ENV['CP_HOME_DIR'].nil?
                      @cache_root = home_dir + 'cache'
              Severity: Minor
              Found in lib/cocoapods/config.rb - About 25 mins 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 cocoapods_sha has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def self.cocoapods_sha
                    return unless gemspec = Gem.loaded_specs['cocoapods']
                    return unless source = gemspec.source
                    return unless source.respond_to?(:revision)
                    source.revision
              Severity: Minor
              Found in lib/cocoapods/version_metadata.rb - About 25 mins 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_build_configuration has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def add_build_configuration(name, type)
                    build_configuration = super
                    settings = build_configuration.build_settings
                    definitions = settings['GCC_PREPROCESSOR_DEFINITIONS'] || ['$(inherited)']
                    defines = [defininition_for_build_configuration(name)]
              Severity: Minor
              Found in lib/cocoapods/project.rb - About 25 mins 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 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)
              Severity: Minor
              Found in lib/cocoapods/resolver.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
              Open

                      def run
                        UI.puts("$CACHE_ROOT: #{@cache.root}") if @short_output
                        if @pod_name.nil? # Print all
                          @cache.cache_descriptors_per_pod.each do |pod_name, cache_descriptors|
                            print_pod_cache_infos(pod_name, cache_descriptors)
              Severity: Minor
              Found in lib/cocoapods/command/cache/list.rb - About 25 mins 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 execute_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                  def self.execute_command(executable, command, raise_on_failure = true)
                    bin = which!(executable)
              
                    command = command.map(&:to_s)
                    if File.basename(bin) == 'tar.exe'
              Severity: Minor
              Found in lib/cocoapods/executable.rb - About 25 mins 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 get_path_of_spec has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
              Open

                    def get_path_of_spec(spec, version_filter = false)
                      sets = config.sources_manager.search_by_name(spec)
              
                      if sets.count == 1
                        set = sets.first
              Severity: Minor
              Found in lib/cocoapods/command/spec.rb - About 25 mins 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