rubinius/rubinius

View on GitHub
library/rubygems/commands/query_command.rb

Summary

Maintainability
D
2 days
Test Coverage

Method execute has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

  def execute
    exit_code = 0
    if options[:args].to_a.empty? and options[:name].source.empty?
      name = options[:name]
      no_name = true
Severity: Minor
Found in library/rubygems/commands/query_command.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

File query_command.rb has 278 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'rubygems/command'
require 'rubygems/local_remote_options'
require 'rubygems/spec_fetcher'
require 'rubygems/version_option'
require 'rubygems/text'
Severity: Minor
Found in library/rubygems/commands/query_command.rb - About 2 hrs to fix

    Method show_gems has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def show_gems name, prerelease
        req = Gem::Requirement.default
        # TODO: deprecate for real
        dep = Gem::Deprecate.skip_during { Gem::Dependency.new name, req }
        dep.prerelease = prerelease
    Severity: Minor
    Found in library/rubygems/commands/query_command.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 entry_versions has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

      def entry_versions entry, name_tuples, platforms, specs
        return unless options[:versions]
    
        list =
          if platforms.empty? or options[:details] then
    Severity: Minor
    Found in library/rubygems/commands/query_command.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 initialize has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def initialize(name = 'query',
                     summary = 'Query gem information in local or remote repositories')
        super name, summary,
             :name => //, :domain => :local, :details => false, :versions => true,
             :installed => nil, :version => Gem::Requirement.default
    Severity: Minor
    Found in library/rubygems/commands/query_command.rb - About 1 hr to fix

      Method show_gems has 39 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def show_gems name, prerelease
          req = Gem::Requirement.default
          # TODO: deprecate for real
          dep = Gem::Deprecate.skip_during { Gem::Dependency.new name, req }
          dep.prerelease = prerelease
      Severity: Minor
      Found in library/rubygems/commands/query_command.rb - About 1 hr to fix

        Method execute has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def execute
            exit_code = 0
            if options[:args].to_a.empty? and options[:name].source.empty?
              name = options[:name]
              no_name = true
        Severity: Minor
        Found in library/rubygems/commands/query_command.rb - About 1 hr to fix

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

            def spec_loaded_from entry, spec, specs
              return unless spec.loaded_from
          
              if specs.length == 1 then
                default = spec.default_gem? ? ' (default)' : nil
          Severity: Minor
          Found in library/rubygems/commands/query_command.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 spec_platforms has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def spec_platforms entry, platforms
              non_ruby = platforms.any? do |_, pls|
                pls.any? { |pl| pl != Gem::Platform::RUBY }
              end
          
          
          Severity: Minor
          Found in library/rubygems/commands/query_command.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 output_versions has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

            def output_versions output, versions
              versions.each do |gem_name, matching_tuples|
                matching_tuples = matching_tuples.sort_by { |n,_| n.version }.reverse
          
                platforms = Hash.new { |h,version| h[version] = [] }
          Severity: Minor
          Found in library/rubygems/commands/query_command.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

          There are no issues that match your filters.

          Category
          Status