rubinius/rubinius

View on GitHub

Showing 1,079 of 1,541 total issues

Method max has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def max(n=nil)
    if n.nil?
      max = undefined
      each do
        element = Rubinius.single_block_arg
Severity: Minor
Found in core/enumerable.rb - About 3 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 has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def each
    return to_enum { size } unless block_given?
    first, last = @begin, @end

    unless first.respond_to?(:succ) && !first.kind_of?(Time)
Severity: Minor
Found in core/range.rb - About 3 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 min has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def min(n=nil)
    if n.nil?
      min = undefined
      each do
        element = Rubinius.single_block_arg
Severity: Minor
Found in core/enumerable.rb - About 3 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 select has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

    def self.select(readables, writables, errorables, timeout)
      read_set, highest_read_fd = readables.nil? ? [nil, nil] : fd_set_from_array(readables)
      write_set, highest_write_fd = writables.nil? ? [nil, nil] : fd_set_from_array(writables)
      error_set, highest_err_fd = errorables.nil? ? [nil, nil] : fd_set_from_array(errorables)
      max_fd = [highest_read_fd, highest_write_fd, highest_err_fd].compact.max || -1
Severity: Minor
Found in core/io.rb - About 3 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 join has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def join(sep=nil)
    return "".force_encoding(Encoding::US_ASCII) if @total == 0

    out = ""
    raise ArgumentError, "recursive array join" if Thread.detect_recursion self do
Severity: Minor
Found in core/array.rb - About 3 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 public_instance_method has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
Open

  def public_instance_method(name)
    name = Rubinius::Type.coerce_to_symbol name

    mod = self
    while mod
Severity: Minor
Found in core/module.rb - About 3 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 Tuple has 28 methods (exceeds 20 allowed). Consider refactoring.
Open

  class Tuple
    include Enumerable

    def self.new(cnt)
      Rubinius.primitive :tuple_allocate
Severity: Minor
Found in core/tuple.rb - About 3 hrs to fix

    Method run has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

        def run(factory=ERB)
          trim_mode = 0
          disable_percent = false
          begin
            while switch = ARGV.switch
    Severity: Minor
    Found in library/bin/erb.rb - About 3 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 detect_functions has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

      def detect_functions
        if has_function("clock_gettime", ["time.h"])
          @defines << "HAVE_CLOCK_GETTIME"
        end
    
    
    Severity: Minor
    Found in configure.rb - About 3 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 upto has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

      def upto(stop, exclusive=false)
        return to_enum :upto, stop, exclusive unless block_given?
        stop = StringValue(stop)
    
        if stop.size == 1 && size == 1
    Severity: Minor
    Found in core/string.rb - About 3 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 call has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

          def call(env, start)
            raise "invalid usage" if start
    
            # Even though the recursive entry is zero width
            # in this case, its left separator is still the
    Severity: Minor
    Found in core/dir_glob.rb - About 3 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 23 (exceeds 5 allowed). Consider refactoring.
    Open

      def [](idx, len = nil)
        return to_a[idx, len] if len
    
        case idx
        when Fixnum
    Severity: Minor
    Found in core/match_data.rb - About 3 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 Dir has 27 methods (exceeds 20 allowed). Consider refactoring.
    Open

    class Dir
      include Enumerable
    
      def self.allocate
        Rubinius.primitive :dir_allocate
    Severity: Minor
    Found in core/dir.rb - About 3 hrs to fix

      Method register has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        def register
          if config[:formatter].nil?
            config[:formatter] = @files.size < 50 ? DottedFormatter : FileFormatter
          end
      
      
      Severity: Minor
      Found in mspec/lib/mspec/utils/script.rb - About 3 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 insert has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

          def insert(item, &block)
            redistribute if @size > @max
      
            if block_given?
              item_hash = yield(item).hash
      Severity: Minor
      Found in core/identity_map.rb - About 3 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 __marshal__ has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        def __marshal__(ms)
          if nan?
            str = "nan"
          elsif zero?
            str = (1.0 / self) < 0 ? '-0' : '0'
      Severity: Minor
      Found in core/marshal.rb - About 3 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 22 (exceeds 5 allowed). Consider refactoring.
      Open

        def <=>(other)
          if other.kind_of?(String)
            result = @data.compare_bytes(other.__data__, @num_bytes, other.bytesize)
      
            if result == 0
      Severity: Minor
      Found in core/string.rb - About 3 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 push_format_string has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

              def push_format_string
                float_format_code = @format_code
      
                leader = "%#{@flags}"
                if !@width_index && !@prec_index
      Severity: Minor
      Found in core/sprinter.rb - About 3 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 pointer.rb has 294 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      module Rubinius
        module FFI
          # We need to define this so we can include it. Since the file is
          # auto-generated, we can't pull it in here but we don't want to break the
          # alphabetized load order for random cases.
      Severity: Minor
      Found in core/pointer.rb - About 3 hrs to fix

        Class Rational has 26 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class Rational < Numeric
          attr_reader :numerator
          attr_reader :denominator
        
          def *(other)
        Severity: Minor
        Found in core/rational.rb - About 3 hrs to fix
          Severity
          Category
          Status
          Source
          Language