Custom Report Plug-ins
You can write report generators of your own, typically Python scripts, which will be fully integrated into Perforce QAC if you follow certain conventions.
Generators should be located in the report_plugins
subfolder of the Perforce QAC installation folder, and should generally have names of the form Three_Capitalized_Words.py
(but see Report Generator Naming for more details).
Scripts may be written in Perl with a .pl
extension, but you must install and configure Perl yourself so that a simple "perl" command will invoke it. A file with any other extension (or none) will be passed straight to your operating system’s command interpreter (eg cmd.exe for Windows, bash for Linux, etc).
Perforce QAC will invoke any report generator twice, once to determine its requirements, and once to actually generate the report when those requirements have been processed. The first invocation will be with the single parameter "-i
", and the generator is expected to respond by printing the following:
data: xml
[ require: project ]
[ require: cma ]
[ require: violations ]
[ require: suppressions ]
[ require: rcf ]
[ require: *cf ]
[ require: umsg ]
[ require: qaf ]
format: <output type>
[ acronym: <TLA> ]
The ’data’ line defines the input format and must be ’xml’. (No other formats are presently supported.)
The optional ’require’ lines determine the information that will be available to the report. The first four (’project
’, ’cma
’, ’violations
’, ’suppressions
’) will affect the contents of the main XML file, while the others will provide access to additional files which may be needed.
’rcf
’ requests a copy of the Rule Control File be placed in the report output directory and provided as a "-r
" parameter to the second invocation. If the copying should fail for any reason, a warning message is logged and a reference to the original is provided instead.
’*cf
’ requests that all the configuration control files - currently the Rule Control File and Analysis Control File - be provided as parameters ("-r
" and "-a
" respectively). Note that these are references to the originals and no extra copies will be made, contrary to plain ’rcf’ above. You should make your own copies if you need them.
’umsg
’ requests that the file containing any user-defined messages be provided as a "-u
" parameter. This file is common to all projects, but unique per installation and/or user of Perforce QAC.
’qaf
’ requests that the Perforce QAC installation folder be provided as a "-q
" parameter.
The ’format
’ line should typically be ’html
’, ’xml
’, ’txt
’, etc, and will be used as the extension of the output file.
Finally, ’acronym
’ if present should be derived according to the rules in Report Generator Naming. The effect of an inconsistent acronym is not defined.
The second invocation will have multiple parameters defining the data inputs, output and other options:
These should be obvious in the light of the above description, except for "-s
". This means that dependency checking has been skipped and the results may not be 100% reliable. In such a case, the report should indicate that status, typically by appending "(Draft)" to the title and providing an explanatory note.
You may notice that the standard Python scripts all support long parameter names as well as short ones, but Perforce QAC will always use the short forms only. Long names are provided purely as a convenience for using the scripts independently and user-written scripts are under no obligation to provide them.