rubinius/rubinius

View on GitHub

Showing 1,321 of 1,541 total issues

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

  def chomp!(sep=undefined)
    Rubinius.check_frozen

    if undefined.equal?(sep)
      sep = $/
Severity: Minor
Found in core/string.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 each_line has a Cognitive Complexity of 45 (exceeds 5 allowed). Consider refactoring.
Open

  def each_line(sep=$/)
    return to_enum(:each_line, sep) unless block_given?

    # weird edge case.
    if sep.nil?
Severity: Minor
Found in core/string.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 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 options has 169 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def options
    @options = Rubinius::Options.new "Usage: configure [options]", 30
    o = @options
    o.left_align

Severity: Major
Found in configure.rb - About 6 hrs to fix

    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

                Method add_install_update_options has 153 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 library/rubygems/install_update_options.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

                    Severity
                    Category
                    Status
                    Source
                    Language