Sha256: a597df5d5341e1d82d4b488e22612c78302c395d853bd04af4aa64360bbd095a

Contents?: true

Size: 493 Bytes

Versions: 2

Compression:

Stored size: 493 Bytes

Contents

# frozen_string_literal: true

class PmdViolation
  PRIORITY_ERROR_THRESHOLD = 4
  attr_accessor :violation

  def initialize(violation)
    @violation = violation
  end

  def priority
    @priority ||= violation.attribute("priority").value.to_i
  end

  def type
    @type ||= priority < PRIORITY_ERROR_THRESHOLD ? :warn : :fail
  end

  def line
    @line ||= violation.attribute("beginline").value.to_i
  end

  def description
    @description ||= violation.text.gsub("\n", "")
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
danger-pmd-1.0.1 lib/pmd/entity/pmd_violation.rb
danger-pmd-0.4.0 lib/pmd/entity/pmd_violation.rb