rubinius/rubinius

View on GitHub

Showing 1,079 of 1,541 total issues

Method doctor_child has a Cognitive Complexity of 32 (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 ent == "." || ent == ".."
Severity: Minor
Found in library/rubygems/doctor.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 verify_call has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def self.verify_call(obj, sym, *args, &block)
    compare = *args
    behaves_like_ruby_1_9 = *[]
    if (behaves_like_ruby_1_9)
      compare = compare.first if compare.length <= 1
Severity: Minor
Found in mspec/lib/mspec/mocks/mock.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 check_tools has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def check_tools
    @cc ||= ENV['CC'] || default_cc
    @cxx ||= ENV['CXX'] || default_cxx

    check_tool_version @cc, '-dumpversion', [4, 1]
Severity: Minor
Found in configure.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 bsearch has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def bsearch
    return to_enum :bsearch unless block_given?

    unless @begin.kind_of? Numeric and @end.kind_of? Numeric
      raise TypeError, "bsearch is not available for #{@begin.class}"
Severity: Minor
Found in core/range.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 rb_integer_pack has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def self.rb_integer_pack(value, words, numwords, wordsize, nails, flags)
      digits = INTEGER_PACK_DIGITS
      numbytes = numwords * wordsize
      nibble_size = numbytes * 2

Severity: Minor
Found in core/capi.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 chunk has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

  def chunk
    raise ArgumentError, "no block given" unless block_given?
    ::Enumerator.new do |yielder|
      previous = nil
      accumulate = []
Severity: Minor
Found in core/enumerable.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 last_error has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
Open

    def last_error
      error = Rubinius.invoke_primitive :encoding_converter_last_error, self
      return if error.nil?

      result = error[:result]
Severity: Minor
Found in core/encoding.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

Class Regexp has 36 methods (exceeds 20 allowed). Consider refactoring.
Open

class Regexp
  def self.allocate
    Rubinius.primitive :regexp_allocate
    raise PrimitiveFailure, "Regexp.allocate primitive failed"
  end
Severity: Minor
Found in core/regexp.rb - About 4 hrs to fix

    File package.rb has 359 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require 'rubygems/security'
    require 'rubygems/specification'
    require 'rubygems/user_interaction'
    require 'zlib'
    
    
    Severity: Minor
    Found in library/rubygems/package.rb - About 4 hrs to fix

      Method use_gemdeps has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.use_gemdeps path = nil
          raise_exception = path
      
          path ||= ENV['RUBYGEMS_GEMDEPS']
          return unless path
      Severity: Minor
      Found in library/rubygems.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 search has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.search(source, target)
              if entry = TranscodingMap[source]
                if entry[target]
                  return [source, target]
                else
      Severity: Minor
      Found in core/encoding.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

      Class EnvironmentVariables has 35 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class EnvironmentVariables
          include Enumerable
      
          def [](key)
            value = getenv(StringValue(key))
      Severity: Minor
      Found in core/env.rb - About 4 hrs to fix

        Class ARGFClass has 35 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class ARGFClass
            include Enumerable
        
            # :internal:
            #
        Severity: Minor
        Found in core/argf.rb - About 4 hrs to fix

          Method find_gems_with_sources has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

            def find_gems_with_sources dep, best_only=false # :nodoc:
              set = Gem::AvailableSet.new
          
              if consider_local?
                sl = Gem::Source::Local.new
          Severity: Minor
          Found in library/rubygems/dependency_installer.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 byteslice has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

            def byteslice(index_or_range, length=undefined)
              Rubinius.primitive :string_byte_substring
          
              if index_or_range.kind_of? Range
                index = Rubinius::Type.coerce_to index_or_range.begin, Fixnum, :to_int
          Severity: Minor
          Found in core/string.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 sub has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

            def sub(pattern, replacement=undefined)
              # Because of the behavior of $~, this is duplicated from sub! because
              # if we call sub! from sub, the last_match can't be updated properly.
          
              unless valid_encoding?
          Severity: Minor
          Found in core/string.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 sub! has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
          Open

            def sub!(pattern, replacement=undefined)
              # Because of the behavior of $~, this is duplicated from sub! because
              # if we call sub! from sub, the last_match can't be updated properly.
          
              unless valid_encoding?
          Severity: Minor
          Found in core/string.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

          Class Complex has 34 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class Complex < Numeric
          
            undef_method :%
            undef_method :<
            undef_method :<=
          Severity: Minor
          Found in core/complex.rb - About 4 hrs to fix

            Method alien has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
            Open

              def alien(gems=[])
                errors = Hash.new { |h,k| h[k] = {} }
            
                Gem::Specification.each do |spec|
                  next unless gems.include? spec.name unless gems.empty?
            Severity: Minor
            Found in library/rubygems/validator.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 generate has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
            Open

                  def generate
                    typedefs = BodyGuard.new(self, "ffi_types_generator", @platform).perform
            
                    code = ""
            
            
            Severity: Minor
            Found in library/ffi/generators/types.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