Sha256: c49656143cbbbfc9c70aa4c04f679f33801a177974ca011500b271574b9f0da8
Contents?: true
Size: 951 Bytes
Versions: 3
Compression:
Stored size: 951 Bytes
Contents
# frozen_string_literal: true # Represent a PMD file. class PmdFile require_relative './pmd_violation' attr_accessor :file # An absolute path to this file # # @return [String] attr_reader :absolute_path # A relative path to this file # # @return [String] attr_reader :relative_path def initialize(prefix, file) @file = file @absolute_path = file.attribute('name').value.to_s prefix += (prefix.end_with?(file_separator) ? '' : file_separator) @relative_path = if @absolute_path.start_with?(prefix) @absolute_path[prefix.length, @absolute_path.length - prefix.length] else @absolute_path end end def violations @violations ||= file.xpath('violation').map do |pmd_violation| PmdViolation.new(pmd_violation) end end private def file_separator File::ALT_SEPARATOR || File::SEPARATOR end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
danger-pmd-1.0.5 | lib/pmd/entity/pmd_file.rb |
danger-pmd-1.0.4 | lib/pmd/entity/pmd_file.rb |
danger-pmd-1.0.3 | lib/pmd/entity/pmd_file.rb |