rubinius/rubinius

View on GitHub
library/rubygems/uninstaller.rb

Summary

Maintainability
C
1 day
Test Coverage

Method uninstall has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
Open

  def uninstall
    dependency = Gem::Dependency.new @gem, @version

    list = []

Severity: Minor
Found in library/rubygems/uninstaller.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 uninstall has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def uninstall
    dependency = Gem::Dependency.new @gem, @version

    list = []

Severity: Major
Found in library/rubygems/uninstaller.rb - About 2 hrs to fix

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

      def remove_executables(spec)
        return if spec.nil? or spec.executables.empty?
    
        executables = spec.executables.clone
    
    
    Severity: Minor
    Found in library/rubygems/uninstaller.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 remove_executables has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def remove_executables(spec)
        return if spec.nil? or spec.executables.empty?
    
        executables = spec.executables.clone
    
    
    Severity: Minor
    Found in library/rubygems/uninstaller.rb - About 1 hr to fix

      Method remove has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def remove(spec)
          unless path_ok?(@gem_home, spec) or
                 (@user_install and path_ok?(Gem.user_dir, spec)) then
            e = Gem::GemNotInHomeException.new \
                  "Gem '#{spec.full_name}' is not installed in directory #{@gem_home}"
      Severity: Minor
      Found in library/rubygems/uninstaller.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

      There are no issues that match your filters.

      Category
      Status