rubygems/rubygems

View on GitHub
lib/rubygems/package.rb

Summary

Maintainability
D
3 days
Test Coverage

Method extract_tar_gz has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring.
Open

  def extract_tar_gz(io, destination_dir, pattern = "*") # :nodoc:
    destination_dir = File.realpath(destination_dir)

    directories = []
    symlinks = []
Severity: Minor
Found in lib/rubygems/package.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 package.rb has 431 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require_relative "security"
require_relative "user_interaction"

##
# Example using a Gem::Package
Severity: Minor
Found in lib/rubygems/package.rb - About 6 hrs to fix

    Class Package has 31 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Gem::Package
      include Gem::UserInteraction
    
      class Error < Gem::Exception; end
    
    
    Severity: Minor
    Found in lib/rubygems/package.rb - About 3 hrs to fix

      Method extract_tar_gz has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def extract_tar_gz(io, destination_dir, pattern = "*") # :nodoc:
          destination_dir = File.realpath(destination_dir)
      
          directories = []
          symlinks = []
      Severity: Minor
      Found in lib/rubygems/package.rb - About 1 hr to fix

        Method contents has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def contents
            return @contents if @contents
        
            verify unless @spec
        
        
        Severity: Minor
        Found in lib/rubygems/package.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 extract_files has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

          def extract_files(destination_dir, pattern = "*")
            verify unless @spec
        
            FileUtils.mkdir_p destination_dir, mode: dir_mode && 0o755
        
        
        Severity: Minor
        Found in lib/rubygems/package.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 new has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.new(gem, security_policy = nil)
            gem = if gem.is_a?(Gem::Package::Source)
              gem
            elsif gem.respond_to? :read
              Gem::Package::IOSource.new gem
        Severity: Minor
        Found in lib/rubygems/package.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 verify_entry has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def verify_entry(entry)
            file_name = entry.full_name
            @files << file_name
        
            case file_name
        Severity: Minor
        Found in lib/rubygems/package.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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def initialize(message, source = nil)
              if source
                @path = source.is_a?(String) ? source : source.path
        
                message += " in #{path}" if path
        Severity: Minor
        Found in lib/rubygems/package.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 verify_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def verify_files(gem)
            gem.each do |entry|
              verify_entry entry
            end
        
        
        Severity: Minor
        Found in lib/rubygems/package.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 verify_checksums has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def verify_checksums(digests, checksums) # :nodoc:
            return unless checksums
        
            checksums.sort.each do |algorithm, gem_digests|
              gem_digests.sort.each do |file_name, gem_hexdigest|
        Severity: Minor
        Found in lib/rubygems/package.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 add_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def add_files(tar) # :nodoc:
            @spec.files.each do |file|
              stat = File.lstat file
        
              if stat.symlink?
        Severity: Minor
        Found in lib/rubygems/package.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

        TODO found
        Open

              # TODO: read into a buffer once zlib supports it
        Severity: Minor
        Found in lib/rubygems/package.rb by fixme

        There are no issues that match your filters.

        Category
        Status