Custom Report Predefined Templates

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

<#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("/","\\/")>
</#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>

CHECKS_JSON

This template can be used to generate a custom report containing a list of all the checks that have been run.

<#function toJSON x>
  <#return x?json_string?replace("/","\\/")>
</#function>
{
"checks": [
<#list linter.getChecks() as check>
{
"categoryName":"${check.getCategory()}",
"checkId":"${check.getId()}",
"checkName":"${check.getName()}",
"checkTitle":"'${toJSON(check.getTitle())}'",
"checkDescription":"'${toJSON(check.getDescription())}'"<#rt>
<#if !check.getParameters().isEmpty()>,
"checkParameters": [
  <#list check.getParameters() as parameter>
  {
  "parameterName":"${parameter.getName()}",
  "parameterDescription":"'${toJSON(parameter.getDescription())}'",
  "parameterDefaultValue":"${toJSON(parameter.getDefaultValue())}",
  "parameterUserValue":"${toJSON(parameter.getUserValue())}"
  }<#sep>,</#sep>
  </#list>
]<#rt>
</#if>
<#if !check.getAutocorrectParameters().isEmpty()>,
"checkAutocorrectParameters": [
  <#list check.getAutocorrectParameters() as autocorrectParameter>
  {
  "autocorrectParameterName":"${autocorrectParameter.getName()}",
  "autocorrectParameterDescription":"'${toJSON(autocorrectParameter.getDescription())}'",
  "autocorrectParameterDefaultValue":"${toJSON(autocorrectParameter.getDefaultValue())}",
  "autocorrectParameterUserValue":"${toJSON(autocorrectParameter.getUserValue())}"
  }<#sep>,</#sep>
  </#list>
]<#rt>
</#if>

}<#sep>,</#sep>
</#list>
]
}

AUTOCORRECT_MODIFIED_FILES_SH

This predefined template is designed to be used alongside the autocorrect_generate_modified_files flag in order to generate a bash script that will show the differences between the original and the auto-corrected files.

#!/bin/bash

<#list linter.getAutocorrectedFiles() as file>
meld ${file} $PWD/verissimo_autocorrect${file}
</#list>

PERFORMANCE_STATS_TEXT

This predefined template can be used to generate a custom report containing performance statistics related to the build and linting processes.

Linter version: ${linter.getVersion()}

Build phase:

Total number of compiled lines: ${linter.getNofCompiledLines()?c}
Total build time: ${linter.getBuildRunTime()?c} ms

Linting phase:

ID / Name / Hits / Run time
<#list linter.getChecks() as check>
${check.getId()} / ${check.getName()} / ${check.getHits()?size?c} hits / ${check.getRunTime()?c} ms
</#list>

Total hits count: ${linter.getHits()?size?c} hits
Total linting time: ${linter.getLintRunTime()?c} ms

NORMALIZED_LOG

This predefined template can be used to generate a custom report containing building and linting logs that do not have volatile metrics such as time-related values. You can also use the filter_path flag to specify what subpaths should be removed from the full path of files.

<#assign headingStr = "Verissimo SystemVerilog Testbench Linter Version: ${linter.getVersion()}">
<#assign heapSize  = linter.getHeapSize()>
<#assign directory = linter.getWorkingDirectory()>
<#assign arguments = linter.getArguments()?join(" ")>
<#assign equalsStr = "">
<#list 1..headingStr?length as i>
    <#assign equalsStr = equalsStr + "=">
</#list>
${equalsStr}

${headingStr}

${equalsStr}

Heap Size...: ${heapSize}m
Directory...: ${directory}
Arguments...: ${arguments}

${equalsStr}

*** Files: ***

<#list builder.getAllFiles() as file>
<#assign filePath = file.getPath()>
<#list builder.getFilterPaths() as pathToRemove>
<#assign currentIdx = pathToRemove?counter>
<#assign filePath = filePath?replace(pathToRemove, "<PATH ${currentIdx}>")>
</#list>
(${file.getCompilationIndex()}) ${filePath} [${file.getNofLines()} lines, ${file.getSyntax()}]
</#list>

${equalsStr}

*** Compile Failures: ***

<#list builder.getAllProblems() as problem>
<#assign filePath = problem.getFile()>
<#list builder.getFilterPaths() as pathToRemove>
<#assign currentIdx = pathToRemove?counter>
<#assign filePath = filePath?replace(pathToRemove, "<PATH ${currentIdx}>")>
</#list>
*** ${problem.getSeverity()}: ${problem.getMessage()}
    at line: ${problem.getLine()} in: ${filePath}
</#list>

${equalsStr}

*** Lint Checks: ***
<#assign dotStr = ".">
<#list 1..30 as i>
    <#assign dotStr = dotStr + ".">
</#list>

<#list linter.getChecks() as check>
${check.getName()}${dotStr[check.getName()?length..]}${check.getStatus()}
</#list>

${equalsStr}

*** Lint Failures: ***
<#assign nofFixedErrors = 0>
<#assign nofFixedWarnings = 0>
<#assign nofFixedInfos = 0>

<#list linter.getHits() as hit>
<#assign severity = hit.getSeverity()>
<#assign filePath = hit.getFile()>
<#list builder.getFilterPaths() as pathToRemove>
<#assign currentIdx = pathToRemove?counter>
<#assign filePath = filePath?replace(pathToRemove, "<PATH ${currentIdx}>")>
</#list>
*** LINT ${severity} ${hit.getCheck().getName()}: ${hit.getDetails()}
    at line: ${hit.getLine()} in: ${filePath}
<#if hit.isAutocorrected()>
    <#if severity == "ERROR">
    <#assign nofFixedErrors = nofFixedErrors + 1>
    <#elseif severity == "WARNING">
    <#assign nofFixedWarnings = nofFixedWarnings + 1>
    <#elseif severity == "INFO">
    <#assign nofFixedInfos = nofFixedInfos + 1>
    </#if>
</#if>
</#list>

${equalsStr}

*** SUMMARY: ***
<#assign checks = linter.getChecksSummary()>
<#assign hits = linter.getHitsSummary()>
<#assign nofHiddenErrors = hits.getHiddenErrors()>
<#assign nofHiddenWarnings = hits.getHiddenWarnings()>
<#assign nofHiddenInfos = hits.getHiddenInfos()>

 Checks: ${checks.getNofPassed()} passed, ${checks.getNofErrors()} errors, ${checks.getNofWarnings()} warnings, <#rt>
${checks.getNofInfos()} infos, ${checks.getNofDisabled()} disabled, ${checks.getNofNonexistent()} nonexistent, ${checks.getNofDuplicate()} duplicate
 Hits:   ${hits.getNofErrors()} errors, ${hits.getNofWarnings()} warnings, ${hits.getNofInfos()} infos, ${hits.getNofDisabled()} disabled
<#if nofHiddenErrors + nofHiddenWarnings + nofHiddenInfos gt 0>
 Additional hits found due to ignoring the maxHitsPerFile parameter while running auto-correct:
         ${nofHiddenErrors} errors, ${nofHiddenWarnings} warnings, ${nofHiddenInfos} infos
</#if>
 Fixed:  ${nofFixedErrors} errors, ${nofFixedWarnings} warnings, ${nofFixedInfos} infos

LINT ${linter.isPassed()?string("PASSED", "FAILED")}
${equalsStr}