CocoaPods/Core

View on GitHub

Showing 93 of 105 total issues

File target_definition.rb has 587 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Pod
  class Podfile
    # The TargetDefinition stores the information of a CocoaPods static
    # library. The target definition can be linked with one or more targets of
    # the user project.
Severity: Major
Found in lib/cocoapods-core/podfile/target_definition.rb - About 1 day to fix

    Class TargetDefinition has 67 methods (exceeds 20 allowed). Consider refactoring.
    Open

        class TargetDefinition
          # @return [TargetDefinition, Podfile] the parent target definition or the
          #         Podfile if the receiver is root.
          #
          attr_reader :parent
    Severity: Major
    Found in lib/cocoapods-core/podfile/target_definition.rb - About 1 day to fix

      Class Specification has 51 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class Specification
          include Pod::Specification::DSL
          include Pod::Specification::DSL::Deprecations
          include Pod::Specification::RootAttributesAccessors
          include Pod::Specification::JSONSupport
      Severity: Major
      Found in lib/cocoapods-core/specification.rb - About 7 hrs to fix

        Method compare_segments has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
        Open

            def compare_segments(other)
              return unless other.is_a?(Pod::Version)
              return 0 if @version == other.version
        
              compare = proc do |segments, other_segments, is_pre_release|
        Severity: Minor
        Found in lib/cocoapods-core/version.rb - About 6 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

        File specification.rb has 400 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'active_support/core_ext/string/strip.rb'
        
        require 'cocoapods-core/specification/consumer'
        require 'cocoapods-core/specification/dsl'
        require 'cocoapods-core/specification/linter'
        Severity: Minor
        Found in lib/cocoapods-core/specification.rb - About 5 hrs to fix

          File linter.rb has 399 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          require 'cocoapods-core/specification/linter/result'
          require 'cocoapods-core/specification/linter/analyzer'
          
          module Pod
            class Specification
          Severity: Minor
          Found in lib/cocoapods-core/specification/linter.rb - About 5 hrs to fix

            Class Linter has 38 methods (exceeds 20 allowed). Consider refactoring.
            Open

                class Linter
                  # @return [Specification] the specification to lint.
                  #
                  attr_reader :spec
            
            
            Severity: Minor
            Found in lib/cocoapods-core/specification/linter.rb - About 5 hrs to fix

              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

                Class Source has 35 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class Source
                    # The default branch in which the specs are stored
                    DEFAULT_SPECS_BRANCH = 'master'.freeze
                
                    # @return [Pod::Source::Metadata] The metadata for this source.
                Severity: Minor
                Found in lib/cocoapods-core/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

                    Class Lockfile has 29 methods (exceeds 20 allowed). Consider refactoring.
                    Open

                      class Lockfile
                        # @todo   The symbols should be converted to a String and back to symbol
                        #         when reading (EXTERNAL SOURCES Download options)
                    
                        # @return [String] the hash used to initialize the Lockfile.
                    Severity: Minor
                    Found in lib/cocoapods-core/lockfile.rb - About 3 hrs to fix

                      Class Manager has 29 methods (exceeds 20 allowed). Consider refactoring.
                      Open

                          class Manager
                            # @return [Pathname] The directory that contains the source repo
                            #         directories.
                            #
                            attr_reader :repos_dir
                      Severity: Minor
                      Found in lib/cocoapods-core/source/manager.rb - About 3 hrs to fix

                        Class Podfile has 26 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                          class Podfile
                            # The methods defined in this file and the order of the methods is
                            # relevant for the documentation generated on
                            # https://github.com/CocoaPods/guides.cocoapods.org.
                        
                        
                        Severity: Minor
                        Found in lib/cocoapods-core/podfile/dsl.rb - About 3 hrs to fix

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

                                def dependency(*args)
                                  name, *version_requirements = args
                                  if name == self.name
                                    raise Informative, "A specification can't require itself as a " \
                                      'subspec'
                          Severity: Minor
                          Found in lib/cocoapods-core/specification/dsl.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 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 name_for_url has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def name_for_url(url)
                                  base_from_host_and_path = lambda do |host, path|
                                    if host && !host.empty?
                                      domain = PublicSuffix.parse(host) rescue nil
                                      base = [domain&.sld || host]
                          Severity: Minor
                          Found in lib/cocoapods-core/source/manager.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

                          Class Podfile has 25 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                            class Podfile
                              # @!group DSL support
                          
                              include Pod::Podfile::DSL
                          
                          
                          Severity: Minor
                          Found in lib/cocoapods-core/podfile.rb - About 2 hrs to fix

                            File dsl.rb has 282 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            require 'cocoapods-core/specification/dsl/attribute_support'
                            require 'cocoapods-core/specification/dsl/attribute'
                            require 'cocoapods-core/specification/dsl/platform_proxy'
                            
                            module Pod
                            Severity: Minor
                            Found in lib/cocoapods-core/specification/dsl.rb - About 2 hrs to fix

                              Method initialize has a Cognitive Complexity of 20 (exceeds 5 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 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

                              Class Specification has 24 methods (exceeds 20 allowed). Consider refactoring.
                              Open

                                class Specification
                                  module DSL
                                    # Provides the accessors methods for the root attributes. Root attributes
                                    # do not support multi-platform values and inheritance.
                                    #
                              Severity: Minor
                              Found in lib/cocoapods-core/specification/root_attribute_accessors.rb - About 2 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language