bundler/bundler

View on GitHub
lib/bundler/cli/gem.rb

Summary

Maintainability
C
1 day
Test Coverage

Method run has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    def run
      Bundler.ui.confirm "Creating gem '#{name}'..."

      underscored_name = name.tr("-", "_")
      namespaced_path = name.tr("-", "/")
Severity: Minor
Found in lib/bundler/cli/gem.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

Method run has 126 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def run
      Bundler.ui.confirm "Creating gem '#{name}'..."

      underscored_name = name.tr("-", "_")
      namespaced_path = name.tr("-", "/")
Severity: Major
Found in lib/bundler/cli/gem.rb - About 5 hrs to fix

    Method ensure_safe_gem_name has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def ensure_safe_gem_name(name, constant_array)
          if name =~ /^\d/
            Bundler.ui.error "Invalid gem name #{name} Please give a name which does not start with numbers."
            exit 1
          end
    Severity: Minor
    Found in lib/bundler/cli/gem.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 ask_and_set_test_framework has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def ask_and_set_test_framework
          test_framework = options[:test] || Bundler.settings["gem.test"]
    
          if test_framework.nil?
            Bundler.ui.confirm "Do you want to generate tests with your gem?"
    Severity: Minor
    Found in lib/bundler/cli/gem.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

            :author           => git_author_name.empty? ? "TODO: Write your name" : git_author_name,
    Severity: Minor
    Found in lib/bundler/cli/gem.rb by fixme

    TODO found
    Open

            :email            => git_user_email.empty? ? "TODO: Write your email address" : git_user_email,
    Severity: Minor
    Found in lib/bundler/cli/gem.rb by fixme

    There are no issues that match your filters.

    Category
    Status