CocoaPods/Core

View on GitHub
lib/cocoapods-core/cdn_source.rb

Summary

Maintainability
D
2 days
Test Coverage

Class CDNSource has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

  class CDNSource < Source
    include Concurrent

    MAX_CONCURRENCY = (ENV['COCOAPODS_CDN_MAX_CONCURRENCY'] || 200).to_i
    MAX_NUMBER_OF_RETRIES = (ENV['COCOAPODS_CDN_MAX_NUMBER_OF_RETRIES'] || 5).to_i
Severity: Minor
Found in lib/cocoapods-core/cdn_source.rb - About 4 hrs to fix

    File cdn_source.rb has 323 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'cocoapods-core/source'
    require 'rest'
    require 'concurrent'
    require 'netrc'
    require 'addressable'
    Severity: Minor
    Found in lib/cocoapods-core/cdn_source.rb - About 3 hrs to fix

      Method download_and_save_with_retries_async has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
      Open

          def download_and_save_with_retries_async(partial_url, file_remote_url, etag, retries = MAX_NUMBER_OF_RETRIES)
            path = repo + partial_url
            etag_path = path.sub_ext(path.extname + '.etag')
      
            download_task = download_typhoeus_impl_async(file_remote_url, etag).then do |response|
      Severity: Minor
      Found in lib/cocoapods-core/cdn_source.rb - About 2 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 download_and_save_with_retries_async has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def download_and_save_with_retries_async(partial_url, file_remote_url, etag, retries = MAX_NUMBER_OF_RETRIES)
            path = repo + partial_url
            etag_path = path.sub_ext(path.extname + '.etag')
      
            download_task = download_typhoeus_impl_async(file_remote_url, etag).then do |response|
      Severity: Minor
      Found in lib/cocoapods-core/cdn_source.rb - About 1 hr to fix

        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 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 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 versions has a Cognitive Complexity of 8 (exceeds 5 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 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 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

          There are no issues that match your filters.

          Category
          Status