Command line options (VisualLintConsole)

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.

 

Command line syntax

VisualLintConsole <solution/workspace/project pathname> <optional output report folder> [parameters]

 

Parameters
ParameterDescription
/analysestack=<1|0|Yes|No>Enable/disable PC-lint 9.0 stack usage analysis.
/analysismethod=<file|project>Set the preferred analysis method (per-file or per-project).
/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 to determine the format of the generated raw analysis results. Value linked to interactive versions of Visual Lint.
/envfileUse 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=*
/incrementalAnalyse only stale and unanalysed files. Note: we recommend also specifying /staleafterbuild=No if you are using /incremental in a build server environment.
/noreportDo not generate an analysis report. Designed for use in conjunction with /exportfile.
/oldvsheaders=<1|0|Yes|No>Substitute the Visual Studio 2012 or 2010 system headers (if available) when analysing projects for Visual Studio 2013 or later with PC-lint 9.0 or earlier. This avoids issues with C++ 11 variadic templates, which are used in the VS2013 system headers and can cause analysis failures if analysed with PC-lint 9.0 or earlier.

Please contact us if you have any queries about the effects of this and potential workarounds.
/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.
/showhelpOpen the Visual Lint helpfile.
/showoptionsDisplay options UI.
/showreportOpen the generated HTML report.
/silentDisplay minimal (or no) console output.
/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.
/verboseDisplay additional output to the console, including logfile text.
/writevlconfigfilesUpdate .vlconfig file(s) with details of (for example) additional file exclusions specified by the /excludefile switch. As .vlconfig file(s) are read when VisualLintConsole loads a solution, this allows you to incrementally update the existing analysis configuration for the solution/workspace/projects.
/?Show the help screen.

 

Analysing only specified projects or files

To analyse only specified projects, use the /includeproject and /excludeproject switches as follows:

VisualLintConsole <solution/workspace/project pathname> /config="<configuration name>" /excludeproject=* /includeproject=<project name/filename>

The /includefile and /excludefile switches work in a similar way for files.

 

Exit code conditions

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 project.vcxproj /config="Debug|Win32" /exitcode="warnings > 100 ? 1 : 0"

VisualLintConsole c:\users\username\workspace /config="Debug" /exitcode="errors > 0 ? 1 : 0"

VisualLintConsole c:\users\username\workspace\projectname\.cproject /config="Debug" /exitcode="errors > 0 ? 1 : 0"

 

Exporting analysis results data in user defined formats

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" ?>
  <issues>
    [Issue]
      <issue index="$(Index)" file="$(SourceFile)" line="$(LineNo)" id="$(ID)" category="$(Category)" text="$(Text)" />
    [/Issue]
  </issues>

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.

The following fields are supported:

$(Index)The index or order of occurance of the issue. Starts at 1 and increments upwards within the data set.
$(ID)The alphanumeric ID of the issue. The format of this field is analysis tool dependent.
$(Category)The name of the issue category ("Warning", "Error" etc.)
$(Rule)The MISRA Rule ID, if applicable.
$(SourceFile)The pathname of the source file where the issue was found.
$(LineNo)The line number within the source file where the issue was found.
$(Text)A textual description of the issue.
$(Desc)The definition of what the issue means, if available.

 

Please be aware that to use VisualLintConsole in a build/CI server or non-interactive (i.e. service) environment you will need a Visual Lint Build Server Edition licence. In interactive non-build server environments (including scheduled tasks which run only when a user is logged on) VisualLintConsole can be used with any valid Visual Lint licence.



Copyright © 2004 - 2023 by Riverblade Ltd. All rights reserved.