CocoaPods/Core

View on GitHub

Showing 90 of 102 total issues

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

    def specification_path(name, version)
      raise ArgumentError, 'No name' unless name
      raise ArgumentError, 'No version' unless version
      unless versions(name).include?(Version.new(version))
        raise StandardError, "Unable to find the specification #{name} " \
Severity: Minor
Found in lib/cocoapods-core/cdn_source.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 check_if_untagged_version_is_acceptable has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def check_if_untagged_version_is_acceptable(spec, previous_spec, errors)
        return if !spec.source[:git] || spec.source[:tag]
        return unless related_specifications(spec)
        return if previous_spec
        has_tagged_spec = related_specifications(spec).any? do |s|
Severity: Minor
Found in lib/cocoapods-core/source/acceptor.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 build_type has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def build_type
        value = get_hash_value('uses_frameworks', root? ? BuildType.static_library : parent.build_type)
        case value
        when true, false
          value ? BuildType.dynamic_framework : BuildType.static_library
Severity: Minor
Found in lib/cocoapods-core/podfile/target_definition.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 parse_subspecs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def parse_subspecs(name, requirements)
        options = requirements.last
        return false unless options.is_a?(Hash)

        subspecs = options.delete(:subspecs)
Severity: Minor
Found in lib/cocoapods-core/podfile/target_definition.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 merge_hash_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def merge_hash_value(attr, old, new)
        case attr.name
        when :info_plist
          new
        when ->(name) { spec.non_library_specification? && [:pod_target_xcconfig, :user_target_xcconfig, :xcconfig].include?(name) }
Severity: Minor
Found in lib/cocoapods-core/specification/consumer.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 analyze has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def analyze
        @report = HealthReport.new(source)

        source.pods.each do |name|
          source.versions(name).each do |version|
Severity: Minor
Found in lib/cocoapods-core/source/health_reporter.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 last_compatible_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def last_compatible_version(target_version)
        return unless minimum_cocoapods_version
        return if minimum_cocoapods_version <= target_version
        @last_compatible_versions.reverse.bsearch { |v| v <= target_version }.tap do |version|
          raise Informative, 'Unable to find compatible version' unless version
Severity: Minor
Found in lib/cocoapods-core/source/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 prepare_value has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def prepare_value(attr, value)
        if attr.container == Array
          value = if value.is_a?(Hash)
                    [value]
                  else
Severity: Minor
Found in lib/cocoapods-core/specification/consumer.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 from_ruby has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def self.from_ruby(path, contents = nil)
      contents ||= File.open(path, 'r:utf-8', &:read)

      # Work around for Rubinius incomplete encoding in 1.9 mode
      if contents.respond_to?(:encoding) && contents.encoding.name != 'UTF-8'
Severity: Minor
Found in lib/cocoapods-core/podfile.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 check_commit_change_for_untagged_version has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def check_commit_change_for_untagged_version(spec, previous_spec, errors)
        return unless previous_spec
        return unless spec.version == Version.new('0.0.1')
        unless spec.source[:commit] == previous_spec.source[:commit]
          errors << 'Attempt to rewrite the commit of a 0.0.1 version.'
Severity: Minor
Found in lib/cocoapods-core/source/acceptor.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