rubinius/rubinius

View on GitHub

Showing 1,079 of 1,541 total issues

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

  def self.expand_path(path, dir=nil)
    path = Rubinius::Type.coerce_to_path(path)
    str = "".force_encoding path.encoding
    first = path[0]
    if first == ?~
Severity: Minor
Found in core/file.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

File exception.rb has 406 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class Exception
  attr_accessor :locations
  attr_accessor :cause
  attr_accessor :custom_backtrace

Severity: Minor
Found in core/exception.rb - About 5 hrs to fix

    File enumerator.rb has 402 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Enumerator
      include Enumerable
    
      attr_writer :args
      private :args=
    Severity: Minor
    Found in core/enumerator.rb - About 5 hrs to fix

      Method raise has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
      Open

        def raise(exc=undefined, msg=undefined, ctx=nil, cause: nil)
          if undefined.equal? exc
            exc = $!
            exc = RuntimeError.new("No current exception") unless exc
            exc.cause = cause unless exc.cause or exc == cause
      Severity: Minor
      Found in core/zed.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

      File time.rb has 397 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      class Time
        include Comparable
      
        def self.now
          Rubinius.primitive :time_s_now
      Severity: Minor
      Found in core/time.rb - About 5 hrs to fix

        File ffi.rb has 394 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        module Rubinius
          module FFI
        
            #  Specialised error classes
            class TypeError < RuntimeError; end
        Severity: Minor
        Found in core/ffi.rb - About 5 hrs to fix

          Method install has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

            def install options, &block # :yields: request, installer
              if dir = options[:install_dir]
                requests = install_into dir, false, options, &block
                return requests
              end
          Severity: Minor
          Found in library/rubygems/request_set.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 include_modules_from has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
          Open

              def self.include_modules_from(included_module, klass)
                insert_at = klass
                constants_changed = false
          
                mod = included_module
          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

          File alpha.rb has 391 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          class NilClass
            def nil?
              true
            end
          
          
          Severity: Minor
          Found in core/alpha.rb - About 5 hrs to fix

            Class CompiledCode has 40 methods (exceeds 20 allowed). Consider refactoring.
            Open

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

              Class Float has 40 methods (exceeds 20 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 5 hrs to fix

                Method execute has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
                Open

                  def execute
                    specs = if options[:all] then
                              Gem::Specification.map
                
                            # `--extensions` must be explicitly given to pristine only gems
                Severity: Minor
                Found in library/rubygems/commands/pristine_command.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 Command has 39 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Gem::Command
                
                  include Gem::UserInteraction
                
                  ##
                Severity: Minor
                Found in library/rubygems/command.rb - About 5 hrs to fix

                  Class Numeric has 39 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Numeric
                    include Comparable
                  
                    # Always raises TypeError, as dup'ing Numerics is not allowed.
                    def initialize_copy(other)
                  Severity: Minor
                  Found in core/numeric.rb - About 5 hrs to fix

                    File options.rb has 379 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    require 'mspec/version'
                    
                    class MSpecOption
                      attr_reader :short, :long, :arg, :description, :block
                    
                    
                    Severity: Minor
                    Found in mspec/lib/mspec/utils/options.rb - About 5 hrs to fix

                      Method show has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def show(sep="\n", show_color=true)
                          show_color = false unless @colorize
                          clear = show_color ? "\033[0m" : ""
                      
                          max = 0
                      Severity: Minor
                      Found in core/backtrace.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

                      File licenses.rb has 370 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      require 'rubygems/text'
                      
                      class Gem::Licenses
                        extend Gem::Text
                      
                      
                      Severity: Minor
                      Found in library/rubygems/util/licenses.rb - About 4 hrs to fix

                        Class Loader has 37 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                          class Loader
                            def initialize
                              @exit_code    = 0
                              @process_id   = Process.pid
                              @load_paths   = []
                        Severity: Minor
                        Found in core/loader.rb - About 4 hrs to fix

                          Class Pointer has 37 methods (exceeds 20 allowed). Consider refactoring.
                          Open

                              class Pointer
                                include PointerAccessors
                          
                                def initialize(a1, a2=undefined)
                                  if undefined.equal? a2
                          Severity: Minor
                          Found in core/pointer.rb - About 4 hrs to fix

                            File dependency_grapher.rb has 366 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            require 'set'
                            
                            module Daedalus
                            class DependencyGrapher
                              DEV_NULL = RUBY_PLATFORM =~ /mingw|mswin/ ? 'NUL' : '/dev/null'
                            Severity: Minor
                            Found in build/scripts/dependency_grapher.rb - About 4 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language