rubinius/rubinius

View on GitHub

Showing 1,541 of 1,541 total issues

Method local_variable_get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def local_variable_get(name)
    unless name.is_a?(Symbol)
      name = Rubinius::Type.coerce_to(name, String, :to_str).to_sym
    end

Severity: Minor
Found in core/binding.rb - About 25 mins 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 finish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def finish
    switch

    time = @timer.elapsed
    tests = @tally.counter.examples
Severity: Minor
Found in mspec/lib/mspec/runner/formatters/junit.rb - About 25 mins 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 local_variable_set has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def local_variable_set(name, value)
    unless name.is_a?(Symbol)
      name = Rubinius::Type.coerce_to(name, String, :to_str).to_sym
    end

Severity: Minor
Found in core/binding.rb - About 25 mins 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 _load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self._load(data)
    raise TypeError, 'marshaled time format differ' unless data.bytesize == 8

    major, minor = data.unpack 'VV'

Severity: Minor
Found in core/time.rb - About 25 mins 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 argv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def argv(args)
    if args == :restore
      ARGV.replace(@__mspec_saved_argv__ || [])
    else
      @__mspec_saved_argv__ = ARGV
Severity: Minor
Found in mspec/lib/mspec/helpers/argv.rb - About 25 mins 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 install_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.install_method(obj, sym, type=nil)
    meta = obj.singleton_class

    key = replaced_key obj, sym
    sym = sym.to_sym
Severity: Minor
Found in mspec/lib/mspec/mocks/mock.rb - About 25 mins 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 match? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def match?
    match = @platforms.empty? ? true : platform?(*@platforms)
    @options.each do |key, value|
      case key
      when :os
Severity: Minor
Found in mspec/lib/mspec/guards/platform.rb - About 25 mins 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 after has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def after(state)
    if self === state.description and outcome?
      tag = SpecTag.new
      tag.tag = @tag
      tag.comment = @comment
Severity: Minor
Found in mspec/lib/mspec/runner/actions/tag.rb - About 25 mins 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 file_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def file_name(m, c)
    if MAP.key?(m)
      name = MAP[m].is_a?(Hash) ? MAP[m][c.split('::').last] || MAP[m][:default] : MAP[m]
    else
      name = m.gsub(/[?!=]/, '')
Severity: Minor
Found in mspec/lib/mspec/utils/name_map.rb - About 25 mins 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 reject! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def reject!
      return to_enum(:reject!) { size } unless block_given?

      # Avoid deleting from environ while iterating because the
      # OS can handle that in a million different bad ways.
Severity: Minor
Found in core/env.rb - About 25 mins 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 random_range has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def random_range(limit)
    return nil if limit.first.nil? || limit.last.nil?

    min, max = limit.last.coerce(limit.first)
    diff = max - min
Severity: Minor
Found in core/random.rb - About 25 mins 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 message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def message
    if @compiled_code
      if @ip and @ip >= 0
        "#{super} - at #{@compiled_code.name}+#{@ip}"
      else
Severity: Minor
Found in core/exception.rb - About 25 mins 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 add has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def add(short, long, arg, description, block)
    s = short ? short.dup : "  "
    s += (short ? ", " : "  ") if long
    doc "   #{s}#{long} #{arg}".ljust(@width-1) + " #{description}"
    @options << MSpecOption.new(short, long, arg, description, block)
Severity: Minor
Found in mspec/lib/mspec/utils/options.rb - About 25 mins 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 6 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(inst, code, ip)
        @instruction = inst[0]
        @args = inst[1..-1]
        @comment = nil

Severity: Minor
Found in core/compiled_code.rb - About 25 mins 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 cleanup has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.cleanup
    objects.each do |key, obj|
      if obj.kind_of? MockIntObject
        clear_replaced key
        next
Severity: Minor
Found in mspec/lib/mspec/mocks/mock.rb - About 25 mins 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 walk_stream has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def walk_stream(stream, data)
  seq = []
  stream.each do |inst|
    seq << inst.first
    if Terms.include? inst.first
Severity: Minor
Found in machine/super-instruction/analyze.rb - About 25 mins 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 included_in? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def included_in?(bigger)
    return false if bigger.size < size

    idx = 0
    while self[idx] != bigger[idx]
Severity: Minor
Found in machine/super-instruction/show.rb - About 25 mins 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 get_system_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def get_system_name
    return unless @os =~ /linux/
    return unless File.exist? "/etc/issue"

    data = IO.readlines("/etc/issue").first
Severity: Minor
Found in configure.rb - About 25 mins 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 finish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def finish
        Rubinius::Mirror.reflect(@object.group).remove @object

        if exception = @object.exception
          if $DEBUG
Severity: Minor
Found in core/thread_mirror.rb - About 25 mins 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 remove_method has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def remove_method(*names)
    names.each do |name|
      name = Rubinius::Type.coerce_to_symbol(name)
      Rubinius.check_frozen

Severity: Minor
Found in core/zed.rb - About 25 mins 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