htmlTemplates.macros.ftl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of coverage-report Show documentation
Show all versions of coverage-report Show documentation
HTML coverage report generator
<#setting number_format="#">
<#macro currentScope>Current scope: <#if reportTitle?has_content>${reportTitle}|#if>#macro>
<#macro coverageStatCell statEntry showEmpty=false>
<#if statEntry.percent >= 0>
${(statEntry.percent)?string("0.#")}%<#if statEntry.diff?has_content> <@showDiff diffValue=statEntry.diff.percentDiff>${statEntry.diff.percentDiff?string("0.##")}%@showDiff>#if>
(${statEntry.covered}<#if statEntry.diff?has_content
> <@showDiff diffValue=statEntry.diff.coveredDiff>${statEntry.diff.coveredDiff}@showDiff>#if
>/${statEntry.total}<#if statEntry.diff?has_content
><@showDiff diffValue=statEntry.diff.totalDiff>${statEntry.diff.totalDiff}@showDiff>#if
>)
<#else>
<#if showEmpty>
#if>
#if>
#macro>
<#macro showDiff diffValue showBrackets=false>
<#if diffValue > 0>
<#if showBrackets>(+<#nested/>)<#else>+<#nested/>#if>
#if>
<#if diffValue < 0>
<#if showBrackets>(<#nested/>)<#else><#nested/>#if>
#if>
#macro>
<#macro coverageStatHeaderCell label statEntry sorted sortOption=sort_option_none showEmpty=false>
<#if statEntry.percent >= 0 || showEmpty>
<#if !sorted && sortOption.name() == "NONE">${label}<#else><@sortableCellLabel label=label sortOption=sortOption/>#if>
#if>
#macro>
<#macro sortableCellClass sorted sortedDesc>
<#if sorted && sortedDesc>sortedDesc#if><#if sorted && !sortedDesc>sortedAsc#if>
#macro>
<#macro sortableCellLabel label sortOption>${label}#macro>
<#macro coverageStatRow coverageStatistics showForClass=true showEmptyBlocks=false>
<#if showForClass>
<@coverageStatCell statEntry=coverageStatistics.classStats/>
#if>
<@coverageStatCell statEntry=coverageStatistics.methodStats/>
<@coverageStatCell statEntry=coverageStatistics.blockStats showEmpty=showEmptyBlocks || resources['coverage.show.empty.blocks'] == "true"/>
<@coverageStatCell statEntry=coverageStatistics.lineStats/>
<@coverageStatCell statEntry=coverageStatistics.statementStats/>
#macro>
<#macro coverageStatHeaderRow coverageStatistics sortOption=sort_option_none showForClass=true>
<#if showForClass>
<@coverageStatHeaderCell statEntry=coverageStatistics.classStats label="Class, %" sorted=sortOption.orderByClass() sortOption=sortOption.nextOrderByClass()/>
#if>
<@coverageStatHeaderCell statEntry=coverageStatistics.methodStats label="Method, %" sorted=sortOption.orderByMethod() sortOption=sortOption.nextOrderByMethod()/>
<@coverageStatHeaderCell statEntry=coverageStatistics.blockStats label="${resources['coverage.block']?cap_first}, %" sorted=sortOption.orderByBlock() sortOption=sortOption.nextOrderByBlock() showEmpty=resources['coverage.show.empty.blocks'] == "true"/>
<@coverageStatHeaderCell statEntry=coverageStatistics.lineStats label="Line, %" sorted=sortOption.orderByLine() sortOption=sortOption.nextOrderByLine()/>
<@coverageStatHeaderCell statEntry=coverageStatistics.statementStats label="${resources['coverage.statement']?cap_first}, %" sorted=sortOption.orderByStatement() sortOption=sortOption.nextOrderByStatement()/>
#macro>
<#function ternaryOp condition positiveExpr negativeExpr>
<#if condition><#return positiveExpr/>#if>
<#return negativeExpr/>
#function>
<#macro overallStatTable labelName labelValue coverageStatistics>
${labelName}
<@coverageStatHeaderRow coverageStatistics=coverageStatistics/>
${labelValue}
<@coverageStatRow coverageStatistics=coverageStatistics/>
#macro>
<#macro moduleName module><#if module.empty><unknown ${resources['coverage.module']}><#else>${module.name?html}#if>#macro>
<#macro namespaceName namespace><#if namespace?length = 0><empty ${resources['coverage.namespace']} name><#else>${namespace?html}#if>#macro>
<#macro className clazz><#if clazz.name?length = 0><empty ${resources['coverage.class']} name><#else>${clazz.name?html}#if>#macro>
<#macro page title="">
<#if charset?has_content> #if>
<#if reportTitle?has_content>${reportTitle} #if>Coverage Report > ${title}
<#nested/>
#macro>