AuditsCLI.EXE, the Command Line Audits and Metrics Tool

From RAD Studio
Jump to: navigation, search

Go Up to Command-Line Utilities Index


AuditsCLI.EXE is the command-line Audits and Metrics tool. It runs the command-line version of Audits or Metrics, depending on whether the --audits or --metrics option is specified in the command line.

Warning: Notice that AuditsCLI.EXE can be used only with Delphi projects.

Command-Line Syntax

To display the command-line help, enter:

AuditsCLI {-h|--help}

To run Audits, use the command line:

AuditsCLI --audits --{html|xml} CompilerOptions ^
[--config=AuditsConfigurationFile.ADT] [-o OutputFile] ProjectName.DPROJ

To run Metrics, use the command line:

AuditsCLI --metrics --[html|xml] CompilerOptions ^
[--config=MetricsConfigurationFile.MTS] [-o OutputFile] ProjectName.DPROJ

Command-Line Options

You can use the following command line options:

Option Description

-h
--help

One of these options can be specified to display the short help in the console window.

--audits
--metrics

One of these options must be specified.

  • audits—Runs the Audits analysis.
  • metrics—Runs the Metrics analysis.

--html
--xml

One of these options must be specified:

  • html—Writes analysis results in HTML format.
  • xml—Writes analysis results in XML format.

CompilerOptions

Specifies some options related to the Delphi compiler (see DCC32.EXE, the Delphi Command Line Compiler.) You can use the following options:

  • -U<paths>This option is mandatory! It defines directories in which AuditsCLI.EXE will search for compiled units. The option has the
-Upath1;path2... format. Here each path_N should specify a directory that can contain Delphi compiled units. For example,
-U"C:\Program Files (x86)\Embarcadero\Studio\21.0\lib\win32\debug";C:\MyUnits
  • -I<paths>—Defines include directories. The option has the
-Ipath1;path2... format. Here each path_N should specify an include directory.
-Dsymbol1;symbol2... format. Here each symbol_N should specify some conditional compilation symbol.
  • -A<unit>=<alias>—Defines alias aliases for unit units.

--config=ConfigurationFile

Specifies the file storing a set of Audits or Metrics to analyze. The activated analysis will process only audits or metrics stored in this set.

  • For Audits, the option has the
--config=AuditsConfigurationFile.ADT format. AuditsConfigurationFile should specify the file storing the set of audits to analyze. The file name must have the .ADT extension.
  • For Metrics, the option has the
--config=MetricsConfigurationFile.ADT format. MetricsConfigurationFile should specify the file storing the set of metrics to analyze. The file name must have the .MTS extension.

Configuration files can be created from the IDE. Use the QA Audits and QA Metrics dialog boxes to customize the sets of active audits and active metrics. Then use the Save audit set or Save metric set button on these dialog boxes to save the customized sets of audits or metrics in configuration files.

If the config option is not specified, then the invoked Audits or Metrics will analyze some default sets of audits or metrics. You can check these default sets from the IDE (see the Sets of active audits and metrics section in Audits and Metrics Facilities.)

-o OutputFile

OutputFile specifies the output file in which AuditsCLI.EXE will save the obtained analysis results. If you use a relative path, like .\doc, then this path is relative to the project root directory specified by the ProjectName.DPROJ option. By default, the ProjectName.[audits|metrics].[html|xml] output file name (depending upon the specified option) is accepted. You can optionally use a blank character between -o and OutputFile.

ProjectName.DPROJ

Specifies the Delphi project file. This file must have the .DPROJ file name extension. It should be created from the IDE.
This option is mandatory!

Command-Line Examples

The following example demonstrates the running of the command-line Metrics:

AuditsCLI.exe --metrics --html^
--config="C:\Users\<user>\Documents\Embarcadero\Studio\Projects\MyMetrics.mts"^
-U"C:\Program Files (x86)\Embarcadero\Studio\21.0\lib\release"^
-o "C:\Users\<user>\Documents\Embarcadero\Studio\Projects\p1\QA\MyMetricsResults.html"^
"C:\Users\<user>\Documents\Embarcadero\Studio\Projects\p1\Project1.dproj"

Here:

  • The --html option defines that Metrics results will be generated in the HTML format.
  • The MyMetrics.mts file stores the set of metrics to process. This file should be previously created from the QA Metrics dialog box.
  • The -U option defines that the command-line Metrics will search for compiled units in the
C:\Program Files (x86)\Embarcadero\Studio\21.0\lib\release folder.
  • The -o option defines that AuditsCLI.exe will save the generated Metrics results in the MyMetricsResults.html file.
  • The Project1.dproj file should be the project file whose source code is to be analyzed by the command-line Metrics.


The following example demonstrates the running of the command-line Audits:

AuditsCLI.exe --audits --html^
--config="C:\Users\<user>\Documents\Embarcadero\Studio\Projects\MyAudits.adt"^
-U"C:\Program Files (x86)\Embarcadero\Studio\21.0\lib\release"^
-I"C:\Program Files (x86)\Embarcadero\Studio\21.0\lib";"C:\Program Files (x86)\Embarcadero\Studio\21.0\include"^
-DDEBUG;DEVELOPERS;^
-o .\MyAuditsResults.html^
"C:\Users\<user>\Documents\Embarcadero\Studio\Projects\p1\Project1.dproj"

Here:

  • The -I option defines that the command-line Audits will use the
C:\Program Files (x86)\Embarcadero\Studio\21.0\lib and C:\Program Files (x86)\Embarcadero\Studio\21.0\include include directories.
  • The -D option defines that the command-line Audits will use the DEBUG and DEVELOPERS conditional compilation symbols.
  • The relative path used in .\MyAuditsResults.html file means that this file should be created in the project root directory
C:\Users\<user>\Documents\Embarcadero\Studio\Projects\p1, specified by the project file option.

Topics

See Also