Riverblade - LintProject Professional - Code analysis with HTML reporting


LintProject Professional - Code analysis with HTML reporting
  • Command line code analysis - ideal for use with build servers

  • Produces graphical HTML reports describing which lint issues are present in your codebase, and where

  • Comprehensive handling of C++ project files - even those making extensive use of internal IDE environment variables and inherited properties or property sheet files

  • Compatible with projects from both current and legacy versions of Microsoft Visual Studio and Visual C++, Borland/CodeGear C++ Builder as well as selected embedded environments
  • Compatible with Intel C++ Compiler projects

  • Compatible with PC-lint 7.5, 8.0 and 9.0, as well as CppCheck (v1.43 or later)

  • Unit Price: $249 USD

LintProject Professional is a command line product intended to make the process of using static code analysis tools with C/C++ projects a little easier and more productive. It replaces the previous LintProject tool, extending greatly the level of detail included in the generated reports and providing far greater compatibility with C/C++ project files.

LintProject Professional uses third party static code analysis tools (Gimpel PC-lint or CppCheck) to perform the analysis. As such, you will need a valid PC-lint or CppCheck licence and installation in order to be able to use this software. Unfortunately we are currently unable to include these in the trial download as they are supplied by third party vendors.

If you need to purchase PC-lint licences, we can supply them in our online store. CppCheck is open source and can be freely downloaded from http://sourceforge.net/projects/cppcheck/.

 

Background

PC-lint analyses C++ code to identify potential problems. By comparison with a C++ compiler such as that provided with Visual C++, it is highly customisable and very thorough, but (understandably) significantly slower.

The output it produces is file based and directed to the console by default, for example:
  
--- Module: CJFlatHeaderCtrl.cpp
}
CJFlatHeaderCtrl.cpp(160): error 1401: (Warning -- member 'CCJFlatHeaderCtrl::m_bSortAsc'
(line 146, file ..\Include\CJFlatHeaderCtrl.h) not initialized by constructor)
 
}
CJFlatHeaderCtrl.cpp(166): error 1740: (Info -- pointer member'CCJFlatHeaderCtrl::m_pParentWnd'
(line 150, file ..\Include\CJFlatHeaderCtrl.h) not directly freed or zero'ed by destructor
-- Effective C++ #6)
 
--- Global Wrap-up
error 900: (Note -- Successful completion, 2 messages produced)
Although PC-lint does a great job of analysing C++ source and header files for potential problems, it is a generic cross-platform tool and as such its integration with development environments is limited. For example, when used with Visual C++ PC-lint can be used to scan the current file for warnings and direct the results to the Output window, or to scan a list of files defined in a text file.

While this level of integration is perfectly adequate under some scenarios (for example when developing new classes), it is less than ideal if you want to perform a complete analysis of an entire project or solution. Furthermore, since PC-lint does not provide any means of generating useful reports on the results it can be difficult to spot potential problems amongst the mass of results.

If you are working with a large project these limitations can make using PC-lint to analyse your code time consuming and difficult, which can potentially this can be a real disincentive to using this very useful tool on a regular basis.

As a result, the quality of your code could well suffer.
 

Introducing LintProject Professional

LintProject Professional was written to address two of these issues. Unlike PC-lint, LintProject Professional can read both project and solution/workspace files.

LintProject Professional can be run against either a complete solution/workspace or an individual project:

  • When run against a project, it reads the project file and instructs PC-lint which files to analyse. For each file analysed, the PC-lint output is captured and recorded in a text file for later analysis

  • When run against a complete solution, LintProject Professional reads the solution or workspace file and recursively analyses the projects it contains.

Please see the FAQ topic "Which solution, workspace and project file types is LintProject Professional compatible with? " is full details of supported solution, workspace and project file types.

 

HTML Reports

Whilst the availability of text files containing the results of the analysis is an essential result of the process, without a means of summarising their contents and indexing them the process of interpreting the results is likely to be slow and laborious.

LintProject provides a convenient solution to this problem by writing HTML reports (in a very virtually identical format to those produced by Visual Lint Enterprise Edition) which contain a detailed analysis of the results files and indicate which lint issues were found within each implementation file, project and solution:

Example HTML report

Example HTML report

A key design aim of LintProject Professional was to be capable of indicating its process whilst it runs. This is especially important when you consider that a PC-lint analysis of a large project can take some considerable time on some systems. To achieve this aim, the output reports produced by LintProject Professional are automatically regenerated as the analysis progresses.

One useful feature of LintProject Professional is that whilst it is running, any supported browser windows* displaying the corresponding results files will automatically refresh as each file is analysed. This gives immediate feedback on the progress of the analysis, and is proving to be a very useful feature.

* At present this feature is limited to Internet Explorer and derived browsers such as Crazy Browser, Avant browser etc..


Using LintProject Professional

Once installed a LintProject Professional command prompt can be easily run from the supplied shortcut which temporarily adds the path of the installation directory to the system path. The /folder switch can then be used to tell it where to find the PC-lint executable.

LintProject Professional is invoked by a simple command line, for example:

    LintProjectPro <SolutionName.sln/dsw> <ResultsFolder> [options], or:

    LintProjectPro <ProjectName.vcproj/dsp> <ResultsFolder> [options]

There are a number of additional options, for example:

    /toolname=<CppCheck | PC-lint>
     Specifies the analysis tool to use.
     
    /toolfolder="<FolderName>"
     Specifies the location of the PC-lint installation folder.
     
    /configfile="<FileName>"
     Specifies the filename of the lint indirect file to use. If omitted, std.lnt is assumed.
     
    /config="<ConfigName>"
     Specifies the solution configuration to be analysed. Similarly, /config? will list the available configurations.
     
    /save
     Saves the current PC-int installation folder settings to the registry so that /toolfolder and /configfile can be omitted next time LintProject Professional is run).
     
    /showreport
     Specifies that the HTML report should be automatically opened in a browser window when analysis starts.
     
    /param="<parameters>"
     Passes the following parameters to the analysis tool. For example, /param" -background" will instruct PC-lint to perform analysis at a low priority.
     
    /?
     Display help information

Finally...

If you find LintProject Professional to be useful, we encourage you to take a look at Visual Lint - Riverblade's solution for developers who require close integration of static code analysis tools such as PC-lint within Microsoft Visual Studio and Eclipse.

In addition to the report generation capabilities offered by LintProject Professional, Visual Lint also offers features such as background analysis of source files and the ability to double click on an analysis issue and open the corresponding line in the code editor.

 

 
"I don't even have pc-lint yet, and the only thing I actually know about it is from reading the ads for it in C++ Users Journal. But thanks to your article, I plan on purchasing a copy in the next few days! Thanks!!"
- Comment posted on the original LintProject article on
The Code Project