Custom Report
The lint report can also be exported in a custom text format by using the batch mode flag gen_custom_report followed by either the path to a template file in FreeMarker syntax or one of the predefined templates: FAILURES_TEXT, FAILURES_JSON, FAILURES_XML, LINTED_FILES_TEXT, AUTOCORRECT_EDITS_TEXT, WAIVED_FAILURES_CSV, AVAILABLE_CHECKS_CSV, AUTOCORRECT_MODIFIED_FILES_SH.
To specify the path to where the custom report will be generated use the custom_report_location flag. To generate a predefined template use the batch mode flag gen_custom_report_ftl followed by the available predefined templates.
The content of the generated custom report is dictated by the custom report template. One and only one custom report will be generated from a gen_custom_report <template.ext.ftl> argument. If you want to generate a CSV file, that contains commas between the output values, you will use a template that contains those commas (along with the required API for the values). To generate a text file without any commas between values, a different template that doesn’t contain any commas must be used. So, the custom report template sets the format of the generated custom report which can be any type of text file format: CSV, TXT, XML, JSON, etc.
The filename of the generated custom report will always be the same as the template filename without the last extension. So using the argument gen_custom_report template.ext.ftl will generate a template.ext custom report because the .ftl was removed. If the template filename has no extension then the filename of the generated custom report will be the name of the template with the .custom.report extension added. So using the argument gen_custom_report template will generate a template.custom.report custom report.
The custom report template uses the standard FreeMarker syntax (see FreeMarker Template Language Reference). Various information about the linting results can be obtained using the API available on the ${linter} variable.
Main API
isPassed(): returns a boolean representing the linter FAILED / PASSED status
getChecks(): returns a list of all the checks
getHits(): returns a list of all the hits
getFiles(boolean includeUVM): returns a list of all the files (use true for includeUVM to also include the UVM files, false otherwise)
getAutocorrectEnabledChecks(): returns the list of checks for which auto-correct has been enabled either in the ruleset file or through the command line
getAutocorrectedHits(): returns a list of all the auto-corrected hits
getNonAutocorrectedHits(): returns a list of all the hits not auto-corrected due to errors or due to not enabling auto-correct for them
getAutocorrectEdits(): returns a list of all the auto-correct edits done to fix the hits
getAutocorrectErrors(): returns a list of all the auto-correct errors found when trying to fix the hits
getAnnotationNames(): returns a list of all the annotations
getWaivers(): returns a list of all the waivers
getPreWaivers(): returns a list of all the pre-waivers
getChecksSummary(): returns the summary of passed, failed, warning, info, disabled, nonexistent checks
getHitsSummary(): returns the summary of failed, warning, info and disabled hits
getCompareSummary(): returns the summary of new failures, new fixes, added rules, removed rules and common hits
getNofCompiledLines(): returns the total number of compiled lines
getLintRunTime(): returns the linting run time in ms
getBuildRunTime(): returns the build run time in ms
getLicenseWaitTime(): returns the license wait time in ms
getEnvVar(String varName): returns the value of the varName environment variable
getVersion(): returns the version of Verissimo used to generate the custom report
getAutocorrectedFiles(): returns a list of modified file paths after running auto-correct
Check API
getId()
getTitle()
getName()
getDescription()
getCategory()
getCategoryDescription()
getStatus()
getSeverity()
getHits()
getAutocorrectedHits()
getNonAutocorrectedHits()
getRunTime()
isAutocorrectable()
isAutocorrectEnabled()
getAutocorrectEdits()
getAutocorrectErrors()
isManualCheck()
Hit API
getCheck()
getDetails()
getSeverity()
getFile()
getLine()
getAnnotations(): returns a map (Freemarker hash) with the annotation name as key and annotation value as value
getAnnotations(String annotationName)
getCompareInfo(): returns a compare information object - only for compare reports
isAutocorrected(): returns a boolean indicating if the hit was auto-corrected
getAutocorrectEdits(): returns a list of all auto-correct edits applied in order to fix the hit
hasAutocorrectError(): returns a boolean indicating if the hit has encountered an auto-correct error when trying to fix it
getAutocorrectError(): returns the auto-correct error encountered when trying to fix the hit
File API
getName()
getNofCompiledLines()
getHits()
getAutocorrectEdits()
getAutocorrectErrors()
isPreWaivedFor(String checkName) - returns a boolean indicating if the file is pre-waived for specified checkName (use ALL_CHECKS to determine if the file is pre-waived for all checks and ANY_CHECK to determine if the file is pre-waived for any check)
Auto-correct Edit API
getCheck(): returns the check whose auto-correcting caused this edit
getHit(): returns the hit this edit auto-corrected (multiple edits may return the same hit)
getPath(): returns the path to the file where the edit occurred
getLine(): returns the line in the file where the edit occurred
getLineOffset(): returns the offset on the line where the edit starts
getFileOffset(): returns the offset in the file where the edit starts
getType(): returns the type of edit that occurred as one of the following strings: “insert”, “delete”, “replace”
getLength(): returns the length of the removed section of the edit (always equal to 0 for insert)
getContent(): returns the content added by the edit (always an empty string for delete)
Auto-correct Error API
getHit(): returns the hit that could not be auto-corrected because of this error
getReason(): returns a string with a reason why the fix could not be done
getAdditionalInfo(): returns a string with additional information that might help with fixing the error
Waiver API
getName()
getDescription()
getStatus()
getApplyOn()
getCheckNames(): returns a list of names of all the checks in the waiver
getPaths(): returns a list of all the paths in the waiver
getElements(): returns a list of all the elements in the waiver
getLineRanges()
getMessagePatterns()
getWaiverFile(): returns the path to the waiver file
getWaivedFailures(): returns a list of all the failures waived by the waiver
PreWaiver API
getName()
getDescription()
getApplyOn()
getCheckNames(): returns a list of names of all the checks in the pre-waiver
getPaths(): returns a list of all the paths in the pre-waiver
getElements(): returns a list of all the elements in the pre-waiver
getWaiverFile(): returns the path to the waiver file
getPrewaivedFiles(): return a list of all the pre-waived files
Checks Summary API
getNofPassed()
getNofErrors()
getNofWarnings()
getNofInfos()
getNofDisabled()
getNofNonexistent()
getNofDuplicate()
Compare Summary API
getNewFailuresSummary(): returns the summary of new failed, warning, info and disabled hits
getNewFixesSummary(): returns the summary of new fixed hits
getAddedRulesSummary(): returns the summary of new failed, warning, info and disabled hits from added rules
getRemovedRulesSummary(): returns the summary of hits removed after the rules were removed
getCommonSummary(): returns the summary of failed, warning, info and disabled hits which are common between baseline and current reports
Hits Summary API
getNofDisabled()
getNofErrors()
getNofWarnings()
getNofInfos()
Compare Info API
getAnnotations() returns a list containing compare annotations such as “New Failures”, “New Fixes”, “Removed Rules”, “Added Rules”, “Common”
getOtherStatus() returns the severity of the corresponding failure (e.g. for a common failure that has changed it’s severity from warning to error)
getOrigin() returns “Current” or “Baseline” depending on the origin of the failure.