CocoaPods/CocoaPods

View on GitHub
lib/cocoapods/installer/project_cache/target_cache_key.rb

Summary

Maintainability
C
1 day
Test Coverage
A
97%

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

        def self.from_pod_target(sandbox, target_by_label, pod_target, is_local_pod: false, checkout_options: nil)
          build_settings = {}
          build_settings[pod_target.label.to_s] = Hash[pod_target.build_settings.map do |k, v|
            [k, Digest::MD5.hexdigest(v.xcconfig.to_s)]
          end]
Severity: Minor
Found in lib/cocoapods/installer/project_cache/target_cache_key.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 from_pod_target has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def self.from_pod_target(sandbox, target_by_label, pod_target, is_local_pod: false, checkout_options: nil)
          build_settings = {}
          build_settings[pod_target.label.to_s] = Hash[pod_target.build_settings.map do |k, v|
            [k, Digest::MD5.hexdigest(v.xcconfig.to_s)]
          end]
Severity: Minor
Found in lib/cocoapods/installer/project_cache/target_cache_key.rb - About 1 hr to fix

    Method from_aggregate_target has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

            def self.from_aggregate_target(sandbox, target_by_label, aggregate_target)
              build_settings = {}
              aggregate_target.user_build_configurations.keys.each do |configuration|
                build_settings[configuration] = Digest::MD5.hexdigest(aggregate_target.build_settings(configuration).xcconfig.to_s)
              end
    Severity: Minor
    Found in lib/cocoapods/installer/project_cache/target_cache_key.rb - About 45 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

    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

            There are no issues that match your filters.

            Category
            Status