CocoaPods/CocoaPods

View on GitHub
lib/cocoapods/target/build_settings.rb

Summary

Maintainability
F
3 days
Test Coverage
A
95%

File build_settings.rb has 782 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Pod
  class Target
    # @since 1.5.0
    class BuildSettings
      #-------------------------------------------------------------------------#
Severity: Major
Found in lib/cocoapods/target/build_settings.rb - About 1 day to fix

    Method define_build_settings_method has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.define_build_settings_method(method_name, build_setting: false,
                                                memoized: false, sorted: false, uniqued: false, compacted: false, frozen: true,
                                                from_search_paths_aggregate_targets: false, from_pod_targets_to_link: false,
                                                &implementation)
    
    
    Severity: Minor
    Found in lib/cocoapods/target/build_settings.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

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

          def merged_xcconfigs(xcconfig_values_by_consumer_by_key, attribute, overriding: {})
            xcconfig_values_by_consumer_by_key.each_with_object(overriding.dup) do |(key, values_by_consumer), xcconfig|
              uniq_values = values_by_consumer.values.uniq
              values_are_bools = uniq_values.all? { |v| v.is_a?(String) && v =~ /\A(yes|no)\z/i }
              if values_are_bools
    Severity: Minor
    Found in lib/cocoapods/target/build_settings.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 _ld_runpath_search_paths has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
    Open

          def _ld_runpath_search_paths(requires_host_target: false, test_bundle: false, uses_swift: false)
            paths = []
            if uses_swift
              paths << '/usr/lib/swift'
              paths << '$(PLATFORM_DIR)/Developer/Library/Frameworks' if test_bundle
    Severity: Minor
    Found in lib/cocoapods/target/build_settings.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_inherited_to_plural has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

          def add_inherited_to_plural(hash)
            Hash[hash.map do |key, value|
              next [key, '$(inherited)'] if value.nil?
              if PLURAL_SETTINGS.include?(key)
                raise ArgumentError, "#{key} is a plural setting, cannot have #{value.inspect} as its value" unless value.is_a? Array
    Severity: Minor
    Found in lib/cocoapods/target/build_settings.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 define_build_settings_method has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.define_build_settings_method(method_name, build_setting: false,
                                                memoized: false, sorted: false, uniqued: false, compacted: false, frozen: true,
                                                from_search_paths_aggregate_targets: false, from_pod_targets_to_link: false,
                                                &implementation)
    
    
    Severity: Minor
    Found in lib/cocoapods/target/build_settings.rb - About 1 hr to fix

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

              def user_target_xcconfig_values_by_consumer_by_key
                targets = (pod_targets + target.search_paths_aggregate_targets.flat_map(&:pod_targets)).uniq
                targets.each_with_object({}) do |target, hash|
                  target.spec_consumers.each do |spec_consumer|
                    spec_consumer.user_target_xcconfig.each do |k, v|
      Severity: Minor
      Found in lib/cocoapods/target/build_settings.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

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

              define_build_settings_method :vendored_dynamic_library_search_paths, :memoized => true do
                paths = vendored_dynamic_libraries.map { |f| File.join '${PODS_ROOT}', f.dirname.relative_path_from(target.sandbox.root) }
                paths.concat vendored_xcframeworks.
                  select { |xcf| xcf.build_type.dynamic_library? }.
                  map { |xcf| BuildSettings.xcframework_intermediate_dir(xcf) }
      Severity: Minor
      Found in lib/cocoapods/target/build_settings.rb and 1 other location - About 40 mins to fix
      lib/cocoapods/target/build_settings.rb on lines 847..852

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

      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

              define_build_settings_method :vendored_static_library_search_paths, :memoized => true do
                paths = vendored_static_libraries.map { |f| File.join '${PODS_ROOT}', f.dirname.relative_path_from(target.sandbox.root) }
                paths.concat vendored_xcframeworks.
                  select { |xcf| xcf.build_type.static_library? }.
                  map { |xcf| BuildSettings.xcframework_intermediate_dir(xcf) }
      Severity: Minor
      Found in lib/cocoapods/target/build_settings.rb and 1 other location - About 40 mins to fix
      lib/cocoapods/target/build_settings.rb on lines 856..861

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

      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

              define_build_settings_method :spec_consumers, :memoized => true do
                if non_library_xcconfig?
                  target.spec_consumers.select { |sc| non_library_spec == sc.spec }
                else
                  target.spec_consumers.select { |sc| sc.spec.spec_type == @xcconfig_spec_type }
      Severity: Minor
      Found in lib/cocoapods/target/build_settings.rb and 1 other location - About 20 mins to fix
      lib/cocoapods/target/build_settings.rb on lines 1067..1071

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

      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

                  if uniq_values.count > 1
                    UI.warn "Can't merge #{attribute} for pod targets: " \
                      "#{values_by_consumer.keys.map(&:name)}. Boolean build " \
                      "setting #{key} has different values."
                  else
      Severity: Minor
      Found in lib/cocoapods/target/build_settings.rb and 1 other location - About 20 mins to fix
      lib/cocoapods/target/build_settings.rb on lines 463..469

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

      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

                elsif uniq_values.count > 1
                  # Singular build settings
                  UI.warn "Can't merge #{attribute} for pod targets: " \
                    "#{values_by_consumer.keys.map(&:name)}. Singular build " \
                    "setting #{key} has different values."
      Severity: Minor
      Found in lib/cocoapods/target/build_settings.rb and 1 other location - About 20 mins to fix
      lib/cocoapods/target/build_settings.rb on lines 449..454

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

      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

              define_build_settings_method :file_accessors, :memoized => true do
                if non_library_xcconfig?
                  target.file_accessors.select { |fa| non_library_spec == fa.spec }
                else
                  target.file_accessors.select { |fa| fa.spec.spec_type == @xcconfig_spec_type }
      Severity: Minor
      Found in lib/cocoapods/target/build_settings.rb and 1 other location - About 20 mins to fix
      lib/cocoapods/target/build_settings.rb on lines 1076..1080

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

      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

      There are no issues that match your filters.

      Category
      Status