Sha256: cae7f460e6247cb3309b04ca869e0ee37467c7271565d6719edc9f3b2e92d1b2

Contents?: true

Size: 991 Bytes

Versions: 10

Compression:

Stored size: 991 Bytes

Contents

# frozen_string_literal: true

module CheckstyleReports::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

10 entries across 10 versions & 3 rubygems

Version Path
danger-space_checkstyle_reports-1.0.3 lib/checkstyle_reports/entity/found_error.rb
danger-space_checkstyle_reports-1.0.2 lib/checkstyle_reports/entity/found_error.rb
ktlint_reporter-1.0.1 lib/checkstyle_reports/entity/found_error.rb
ktlint_reporter-1.0.0 lib/checkstyle_reports/entity/found_error.rb
ktlint_reporter-0.1.2 lib/checkstyle_reports/entity/found_error.rb
ktlint_reporter-0.1.1 lib/checkstyle_reports/entity/found_error.rb
ktlint_reporter-0.1.0 lib/checkstyle_reports/entity/found_error.rb
danger-checkstyle_reports-0.1.0 lib/checkstyle_reports/entity/found_error.rb
danger-checkstyle_reports-0.0.1.pre.rc02 lib/checkstyle_reports/entity/found_error.rb
danger-checkstyle_reports-0.0.1.pre.rc01 lib/checkstyle_reports/entity/found_error.rb