rubinius/rubinius

View on GitHub

Showing 1,321 of 1,541 total issues

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

    Method inspect has 121 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def inspect
        result_encoding = Encoding.default_internal || Encoding.default_external
        unless result_encoding.ascii_compatible?
          result_encoding = Encoding::US_ASCII
        end
    Severity: Major
    Found in core/string.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

            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

                Method parse_stream has 113 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def parse_stream(f)
                    class_pattern = /class\s+([^\s]+)\s*:\s*public\s+([^\s]+)/
                    slot_pattern = %r!^\s*(\w+)\*?\s+\*?_(\w+)_\s*;\s*//\s*slot(.*)!
                    accessor_pattern = %r!^\s*attr_(accessor|reader|writer)\((\w+),\s*(\w+)\)!
                    primitive_pattern = %r%^\s*//\s+Rubinius.primitive([?!\+])?\s+:(.*)\s*$%
                Severity: Major
                Found in build/scripts/field_extract.rb - About 4 hrs to fix

                  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
                      Severity
                      Category
                      Status
                      Source
                      Language