Skip to content

Commit d05ff07

Browse files
committed
Fix rubocop issues
1 parent 6b43fc3 commit d05ff07

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/pmdtester/parsers/pmd_report_document.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def end_element(name)
5656
@violations.add_violations_by_filename(@current_filename, @current_violations)
5757
@current_filename = nil
5858
when 'violation'
59-
@current_violation&.text.strip!
59+
@current_violation.text.strip!
6060
@current_violations.push(@current_violation) if match_filter_set?(@current_violation)
6161
@current_violation = nil
6262
when 'error'

test/test_pmd_report_document.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@
44

55
class TestPmdReportDocument < Test::Unit::TestCase
66
include PmdTester
7+
8+
FIRST_FILE = '/target/repositories/spring-framework/gradle/jdiff/Null.java'
9+
710
def test_document
811
doc = PmdReportDocument.new('base', 'SHOULD_BE_REPLACED')
912
parser = Nokogiri::XML::SAX::Parser.new(doc)
1013
parser.parse(File.open('test/resources/pmd_report_document/test_document.xml'))
1114
assert_equal(8, doc.violations.violations_size)
12-
assert_equal('Document \'empty\' constructor', doc.violations.violations['/target/repositories/spring-framework/gradle/jdiff/Null.java'][0].text)
15+
assert_equal('Document \'empty\' constructor', doc.violations.violations[FIRST_FILE][0].text)
1316
assert_equal(2, doc.errors.errors_size)
1417
pmd_errors = doc.errors.errors.values
1518
assert_not_nil(pmd_errors[0])

0 commit comments

Comments
 (0)