Skip to content

Commit

Permalink
Add Cobertura DTD file
Browse files Browse the repository at this point in the history
  • Loading branch information
fflaten committed Jul 12, 2024
1 parent 505afef commit a12b1c7
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 1 deletion.
1 change: 1 addition & 0 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ if ($Clean) {
, ("$PSScriptRoot/src/schemas/JUnit4/*.xsd", "$PSScriptRoot/bin/schemas/JUnit4/")
, ("$PSScriptRoot/src/schemas/NUnit25/*.xsd", "$PSScriptRoot/bin/schemas/NUnit25/")
, ("$PSScriptRoot/src/schemas/NUnit3/*.xsd", "$PSScriptRoot/bin/schemas/NUnit3/")
, ("$PSScriptRoot/src/schemas/Cobertura/*.dtd", "$PSScriptRoot/bin/schemas/Cobertura/")
, ("$PSScriptRoot/src/schemas/JaCoCo/*.dtd", "$PSScriptRoot/bin/schemas/JaCoCo/")
, ("$PSScriptRoot/src/csharp/Pester/bin/$Configuration/net462/Pester.dll", "$PSScriptRoot/bin/bin/net462/")
, ("$PSScriptRoot/src/csharp/Pester/bin/$Configuration/net6.0/Pester.dll", "$PSScriptRoot/bin/bin/net6.0/")
Expand Down
1 change: 1 addition & 0 deletions publish/filesToPublish.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
'bin/net6.0/Pester.dll'
'en-US/about_Pester.help.txt'
'en-US/about_PesterConfiguration.help.txt'
'schemas/Cobertura/coverage-loose.dtd'
'schemas/JaCoCo/report.dtd'
'schemas/JUnit4/junit_schema_4.xsd'
'schemas/NUnit25/nunit_schema_2.5.xsd'
Expand Down
2 changes: 1 addition & 1 deletion src/functions/Coverage.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ function Get-CoberturaReportXml {
}

$xmlDeclaration = '<?xml version="1.0" ?>'
$docType = '<!DOCTYPE coverage SYSTEM "https://raw.githubusercontent.com/cobertura/cobertura/master/cobertura/src/site/htdocs/xml/coverage-loose.dtd">'
$docType = '<!DOCTYPE coverage SYSTEM "coverage-loose.dtd">'
$coverageXml = ConvertTo-XmlElement -Node $coverage
$document = "$xmlDeclaration`n$docType`n$(([System.Xml.XmlElement]$coverageXml).OuterXml)"

Expand Down
61 changes: 61 additions & 0 deletions src/schemas/Cobertura/coverage-loose.dtd
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<!-- Portions (C) International Organization for Standardization 1986:
Permission to copy in any form is granted for use with
conforming SGML systems and applications as defined in
ISO 8879, provided this notice is included in all copies.
-->

<!ELEMENT coverage (sources?,packages)>
<!ATTLIST coverage line-rate CDATA #IMPLIED>
<!ATTLIST coverage branch-rate CDATA #IMPLIED>
<!ATTLIST coverage lines-covered CDATA #IMPLIED>
<!ATTLIST coverage lines-valid CDATA #IMPLIED>
<!ATTLIST coverage branches-covered CDATA #IMPLIED>
<!ATTLIST coverage branches-valid CDATA #IMPLIED>
<!ATTLIST coverage complexity CDATA #IMPLIED>
<!ATTLIST coverage version CDATA #REQUIRED>
<!ATTLIST coverage timestamp CDATA #REQUIRED>

<!ELEMENT sources (source*)>

<!ELEMENT source (#PCDATA)>

<!ELEMENT packages (package*)>

<!ELEMENT package (classes)>
<!ATTLIST package name CDATA #REQUIRED>
<!ATTLIST package line-rate CDATA #IMPLIED>
<!ATTLIST package branch-rate CDATA #IMPLIED>
<!ATTLIST package complexity CDATA #IMPLIED>

<!ELEMENT classes (class*)>

<!ELEMENT class (methods,lines)>
<!ATTLIST class name CDATA #REQUIRED>
<!ATTLIST class filename CDATA #REQUIRED>
<!ATTLIST class line-rate CDATA #IMPLIED>
<!ATTLIST class branch-rate CDATA #IMPLIED>
<!ATTLIST class complexity CDATA #IMPLIED>

<!ELEMENT methods (method*)>

<!ELEMENT method (lines)>
<!ATTLIST method name CDATA #REQUIRED>
<!ATTLIST method signature CDATA #REQUIRED>
<!ATTLIST method line-rate CDATA #IMPLIED>
<!ATTLIST method branch-rate CDATA #IMPLIED>
<!ATTLIST method complexity CDATA #IMPLIED>

<!ELEMENT lines (line*)>

<!ELEMENT line (conditions*)>
<!ATTLIST line number CDATA #REQUIRED>
<!ATTLIST line hits CDATA #IMPLIED>
<!ATTLIST line branch CDATA "false">
<!ATTLIST line condition-coverage CDATA #IMPLIED>

<!ELEMENT conditions (condition*)>

<!ELEMENT condition EMPTY>
<!ATTLIST condition number CDATA #REQUIRED>
<!ATTLIST condition type CDATA #REQUIRED>
<!ATTLIST condition coverage CDATA #REQUIRED>

0 comments on commit a12b1c7

Please sign in to comment.