rubygems/rubygems

View on GitHub

Showing 830 of 946 total issues

Class Command has 44 methods (exceeds 20 allowed). Consider refactoring.
Open

class Gem::Command
  include Gem::UserInteraction

  Gem::OptionParser.accept Symbol, &:to_sym

Severity: Minor
Found in lib/rubygems/command.rb - About 6 hrs to fix

    Method gem has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def gem(name, *args)
          options = args.last.is_a?(Hash) ? args.pop.dup : {}
          options["gemfile"] = @gemfile
          version = args || [">= 0"]
    
    
    Severity: Minor
    Found in bundler/lib/bundler/dsl.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

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

      def execute
        specs = if options[:all]
          Gem::Specification.map
    
        # `--extensions` must be explicitly given to pristine only gems
    Severity: Minor
    Found in lib/rubygems/commands/pristine_command.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 gem_dependency_api.rb has 409 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Gem::RequestSet::GemDependencyAPI
      ENGINE_MAP = { # :nodoc:
        jruby: %w[jruby],
        jruby_18: %w[jruby],
        jruby_19: %w[jruby],
    Severity: Minor
    Found in lib/rubygems/request_set/gem_dependency_api.rb - About 5 hrs to fix

      File protocol.rb has 402 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'socket'
      require_relative '../../../timeout/lib/timeout'
      require 'io/wait'
      
      module Gem::Net # :nodoc:
      Severity: Minor
      Found in lib/rubygems/vendor/net-protocol/lib/net/protocol.rb - About 5 hrs to fix

        Method converge_specs has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
        Open

            def converge_specs(specs)
              converged = []
              deps = []
        
              @specs_that_changed_sources = []
        Severity: Minor
        Found in bundler/lib/bundler/definition.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 rubygems_integration.rb has 394 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require "rubygems" unless defined?(Gem)
        
        module Bundler
          class RubygemsIntegration
            require "monitor"
        Severity: Minor
        Found in bundler/lib/bundler/rubygems_integration.rb - About 5 hrs to fix

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

            def doctor_child(sub_directory, extension) # :nodoc:
              directory = File.join(@gem_repository, sub_directory)
          
              Dir.entries(directory).sort.each do |ent|
                next if [".", ".."].include?(ent)
          Severity: Minor
          Found in lib/rubygems/doctor.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

          Method add_install_update_options has 133 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            def add_install_update_options
              add_option(:"Install/Update", "-i", "--install-dir DIR",
                         "Gem repository directory to get installed",
                         "gems") do |value, options|
                options[:install_dir] = File.expand_path(value)
          Severity: Major
          Found in lib/rubygems/install_update_options.rb - About 5 hrs to fix

            File rubygems.rb has 383 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            require "rubygems/user_interaction"
            
            module Bundler
              class Source
                class Rubygems < Source
            Severity: Minor
            Found in bundler/lib/bundler/source/rubygems.rb - About 5 hrs to fix

              Class Resolution has 39 methods (exceeds 20 allowed). Consider refactoring.
              Open

                  class Resolution
                    # A conflict that the resolution process encountered
                    # @attr [Object] requirement the requirement that immediately led to the conflict
                    # @attr [{String,Nil=>[Object]}] requirements the requirements that caused the conflict
                    # @attr [Object, nil] existing the existing spec that was in conflict with
              Severity: Minor
              Found in lib/rubygems/vendor/molinillo/lib/molinillo/resolution.rb - About 5 hrs to fix

                File specification_policy.rb has 379 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                require_relative "user_interaction"
                
                class Gem::SpecificationPolicy
                  include Gem::UserInteraction
                
                
                Severity: Minor
                Found in lib/rubygems/specification_policy.rb - About 5 hrs to fix

                  Method download has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def download(spec, source_uri, install_dir = Gem.dir)
                      install_cache_dir = File.join install_dir, "cache"
                      cache_dir =
                        if Dir.pwd == install_dir # see fetch_command
                          install_dir
                  Severity: Minor
                  Found in lib/rubygems/remote_fetcher.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

                  Method initialize has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def initialize(m, reqbody, resbody, uri_or_path, initheader = nil) # :nodoc:
                      @method = m
                      @request_has_body = reqbody
                      @response_has_body = resbody
                  
                  
                  Severity: Minor
                  Found in lib/rubygems/vendor/net-http/lib/net/http/generic_request.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

                  Method install has a Cognitive Complexity of 34 (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 lib/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

                  Class SourceList has 38 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class SourceList
                      attr_reader :path_sources,
                        :git_sources,
                        :plugin_sources,
                        :global_path_source,
                  Severity: Minor
                  Found in bundler/lib/bundler/source_list.rb - About 5 hrs to fix

                    File gem.rb has 374 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require "pathname"
                    
                    module Bundler
                      class CLI
                        Bundler.require_thor_actions
                    Severity: Minor
                    Found in bundler/lib/bundler/cli/gem.rb - About 5 hrs to fix

                      Method make_switch has 123 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def make_switch(opts, block = nil)
                          short, long, nolong, style, pattern, conv, not_pattern, not_conv, not_style = [], [], []
                          ldesc, sdesc, desc, arg = [], [], []
                          default_style = Switch::NoArgument
                          default_pattern = nil
                      Severity: Major
                      Found in lib/rubygems/vendor/optparse/lib/optparse.rb - About 4 hrs to fix

                        Method build_gem_lines has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring.
                        Open

                            def build_gem_lines(conservative_versioning)
                              @deps.map do |d|
                                name = d.name.dump
                        
                                requirement = if conservative_versioning
                        Severity: Minor
                        Found in bundler/lib/bundler/injector.rb - About 4 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 a Cognitive Complexity of 33 (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 bundler/lib/bundler/cli/gem.rb - About 4 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

                        Severity
                        Category
                        Status
                        Source
                        Language