Skip to content

Commit 8a4187b

Browse files
committed
fix comments
1 parent 45317b5 commit 8a4187b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/pmdtester/parsers/pmd_report_document.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,20 @@ def start_element(name, attrs = [])
2929
case name
3030
when 'file'
3131
@current_violations = []
32-
@current_filename = attrs['name'].sub(/^#{@working_dir}/, '')
32+
@current_filename = remove_work_dir!(attrs['name'])
3333
when 'violation'
3434
@current_violation = PmdViolation.new(attrs, @branch_name)
3535
when 'error'
36-
@current_filename = attrs['filename'].sub(/^#{@working_dir}/, '')
36+
@current_filename = remove_work_dir!(attrs['filename'])
37+
remove_work_dir!(attrs['msg'])
3738
@current_error = PmdError.new(attrs, @branch_name)
3839
end
3940
end
4041

42+
def remove_work_dir!(str)
43+
str.sub!(/^#{@working_dir}/, '')
44+
end
45+
4146
def characters(string)
4247
@current_violation.text = string unless @current_violation.nil?
4348
end

0 commit comments

Comments
 (0)