rubinius/rubinius

View on GitHub

Showing 1,321 of 1,541 total issues

Method validate has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

  def validate packaging = true
    @warnings = 0
    require 'rubygems/user_interaction'
    extend Gem::UserInteraction
    normalize
Severity: Minor
Found in library/rubygems/specification.rb - About 1 day 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 popen has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
Open

  def self.popen(*args)
    if env = Rubinius::Type.try_convert(args.first, Hash, :to_hash)
      args.shift
    end

Severity: Minor
Found in core/io.rb - About 1 day 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 222 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def options(argv=ARGV)
      @stage = "processing command line arguments"

      options = Options.new "Usage: rbx [subcommand] [options] [--] [script] [arguments]", 25

Severity: Major
Found in core/loader.rb - About 1 day to fix

    Class Module has 61 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Module
    
      attr_reader :constant_table
      attr_writer :method_table
    
    
    Severity: Major
    Found in core/module.rb - About 1 day to fix

      Class Hash has 60 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Hash
        include Enumerable
      
        Vector = Rubinius::Tuple
      
      
      Severity: Major
      Found in core/hash.rb - About 1 day to fix

        Method normalize_options has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring.
        Open

          def self.normalize_options(mode, options)
            mode = nil if undefined.equal?(mode)
            autoclose = true
            encoding_options = {}
        
        
        Severity: Minor
        Found in core/io.rb - About 1 day 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 split has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.split(string, pattern, limit)
              # Odd edge case
              return [] if string.empty?
        
              tail_empty = false
        Severity: Minor
        Found in core/splitter.rb - About 1 day 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 sample has a Cognitive Complexity of 52 (exceeds 5 allowed). Consider refactoring.
        Open

          def sample(count=undefined, options=undefined)
            return at Kernel.rand(size) if undefined.equal? count
        
            if undefined.equal? options
              if o = Rubinius::Type.check_convert_type(count, Hash, :to_hash)
        Severity: Minor
        Found in core/array.rb - About 1 day 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 write_configure_files has 197 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def write_configure_files
            @log.write "\nWriting configuration files..."
        
            @bin_links.delete @program_name
        
        
        Severity: Major
        Found in configure.rb - About 7 hrs to fix

          Method tr_trans has a Cognitive Complexity of 50 (exceeds 5 allowed). Consider refactoring.
          Open

            def tr_trans(source, replacement, squeeze)
              source = StringValue(source).dup
              replacement = StringValue(replacement).dup
          
              return delete!(source) if replacement.empty?
          Severity: Minor
          Found in core/string.rb - About 7 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 Time has 54 methods (exceeds 20 allowed). Consider refactoring.
          Open

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

            Class Integer has 54 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Integer < Numeric
              def self.===(obj)
                Rubinius.asm do
                  int = new_label
                  done = new_label
            Severity: Major
            Found in core/integer.rb - About 7 hrs to fix

              Method gsub has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
              Open

                def gsub(pattern, replacement=undefined)
                  # Because of the behavior of $~, this is duplicated from gsub! because
                  # if we call gsub! from gsub, the last_match can't be updated properly.
              
                  unless valid_encoding?
              Severity: Minor
              Found in core/string.rb - About 7 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 installer.rb has 482 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              require 'rubygems/command'
              require 'rubygems/exceptions'
              require 'rubygems/package'
              require 'rubygems/ext'
              require 'rubygems/user_interaction'
              Severity: Minor
              Found in library/rubygems/installer.rb - About 7 hrs to fix

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

                  def gsub!(pattern, replacement=undefined)
                    # Because of the behavior of $~, this is duplicated from gsub! because
                    # if we call gsub! from gsub, the last_match can't be updated properly.
                
                    unless valid_encoding?
                Severity: Minor
                Found in core/string.rb - About 7 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 Stat has 52 methods (exceeds 20 allowed). Consider refactoring.
                Open

                  class Stat
                    include Comparable
                
                    attr_reader :path
                
                
                Severity: Major
                Found in core/stat.rb - About 7 hrs to fix

                  Method compile has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def self.compile(pattern, flags=0, patterns=[])
                        escape = (flags & File::FNM_NOESCAPE) == 0
                  
                        rbrace = nil
                        lbrace = nil
                  Severity: Minor
                  Found in core/dir_glob.rb - About 7 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 braces has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def self.braces(pattern, flags=0, patterns=[])
                      escape = (flags & FNM_NOESCAPE) == 0
                  
                      rbrace = nil
                      lbrace = nil
                  Severity: Minor
                  Found in core/file.rb - About 7 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 slice! has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def slice!(start, length=undefined)
                      Rubinius.check_frozen
                  
                      if undefined.equal? length
                        if start.kind_of? Range
                  Severity: Minor
                  Found in core/array.rb - About 7 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 Thread has 50 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class Thread
                    attr_reader :recursive_objects
                    attr_reader :pid
                    attr_reader :exception
                    attr_reader :stack_size
                  Severity: Minor
                  Found in core/thread.rb - About 7 hrs to fix
                    Severity
                    Category
                    Status
                    Source
                    Language