CocoaPods/Core

View on GitHub

Showing 90 of 102 total issues

Method inhibit_warnings_hash has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

      def inhibit_warnings_hash
        inhibit_hash = raw_inhibit_warnings_hash
        if exclusive?
          inhibit_hash
        else
Severity: Minor
Found in lib/cocoapods-core/podfile/target_definition.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 merge has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def merge(other)
      unless name == other.name
        raise ArgumentError, "#{self} and #{other} have different names"
      end

Severity: Minor
Found in lib/cocoapods-core/dependency.rb - About 1 hr to fix

    Method search_by_name has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def search_by_name(query, full_text_search = false)
            query_word_regexps = query.split.map { |word| /#{word}/i }
            if full_text_search
              query_word_results_hash = {}
              updated_search_index.each_value do |word_spec_hash|
    Severity: Minor
    Found in lib/cocoapods-core/source/manager.rb - About 1 hr to fix

      Method check_spec_source_change has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def check_spec_source_change(spec, errors)
              require 'cocoapods-core/http'
      
              return unless spec
              return if spec.source[:http]
      Severity: Minor
      Found in lib/cocoapods-core/source/acceptor.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 download_file_async has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def download_file_async(partial_url)
            file_remote_url = Addressable::URI.encode(url + partial_url.to_s)
            path = repo + partial_url
      
            file_okay = local_file_okay?(partial_url)
      Severity: Minor
      Found in lib/cocoapods-core/cdn_source.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 run_validation_hooks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def run_validation_hooks(attributes, target)
              attributes.each do |attr|
                validation_hook = "_validate_#{attr.name}"
                next unless respond_to?(validation_hook, true)
                begin
      Severity: Minor
      Found in lib/cocoapods-core/specification/linter.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 initialize has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def initialize(name = nil, *requirements)
            if requirements.last.is_a?(Hash)
              additional_params = requirements.pop.select { |_, v| !v.nil? }
              additional_params = nil if additional_params.empty?
      
      
      Severity: Minor
      Found in lib/cocoapods-core/dependency.rb - About 1 hr to fix

        Method subspec_by_name has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def subspec_by_name(relative_name, raise_if_missing = true, include_non_library_specifications = false)
              if relative_name.nil? || relative_name == base_name
                self
              elsif base_name.nil?
                if raise_if_missing
        Severity: Minor
        Found in lib/cocoapods-core/specification.rb - About 1 hr to fix

          Method versions has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def versions(name)
                return nil unless specs_dir
                raise ArgumentError, 'No name' unless name
          
                fragment = pod_shard_fragment(name)
          Severity: Minor
          Found in lib/cocoapods-core/cdn_source.rb - About 1 hr to fix

            Method _prepare_script_phases has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def _prepare_script_phases(value)
                    if value
                      value.map do |script_phase|
                        if script_phase.is_a?(Hash)
                          phase = Specification.convert_keys_to_symbol(script_phase)
            Severity: Minor
            Found in lib/cocoapods-core/specification/consumer.rb - About 55 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 store_script_phase has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def store_script_phase(options)
                    option_keys = options.keys
                    unrecognized_keys = option_keys - Specification::ALL_SCRIPT_PHASE_KEYS
                    unless unrecognized_keys.empty?
                      raise StandardError, "Unrecognized options `#{unrecognized_keys}` in shell script `#{options[:name]}` within `#{name}` target. " \
            Severity: Minor
            Found in lib/cocoapods-core/podfile/target_definition.rb - About 55 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 _validate_script_phases has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def _validate_script_phases(s)
                    s.each do |script_phase|
                      keys = script_phase.keys
                      unrecognized_keys = keys - Specification::ALL_SCRIPT_PHASE_KEYS
                      unless unrecognized_keys.empty?
            Severity: Minor
            Found in lib/cocoapods-core/specification/linter.rb - About 55 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 validate_attribute_hash_keys has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                    def validate_attribute_hash_keys(attribute, value)
                      unless value.is_a?(Hash)
                        results.add_error(attribute.name, "Unsupported type `#{value.class}`, expected `Hash`")
                        return
                      end
            Severity: Minor
            Found in lib/cocoapods-core/specification/linter/analyzer.rb - About 55 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 search has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def search(query)
                  unless specs_dir
                    raise Informative, "Unable to find a source named: `#{name}`"
                  end
                  if query.is_a?(Dependency)
            Severity: Minor
            Found in lib/cocoapods-core/cdn_source.rb - About 55 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 perform_github_source_checks has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def perform_github_source_checks(s)
                    require 'uri'
            
                    if git = s[:git]
                      return unless git =~ /^#{URI.regexp}$/
            Severity: Minor
            Found in lib/cocoapods-core/specification/linter.rb - About 55 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_string has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def self.from_string(spec_contents, path, subspec_name = nil)
                  path = Pathname.new(path).expand_path
                  spec = nil
                  case path.extname
                  when '.podspec'
            Severity: Minor
            Found in lib/cocoapods-core/specification.rb - About 55 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_values has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def merge_values(attr, existing_value, new_value)
                    return existing_value if new_value.nil?
                    return new_value if existing_value.nil?
            
                    if attr.types.include?(TrueClass)
            Severity: Minor
            Found in lib/cocoapods-core/specification/consumer.rb - About 55 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 pod_whitelisted_for_configuration? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                  def pod_whitelisted_for_configuration?(pod_name, configuration_name)
                    found = false
                    configuration_pod_whitelist.each do |configuration, pods|
                      if pods.include?(pod_name)
                        found = true
            Severity: Minor
            Found in lib/cocoapods-core/podfile/target_definition.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

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

                def specification_path(name, version)
                  raise ArgumentError, 'No name' unless name
                  raise ArgumentError, 'No version' unless version
                  path = pod_path(name) + version.to_s
                  specification_path = path + "#{name}.podspec.json"
            Severity: Minor
            Found in lib/cocoapods-core/source.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

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

                    def default(platform = nil)
                      if platform && multi_platform?
                        platform_value = ios_default if platform == :ios
                        platform_value = osx_default if platform == :osx
                        platform_value || default_value
            Severity: Minor
            Found in lib/cocoapods-core/specification/dsl/attribute.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

            Severity
            Category
            Status
            Source
            Language