rubygems/rubygems

View on GitHub

Showing 831 of 947 total issues

Method show_version has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

  def show_version(*pkgs)
    progname = ARGV.options.program_name
    result = false
    show = proc do |klass, cname, version|
      str = "#{progname}"
Severity: Minor
Found in lib/rubygems/vendor/optparse/lib/optparse/version.rb - About 3 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 transport_request has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    def transport_request(req)
      count = 0
      begin
        begin_transport req
        res = catch(:response) {
Severity: Minor
Found in lib/rubygems/vendor/net-http/lib/net/http.rb - About 3 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 Dsl has 31 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Dsl
    include RubyDsl

    def self.evaluate(gemfile, lockfile, unlock)
      builder = new
Severity: Minor
Found in bundler/lib/bundler/dsl.rb - About 3 hrs to fix

    Class Package has 31 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Gem::Package
      include Gem::UserInteraction
    
      class Error < Gem::Exception; end
    
    
    Severity: Minor
    Found in lib/rubygems/package.rb - About 3 hrs to fix

      Class ToRuby has 31 methods (exceeds 20 allowed). Consider refactoring.
      Open

          class ToRuby < Visitor
            def initialize(permitted_classes:, permitted_symbols:, permitted_ivars:)
              @permitted_classes = permitted_classes
              @permitted_symbols = ["E"].concat(permitted_symbols).concat(permitted_classes)
              @permitted_ivars = permitted_ivars
      Severity: Minor
      Found in lib/rubygems/safe_marshal/visitors/to_ruby.rb - About 3 hrs to fix

        Method ensure_equivalent_gemfile_and_lockfile has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            def ensure_equivalent_gemfile_and_lockfile(explicit_flag = false)
              added =   []
              deleted = []
              changed = []
        
        
        Severity: Minor
        Found in bundler/lib/bundler/definition.rb - About 3 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 summarize has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

            def summarize(sdone = {}, ldone = {}, width = 1, max = width - 1, indent = "")
              sopts, lopts = [], [], nil
              @short.each {|s| sdone.fetch(s) {sopts << s}; sdone[s] = true} if @short
              @long.each {|s| ldone.fetch(s) {lopts << s}; ldone[s] = true} if @long
              return if sopts.empty? and lopts.empty? # completely hidden
        Severity: Minor
        Found in lib/rubygems/vendor/optparse/lib/optparse.rb - About 3 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 26 (exceeds 5 allowed). Consider refactoring.
        Open

          def execute
            specs = []
            gem = options[:args].shift
        
            unless gem
        Severity: Minor
        Found in lib/rubygems/commands/specification_command.rb - About 3 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 verify has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
        Open

          def verify(chain, key = nil, digests = {}, signatures = {}, full_name = "(unknown)")
            if signatures.empty?
              if @only_signed
                raise Gem::Security::Exception,
                  "unsigned gems are not allowed by the #{name} policy"
        Severity: Minor
        Found in lib/rubygems/security/policy.rb - About 3 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 Reader has 30 methods (exceeds 20 allowed). Consider refactoring.
        Open

            class Reader
              class Error < StandardError
              end
        
              class UnsupportedVersionError < Error
        Severity: Minor
        Found in lib/rubygems/safe_marshal/reader.rb - About 3 hrs to fix

          Method _load has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

            def self._load(str)
              Gem.load_yaml
              Gem.load_safe_marshal
          
              yaml_set = false
          Severity: Minor
          Found in lib/rubygems/specification.rb - About 3 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 candidate has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

            def candidate(word)
              list = []
              case word
              when '-'
                long = short = true
          Severity: Minor
          Found in lib/rubygems/vendor/optparse/lib/optparse.rb - About 3 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 set_range has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

            def set_range(r, e = nil)
              unless r
                @header.delete 'range'
                return r
              end
          Severity: Minor
          Found in lib/rubygems/vendor/net-http/lib/net/http/header.rb - About 3 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 request has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

                def request(sender, tout)
                  start = Process.clock_gettime(Process::CLOCK_MONOTONIC)
                  timelimit = start + tout
                  begin
                    sender.send
          Severity: Minor
          Found in lib/rubygems/vendor/resolv/lib/resolv.rb - About 3 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 connect has 89 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def connect
                if use_ssl?
                  # reference early to load OpenSSL before connecting,
                  # as OpenSSL may take time to load.
                  @ssl_context = OpenSSL::SSL::SSLContext.new
          Severity: Major
          Found in lib/rubygems/vendor/net-http/lib/net/http.rb - About 3 hrs to fix

            Class GemHelper has 29 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class GemHelper
                include Rake::DSL if defined? Rake::DSL
            
                class << self
                  # set when install'd.
            Severity: Minor
            Found in bundler/lib/bundler/gem_helper.rb - About 3 hrs to fix

              Class Changelog has 29 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Changelog
                def self.for_rubygems(version)
                  @for_rubygems ||= new(
                    File.expand_path("../CHANGELOG.md", __dir__),
                    version,
              Severity: Minor
              Found in tool/changelog.rb - About 3 hrs to fix

                Class SetupCommand has 29 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Gem::Commands::SetupCommand < Gem::Command
                  HISTORY_HEADER = %r{^#\s*[\d.a-zA-Z]+\s*/\s*\d{4}-\d{2}-\d{2}\s*$}
                  VERSION_MATCHER = %r{^#\s*([\d.a-zA-Z]+)\s*/\s*\d{4}-\d{2}-\d{2}\s*$}
                
                  ENV_PATHS = %w[/usr/bin/env /bin/env].freeze
                Severity: Minor
                Found in lib/rubygems/commands/setup_command.rb - About 3 hrs to fix

                  Method generate_spdx_license_list has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  def generate_spdx_license_list(dest = "lib/rubygems/util/licenses.rb")
                    base = URI("https://spdx.org/licenses/")
                    updates = [
                      %w[licenses licenseId isDeprecatedLicenseId],
                      %w[exceptions licenseExceptionId isDeprecatedLicenseId],
                  Severity: Major
                  Found in tool/generate_spdx_license_list.rb - About 3 hrs to fix

                    Method for has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def for(dependencies, check = false, platforms = [nil])
                          handled = ["bundler"].product(platforms).map {|k| [k, true] }.to_h
                          deps = dependencies.product(platforms)
                          specs = []
                    
                    
                    Severity: Minor
                    Found in bundler/lib/bundler/spec_set.rb - About 3 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