Sha256: acf330b8340ff317e3ae677fc881612c7969214b6b02edd8e1732334606bb6d7

Contents?: true

Size: 493 Bytes

Versions: 6

Compression:

Stored size: 493 Bytes

Contents

# frozen_string_literal: true

class PmdViolation
  PRIORITY_ERROR_THRESHOLD = 2
  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

6 entries across 6 versions & 1 rubygems

Version Path
danger-pmd-0.3.0 lib/pmd/entity/pmd_violation.rb
danger-pmd-0.2.2 lib/pmd/pmd_violation.rb
danger-pmd-0.2.1 lib/pmd/pmd_violation.rb
danger-pmd-0.2.0 lib/pmd/pmd_violation.rb
danger-pmd-0.1.1 lib/pmd/pmd_violation.rb
danger-pmd-0.1.0 lib/pmd/pmd_violation.rb