Sha256: 9a045748d128f860b063203ad18ab9a96b39974f9abc27bc336cdff2e8066431

Contents?: true

Size: 996 Bytes

Versions: 1

Compression:

Stored size: 996 Bytes

Contents

# frozen_string_literal: true

module SpaceCheckstyleReports::Entity
  class FoundError
    # A detected line number
    #
    # @return [Fixnum]
    attr_reader :line_number

    # A detected column
    # Optionality depends on 'source'
    #
    # @return [Fixnum, nil]
    attr_reader :column_number

    # A severity of this error
    #
    # @return [String]
    attr_reader :severity

    # An error message
    #
    # @return [String]
    attr_reader :html_unescaped_message

    # A name of a detector
    #
    # @return [String]
    attr_reader :source # String

    def initialize(node)
      raise "Wrong node was passed. expected error but #{node.name}" if node.name != "error"

      attributes = node.attributes

      @line_number = attributes["line"].to_i
      @column_number = attributes["column"]&.to_i
      @severity = attributes["severity"]
      @html_unescaped_message = attributes["message"] # unescape implicitly
      @source = attributes["source"]
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
danger-space_checkstyle_reports-1.0.1 lib/space_checkstyle_reports/entity/found_error.rb