rubinius/rubinius

View on GitHub
library/rubygems/bundler_version_finder.rb

Summary

Maintainability
B
4 hrs
Test Coverage

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

  def self.lockfile_contents
    gemfile = ENV["BUNDLE_GEMFILE"]
    gemfile = nil if gemfile && gemfile.empty?
    Gem::Util.traverse_parents Dir.pwd do |directory|
      next unless gemfile = Gem::GEM_DEP_FILES.find { |f| File.file?(f.untaint) }
Severity: Minor
Found in library/rubygems/bundler_version_finder.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 bundle_update_bundler_version has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

  def self.bundle_update_bundler_version
    return unless File.basename($0) == "bundle".freeze
    return unless "update".start_with?(ARGV.first || " ")
    bundler_version = nil
    update_index = nil
Severity: Minor
Found in library/rubygems/bundler_version_finder.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

Avoid too many return statements within this method.
Open

      return [v, "your #{lockfile}"]
Severity: Major
Found in library/rubygems/bundler_version_finder.rb - About 30 mins to fix

    Method bundler_version_with_reason has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.bundler_version_with_reason
        return if @without_filtering
    
        if v = ENV["BUNDLER_VERSION"]
          return [v, "`$BUNDLER_VERSION`"]
    Severity: Minor
    Found in library/rubygems/bundler_version_finder.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 compatible? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.compatible?(spec)
        return true unless spec.name == "bundler".freeze
        return true unless bundler_version = self.bundler_version
        if bundler_version.segments.first >= 2
          spec.version == bundler_version
    Severity: Minor
    Found in library/rubygems/bundler_version_finder.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