Skip to content

Commit fca29f9

Browse files
committed
Merge pull request #76 from oowekyala/pmd-regression-tester:speed
Speedup XML parsing #76
2 parents f1c5a6a + 889a659 commit fca29f9

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

History.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Typeresolution is now supported by two new tags in the project-list.xml file:
1616
* [#70](https://github.com/pmd/pmd-regression-tester/pull/70): Add link to PR on github in HTML report
1717
* [#74](https://github.com/pmd/pmd-regression-tester/pull/74): Merge violations that have just changed messages
1818
* [#75](https://github.com/pmd/pmd-regression-tester/pull/75): Add new option "--error-recovery"
19+
* [#76](https://github.com/pmd/pmd-regression-tester/pull/76): Speedup XML parsing
1920

2021
## External Contributions
2122

lib/pmdtester/parsers/pmd_report_document.rb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,10 @@ def end_element(name)
5858
@violations.add_violations_by_filename(@current_filename, @current_violations)
5959
@current_filename = nil
6060
when 'violation'
61-
@current_violation.text.strip!
62-
@current_violations.push(@current_violation) if match_filter_set?(@current_violation)
61+
if match_filter_set?(@current_violation)
62+
@current_violation.text.strip!
63+
@current_violations.push(@current_violation)
64+
end
6365
@current_violation = nil
6466
when 'error'
6567
@errors.add_error_by_filename(@current_filename, @current_error)
@@ -79,15 +81,12 @@ def cdata_block(string)
7981
def match_filter_set?(violation)
8082
return true if @filter_set.nil?
8183

82-
@filter_set.each do |filter_rule_ref|
83-
ruleset_attr = violation.attrs['ruleset'].delete(' ').downcase + '.xml'
84-
rule = violation.rule_name
85-
rule_ref = "#{ruleset_attr}/#{rule}"
86-
return true if filter_rule_ref.eql?(ruleset_attr)
87-
return true if filter_rule_ref.eql?(rule_ref)
88-
end
84+
ruleset_attr = violation.attrs['ruleset'].delete(' ').downcase + '.xml'
85+
return true if @filter_set.include?(ruleset_attr)
86+
87+
rule_ref = "#{ruleset_attr}/#{violation.rule_name}"
8988

90-
false
89+
@filter_set.include?(rule_ref)
9190
end
9291
end
9392
end

0 commit comments

Comments
 (0)