Although the Visual Lint plug-ins for Visual Studio and Eclipse do not have a command line interface, the Visual Lint command line application (VisualLintConsole - available as an optional component in the Visual Lint installer) does. It can analyse any project type supported by the Eclipse or Visual Studio plug-ins, as well as projects for environments (e.g. CodeGear C++) for which a dedicated plug-in is not currently available. See Supported development environments for details of which solution/workspace and project types are supported by Visual Lint.
VisualLintConsole works in exactly the same way as the interactive versions of Visual Lint, but via a command line rather than a graphical user interface. For ease of use, the command line interface is based on that of Riverblade's LintProject Professional.
VisualLintConsole <solution/workspace pathname> <optional output report folder> [parameters]
|/config=<config name>||Select the configuration to analyse.|
|/config?||Display solution/project configurations.|
|/configfile=<std.lnt path>||Use the specified PC-lint std.lnt file. Value linked to interactive versions of Visual Lint.|
|/envfile=<filename>||Use the specified PC-lint env-*.lnt file. Value linked to interactive versions of Visual Lint.|
|/envfile||Use no PC-lint environment file. Value linked to interactive versions of Visual Lint.|
|/excludefile=<filename;...>||Exclude the specified file(s) from analysis.|
|/excludeproject=<project name/filename;...>||Exclude the specified project(s) from analysis.|
|/exitcode=<condition>||Set conditional exit codes.|
|/exportfile=<file path>||Export analysis results to the specified file on completion.|
|/exportformat=<format>||Set the format of exported data. Supported formats currently include text, CSV, env-xml and SATE. Alternatively, include a path to a template file here to use a user defined format.|
|/exportoptions=<pathname>||Export the options for the current user account to the given file.|
|/importoptions=<pathname>||Import the options for the current user account from the given file (useful if you need to configure a Visual Lint installation running under a non-interactive account such as LocalSystem).|
|/includefile=<filename;...>||Include the specified file(s) in the analysis, regardless of whether it(they) is enabled for background analysis. Note that this switch does not force all other files to be excluded - if you need to do that, use this switch in conjunction with /excludefile=*|
|/includeproject=<project name/filename;...>||Include the specified project(s) in the analysis, regardless of whether it(they) is enabled for background analysis. Note that this switch does not force all other projects to be excluded - if you need to do that, use this switch in conjunction with /excludeproject=*|
|/incremental||Analyse only stale and unanalysed files. Note: we recommend also specifying /staleafterbuild=No if you are using /incremental in a build server environment.|
|/noreport||Do not generate an analysis report. Designed for use in conjunction with /exportfile.|
|/param=<parameters>||Extra parameters to use analysing files. Value linked to interactive versions of Visual Lint.|
|/resultsfolder=<folder>||Write analysis results to the specified folder instead of the default location.|
|/setmaxtime=<max time in minutes>||Set the max. analysis time for this run.|
|/showhelp||Open the Visual Lint helpfile.|
|/showoptions||Display options UI.|
|/showreport||Open the generated HTML report.|
|/staleafterbuild=<0|1|No|Yes>||Mark rebuilt files as stale. We recommend using /staleafterbuild=No if you are using /incremental in a build server environment. Value linked to interactive versions of Visual Lint.|
|/toolfolder=<folder path>||Set analysis tool installation folder. Value linked to interactive versions of Visual Lint.|
|/toolname=<PC-lint|CppCheck etc.>||Select the analysis tool to use. Value linked to interactive versions of Visual Lint.|
|/?||Show the help screen.|
To analyse only specified projects, use the /includeproject and /excludeproject switches as follows:
VisualLintConsole <solution/workspace pathname> /config="<configuration name>" /excludeproject=* /includeproject=<project name/filename>
The /includefile and /excludefile switches work in a similar way for files.
Exit code conditions are of the form:
"<category|issues> >= threshold ? <fail code> : <OK code>"
where <category> is the name of the lowest category of issues which should trigger the fail code. The OK code is optional, and defaults to 0. For example:
VisualLintConsole solution.sln /config="Debug|Win32" /exitcode="warnings > 100 ? 1 : 0"
VisualLintConsole c:\users\username\workspace /config="Debug" /exitcode="errors > 0 ? 1 : 0"
Analysis results data can be exported in user defined formats by passing the pathname of a suitable template file to the /exportformat switch. An example of the contents of such a file is shown below:
<?xml version="1.0" ?>
<issue file="$(SourceFile)" line="$(LineNo)" id="$(ID)" category="$(Category)" text="$(Text)" />
The text within the [Issue] and [/Issue] delimiters will be generated for each detected analysis results issue. Fields such as $(SourceFile) will be expanded with the corresponding data for each issue (escaped for compatibility with XML output formats if necessary) before writing them to the export file.
Please note that use of VisualLintConsole in a build server or non-interactive (i.e. service) environment requires a Build Server licence. In interactive non-build server environments (including scheduled tasks which run only when a user is logged on) it can be used with any valid Visual Lint licence.