rubinius/rubinius

View on GitHub
library/rubygems/request_set.rb

Summary

Maintainability
D
2 days
Test Coverage

Method install has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

  def install options, &block # :yields: request, installer
    if dir = options[:install_dir]
      requests = install_into dir, false, options, &block
      return requests
    end
Severity: Minor
Found in library/rubygems/request_set.rb - About 5 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 request_set.rb has 269 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'tsort'

##
# A RequestSet groups a request to activate a set of dependencies.
#
Severity: Minor
Found in library/rubygems/request_set.rb - About 2 hrs to fix

    Method install has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def install options, &block # :yields: request, installer
        if dir = options[:install_dir]
          requests = install_into dir, false, options, &block
          return requests
        end
    Severity: Major
    Found in library/rubygems/request_set.rb - About 2 hrs to fix

      Method tsort_each_child has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        def tsort_each_child node # :nodoc:
          node.spec.dependencies.each do |dep|
            next if dep.type == :development and not @development
      
            match = @requests.find { |r|
      Severity: Minor
      Found in library/rubygems/request_set.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 pretty_print has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def pretty_print q # :nodoc:
          q.group 2, '[RequestSet:', ']' do
            q.breakable
      
            if @remote then
      Severity: Minor
      Found in library/rubygems/request_set.rb - About 1 hr to fix

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

          def install_into dir, force = true, options = {}
            gem_home, ENV['GEM_HOME'] = ENV['GEM_HOME'], dir
        
            existing = force ? [] : specs_in(dir)
            existing.delete_if { |s| @always_install.include? s }
        Severity: Minor
        Found in library/rubygems/request_set.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 pretty_print has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

          def pretty_print q # :nodoc:
            q.group 2, '[RequestSet:', ']' do
              q.breakable
        
              if @remote then
        Severity: Minor
        Found in library/rubygems/request_set.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 install_from_gemdeps has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

          def install_from_gemdeps options, &block
            gemdeps = options[:gemdeps]
        
            @install_dir = options[:install_dir] || Gem.dir
            @prerelease  = options[:prerelease]
        Severity: Minor
        Found in library/rubygems/request_set.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

        There are no issues that match your filters.

        Category
        Status