class RuboCop::Cop::Offense

An offense represents a style violation detected by RuboCop.

def <=>(other)

Returns:
  • (Integer) -

Other tags:
    Api: - public
def <=>(other)
  COMPARISON_ATTRIBUTES.each do |attribute|
    result = send(attribute) <=> other.send(attribute)
    return result unless result == 0
  end
  0
end

def ==(other)

Returns:
  • (Boolean) -

Other tags:
    Api: - public
def ==(other)
  COMPARISON_ATTRIBUTES.all? do |attribute|
    send(attribute) == other.send(attribute)
  end
end

def column

Other tags:
    Api: - private
def column
  location.column
end

def hash

def hash
  COMPARISON_ATTRIBUTES.reduce(0) do |hash, attribute|
    hash ^ send(attribute).hash
  end
end

def initialize(severity, location, message, cop_name, corrected = false)

Other tags:
    Api: - private
def initialize(severity, location, message, cop_name, corrected = false)
  @severity = RuboCop::Cop::Severity.new(severity)
  @location = location
  @message = message.freeze
  @cop_name = cop_name.freeze
  @corrected = corrected
  freeze
end

def line

Other tags:
    Api: - private
def line
  location.line
end

def real_column

Other tags:
    Api: - private
def real_column
  column + 1
end

def to_s

Other tags:
    Api: - private
def to_s
  format('%s:%3d:%3d: %s',
         severity.code, line, real_column, message)
end