Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions lib/simplecov-cobertura.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ def format(result)
private

def result_to_xml(result)
doc = REXML::Document.new set_xml_head
doc = REXML::Document.new
doc.context[:attribute_quote] = :quote
doc << REXML::XMLDecl.new('1.0')
doc << REXML::DocType.new('coverage', "SYSTEM \"#{DTD_URL}\"")
doc << REXML::Comment.new("Generated by simplecov-cobertura version #{VERSION} (https://github.com/jessebs/simplecov-cobertura)")
doc.add_element REXML::Element.new('coverage')
coverage = doc.root

Expand Down Expand Up @@ -140,13 +143,6 @@ def set_branch_attributes(line, file_line, branched_lines, branched_lines_covere
end
end

def set_xml_head(lines=[])
lines << "<?xml version=\"1.0\"?>"
lines << "<!DOCTYPE coverage SYSTEM \"#{DTD_URL}\">"
lines << "<!-- Generated by simplecov-cobertura version #{VERSION} (https://github.com/jessebs/simplecov-cobertura) -->"
lines.join("\n")
end

# Roughly mirrors private method SimpleCov::Formatter::HTMLFormatter#output_coverage
def output_message(result, output_path)
output = "Coverage report generated for #{result.command_name} to #{output_path}."
Expand Down