rubinius/rubinius

View on GitHub

Showing 1,321 of 1,541 total issues

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 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 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

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

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

      def setup_llvm
        @log.print "  Checking for 'llvm-config': "
    
        config = @llvm_configure
        if !config
    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 puts has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

      def puts(*args)
        if args.empty?
          write DEFAULT_RECORD_SEPARATOR
        else
          args.each do |arg|
    Severity: Minor
    Found in core/io.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 reopen has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

      def reopen(other, mode=undefined)
        if other.respond_to?(:to_io)
          flush
    
          if other.kind_of? IO
    Severity: Minor
    Found in core/io.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 strip_bom has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

      def strip_bom
        return unless File::Stat.fstat(descriptor).file?
    
        case b1 = getbyte
        when 0x00
    Severity: Minor
    Found in core/io.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 read has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

        def read(bytes=nil, output=nil)
          # The user might try to pass in nil, so we have to check here
          output ||= default_value
          output.clear
    
    
    Severity: Minor
    Found in core/argf.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 trap has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.trap(sig, prc=nil, &block)
        sig = sig.to_s if sig.kind_of?(Symbol)
    
        if sig.kind_of?(String)
          osig = sig
    Severity: Minor
    Found in core/signal.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 round has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

      def round(ndigits=undefined)
        return self if undefined.equal? ndigits
    
        if ndigits.kind_of? Numeric
          if ndigits > Fixnum::MAX or ndigits <= Fixnum::MIN
    Severity: Minor
    Found in core/integer.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

    File dir_glob.rb has 342 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Dir
      module Glob
        class Node
          def initialize(nxt, flags)
            @flags = flags
    Severity: Minor
    Found in core/dir_glob.rb - About 4 hrs to fix

      Method require has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

        def require path
          RUBYGEMS_ACTIVATION_MONITOR.enter
      
          path = path.to_path if path.respond_to? :to_path
      
      
      Severity: Minor
      Found in library/rubygems/core_ext/kernel_require.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 open_class_under has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.open_class_under(name, sup, mod)
          unless Type.object_kind_of? mod, Module
            raise TypeError, "'#{mod.inspect}' is not a class/module"
          end
      
      
      Severity: Minor
      Found in core/zed.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 succ! has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

        def succ!
          self.modify!
      
          return self if @num_bytes == 0
      
      
      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 find_const has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
      Open

        def find_const(under)
          current = under
          constant = undefined
      
          while current
      Severity: Minor
      Found in core/autoload.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

      File user_interaction.rb has 335 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'rubygems/util'
      
      ##
      # Module that defines the default UserInteraction.  Any class including this
      # module will have access to the +ui+ method that returns the default UI.
      Severity: Minor
      Found in library/rubygems/user_interaction.rb - About 4 hrs to fix
        Severity
        Category
        Status
        Source
        Language