rubinius/rubinius

View on GitHub
library/rubygems/package.rb

Summary

Maintainability
D
1 day
Test Coverage

File package.rb has 359 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rubygems/security'
require 'rubygems/specification'
require 'rubygems/user_interaction'
require 'zlib'

Severity: Minor
Found in library/rubygems/package.rb - About 4 hrs to fix

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

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

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

        def extract_tar_gz io, destination_dir, pattern = "*" # :nodoc:
          open_tar_gz io do |tar|
            tar.each do |entry|
              next unless File.fnmatch pattern, entry.full_name, File::FNM_DOTMATCH
      
      
      Severity: Minor
      Found in library/rubygems/package.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 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 library/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 add_files has a Cognitive Complexity of 10 (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 library/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 library/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 contents has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

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

        def digest entry # :nodoc:
          algorithms = if @checksums then
                         @checksums.keys
                       else
                         [Gem::Security::DIGEST_NAME].compact
      Severity: Minor
      Found in library/rubygems/package.rb - About 35 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 extract_files has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def extract_files destination_dir, pattern = "*"
          verify unless @spec
      
          FileUtils.mkdir_p destination_dir
      
      
      Severity: Minor
      Found in library/rubygems/package.rb - About 35 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 library/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

      There are no issues that match your filters.

      Category
      Status