Sha256: ef05d14c7157f501e32db83cc0ff98f85bbe306ec8fad0bd1f30a09457d17fc8

Contents?: true

Size: 591 Bytes

Versions: 5

Compression:

Stored size: 591 Bytes

Contents

# frozen_string_literal: true

class PmdFile
  require_relative "./pmd_violation"
  attr_accessor :module_name
  attr_accessor :file

  def initialize(module_name, file)
    @module_name = module_name
    @file = file
  end

  def source_path
    @source_path ||= file.attribute("name").value.to_s
  end

  def absolute_path
    @absolute_path ||= Pathname.new(source_path[source_path.index(module_name), source_path.length]).to_s
  end

  def violations
    @violations ||= file.xpath("violation").map do |pmd_violation|
      PmdViolation.new(module_name, pmd_violation)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
danger-pmd-0.0.5 lib/pmd/pmd_file.rb
danger-pmd-0.0.4 lib/pmd/pmd_file.rb
danger-pmd-0.0.3 lib/pmd/pmd_file.rb
danger-pmd-0.0.2 lib/pmd/pmd_file.rb
danger-pmd-0.0.1 lib/pmd/pmd_file.rb