rubinius/rubinius

View on GitHub

Showing 1,079 of 1,541 total issues

Method step has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

  def step(limit=nil, step=nil, to: nil, by: nil)
    unless block_given?
      return to_enum(:step, limit, step, to: to, by: by) do
        Rubinius::Mirror::Numeric.reflect(self).step_size(limit, step, to, by)
      end
Severity: Minor
Found in core/numeric.rb - About 6 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 fill has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

  def fill(a=undefined, b=undefined, c=undefined)
    Rubinius.check_frozen

    if block_given?
      unless undefined.equal?(c)
Severity: Minor
Found in core/array.rb - About 6 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 44 (exceeds 5 allowed). Consider refactoring.
Open

    def initialize(from, to, options=undefined)
      @source_encoding = Rubinius::Type.coerce_to_encoding from
      @destination_encoding = Rubinius::Type.coerce_to_encoding to

      if options.kind_of? Fixnum
Severity: Minor
Found in core/encoding.rb - About 6 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 44 (exceeds 5 allowed). Consider refactoring.
Open

        def initialize(env_or_cmd, *args)
          if options = Rubinius::Type.try_convert(args.last, ::Hash, :to_hash)
            args.pop
          end

Severity: Minor
Found in core/process_mirror.rb - About 6 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 regexp.rb has 446 lines of code (exceeds 250 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 6 hrs to fix

    Class FileDescriptor has 48 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class FileDescriptor
        class RIOStream
          def self.close(io, allow_exception)
            Rubinius.primitive :rio_close
            raise PrimitiveFailure, "IO::FileDescriptor::RIOStream.close primitive failed"
    Severity: Minor
    Found in core/io.rb - About 6 hrs to fix

      File encoding.rb has 444 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class EncodingError < StandardError
      end
      
      class Encoding
        class UndefinedConversionError < EncodingError
      Severity: Minor
      Found in core/encoding.rb - About 6 hrs to fix

        File setup_command.rb has 441 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require 'rubygems/command'
        
        ##
        # Installs RubyGems itself.  This command is ordinarily only available from a
        # RubyGems checkout or tarball.
        Severity: Minor
        Found in library/rubygems/commands/setup_command.rb - About 6 hrs to fix

          File float.rb has 440 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class Float < Numeric
            def **(other)
              Rubinius.primitive :float_pow
          
              if other.is_a?(Float) && self < 0 && other != other.round
          Severity: Minor
          Found in core/float.rb - About 6 hrs to fix

            Method options has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
            Open

                def options(argv=ARGV)
                  @stage = "processing command line arguments"
            
                  options = Options.new "Usage: rbx [subcommand] [options] [--] [script] [arguments]", 25
            
            
            Severity: Minor
            Found in core/loader.rb - About 6 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 State has 45 methods (exceeds 20 allowed). Consider refactoring.
            Open

              class State
            
                def initialize(stream, depth, proc)
                  # shared
                  @links = Rubinius::LookupTable.new
            Severity: Minor
            Found in core/marshal.rb - About 6 hrs to fix

              File compiled_code.rb has 421 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Rubinius
                class CompiledCode < Executable
                  def self.allocate
                    Rubinius.primitive :compiledcode_allocate
                    raise PrimitiveFailure, "CompiledCode.allocate primitive failed"
              Severity: Minor
              Found in core/compiled_code.rb - About 6 hrs to fix

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

                  def download(spec, source_uri, install_dir = Gem.dir)
                    cache_dir =
                      if Dir.pwd == install_dir then # see fetch_command
                        install_dir
                      elsif File.writable? install_dir then
                Severity: Minor
                Found in library/rubygems/remote_fetcher.rb - About 6 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 layout has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                Open

                      def self.layout(*spec)
                        return @layout if spec.size == 0
                
                        # Pick up a enclosing FFI::Library
                        @enclosing_module ||= find_nested_parent
                Severity: Minor
                Found in core/ffi.rb - About 6 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 [] has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring.
                Open

                  def [](arg1, arg2=nil)
                    case arg1
                
                    # This is split out from the generic case and put first because
                    # it is by far the most common case and we want to deal with it
                Severity: Minor
                Found in core/array.rb - About 6 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 resolve_for has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                Open

                  def resolve_for needed, specs
                    while needed
                      dep = needed.value
                      needed = needed.tail
                
                
                Severity: Minor
                Found in library/rubygems/dependency_resolver.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 set_filesystem_paths has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
                Open

                  def set_filesystem_paths
                    @prefixdir = @prefixdir ? expand_install_dir(@prefixdir) : @sourcedir
                
                    if @appdir
                      dir = expand_install_dir @appdir
                Severity: Minor
                Found in configure.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 Installer has 43 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Gem::Installer
                
                  ##
                  # Paths where env(1) might live.  Some systems are broken and have it in
                  # /bin
                Severity: Minor
                Found in library/rubygems/installer.rb - About 5 hrs to fix

                  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],
                  Severity: Minor
                  Found in library/rubygems/request_set/gem_dependency_api.rb - About 5 hrs to fix

                    Method const_get has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def self.const_get(mod, name, inherit=true, resolve=true)
                          unless object_kind_of? name, Symbol
                            name = StringValue(name)
                            if name.index '::' and name.size > 2
                              return const_lookup mod, name, inherit, resolve
                    Severity: Minor
                    Found in core/type.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

                    Severity
                    Category
                    Status
                    Source
                    Language