Verissimo SystemVerilog Testbench Linter User Guide
Rev. 24.1.12, 12 June 2024

7.1 Custom Report Predefined Templates

, AVAILABLE_CHECKS_CSV

FAILURES_TEXT This predefined template can be used to generate a custom report containing the linting failures in the same format as the output of verissimo.sh

Verissimo custom report:

<#if (linter.getHits()?size > 0)>
<#list linter.getHits() as hit>
*** LINT ${hit.getSeverity()} ${hit.getCheck().getName()}: ${hit.getDetails()} at line: ${hit.getLine()} in file: ${hit.getFile()}
</#list>
</#if>

FAILURES_JSON This template can be used to generate a custom report containing the linting failures in a JSON format.

<#function toJSON x>
 <#return x?json_string?replace("'","\\'")?replace("/","\\/")>
</#function>
{
"hits": [
<#list linter.getHits() as hit>
{
"categoryName":"${hit.getCheck().getCategory()}",
"checkName":"${hit.getCheck().getName()}",
"checkTitle":"'${toJSON(hit.getCheck().getTitle())}'",
"severity":"${hit.getSeverity()}",
"message":"'${toJSON(hit.getDetails())}'",
"line":"${hit.getLine()}",
"file":"${hit.getFile()}",
}<#sep>,</#sep>
</#list>
]
}

FAILURES_XML This template can be used to generate a custom report containing the linting failures in a XML format.

<report>
<#if (linter.getChecks()?size > 0)>
<#assign printedCategory = linter.getChecks()?first.getCategory()>
<category name="${printedCategory}">
<#list linter.getChecks() as check>
<#if printedCategory != check.getCategory()>
<#assign printedCategory = check.getCategory()>
</category>
<category name="${printedCategory}">
</#if>
<#if (check.getHits()?size > 0)>
<check name="${check.getName()}" title="${check.getTitle()?xml}">
<#list check.getHits() as hit>
<severity="${hit.getSeverity()}" details="${hit.getDetails()?xml}" line="${hit.getLine()}" file="${hit.getFile()}" />
</#list>
</check>
<#else>
<check name="${check.getName()}" title="${check.getTitle()?xml}"/>
</#if>
</#list>
</category>
</#if>
</report>

LINTED_FILES_TEXT This template can be used to generate a custom report containing the list of files analyzed by Verissimo.

<#list linter.getFiles() as file>
<#if file.isPreWaivedFor("ALL_CHECKS") != "true" && file != "none">
${file.getName()}
</#if>
</#list>

AUTOCORRECT_EDITS_TEXT This template can be used to generate a custom report containing the edits performed by auto-correct as well as the failures that could not be auto-corrected.

File Edits:
ID / File / Line / Edit Type / File Offset / Edit Length / Edit Content
<#list linter.getFiles() as file>
    <#list file.getAutocorrectEdits() as edit>
${edit.getCheck().getId()} / ${file.getName()} / ${edit.getLine()?long?c} / ${edit.getType()} / ${edit.getFileOffset()?long?c} / ${edit.getLength()} / ${edit.getContent()}
    </#list>
</#list>

Failures that could not be autocorrected:
ID / File / Line / Reason
<#list linter.getFiles() as file>
    <#list file.getAutocorrectErrors() as error>
${error.getHit().getCheck().getId()} / ${file.getName()} / ${error.getHit().getLine()} / ${error.getReason()}
    </#list>
</#list>

WAIVED_FAILURES_CSV This template can be used to generate a custom report containing the failures that have been affected by waivers in a comma separated format.

Rule Id,Rule Name,Rule Title,Waiver Comment,File Name,File Path,Line Number
,,,,,
<#list linter.getWaivers() as waiver>
<#list waiver.getWaivedFailures() as hit>
<#assign check = hit.getCheck()>
"${check.getId()}", "${check.getName()}", "${check.getTitle()}","${waiver.getDescription()}", "${hit.getFile()?substring(hit.getFile()?last_index_of("/"))}", "${hit.getFile()}",${hit.getLine()} 
</#list>
</#list>

AVAILABLE_CHECKS_CSV This template can be used to generate a custom report containing a list of all the checks that have been run. Running verissimo.sh with the following command:

verissimo.sh -cmd /path/to/empty_file -all -gen_custom_report AVAILABLE_CHECKS_CSV 

will generate a custom report containing all of the available Verissimo rules in a CSV format.

Category,Rule Id,Rule Name,Rule Title,Rule Description,Supports Autocorrect
,,,,,
<#assign checkCategory = "">
<#list linter.getChecks() as check>
<#if check.getCategory() != checkCategory>
"${check.getCategory()}",,,,
<#assign checkCategory = check.getCategory()>
</#if>
,"${check.getId()}","${check.getName()}","${check.getTitle()}","${check.getDescription()?replace("\"","'")}","${check.isAutocorrectable()?c}"
</#list>