Sha256: 865bcc0626db38c8df8c77e134e8c82d1c0f0e2f836c3fa1b53c3fdb826eaeb1

Contents?: true

Size: 522 Bytes

Versions: 4

Compression:

Stored size: 522 Bytes

Contents

# frozen_string_literal: true

# Represent a PMD violation.
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

4 entries across 4 versions & 1 rubygems

Version Path
danger-pmd-1.0.5 lib/pmd/entity/pmd_violation.rb
danger-pmd-1.0.4 lib/pmd/entity/pmd_violation.rb
danger-pmd-1.0.3 lib/pmd/entity/pmd_violation.rb
danger-pmd-1.0.2 lib/pmd/entity/pmd_violation.rb