Coding Rules Checker

Home Computing DAQ E-mail Notes Meetings Subsystems Search

This page last edited by MC on June 29, 2009.


RuleChecker has not been used in LHCb since a long time. The following instructions are obsolete.

RuleChecker is a tool for checking the compliance of C++ code with the LHCb C++ coding conventions. It is a product developed in collaboration with the IRST institute and with the Alice and ATLAS collaborations.

The tool has been customised to check a certain number of LHCb coding conventions, and has been interfaced with CMT.

Checking a package with RuleChecker

In both cases, a <$PACKAGEROOT>/Check directory is created which contains one file per class (with filename equal to the class name, and filetype .viol) and a file <PACKAGE>Chk.html containing a summary table.

The table summarises the number of times each rule is violated for each class of the package. The .viol files are the detailed output of the tool, identifying each rule violation rather like a compiler output.


Please note that this is the first release of this tool. While the tool produces reasonable output in many cases, there are a number of known problems:

Tool Installation and packaging

This section documents how the tool is installed at CERN, and how to modify and install new versions. Please ignore this section if you are only interested in running the current version of the tool.

The RuleChecker tool consists of two packages, installed in $LHCBSOFT/Tools:

In order to tell CMT where to find the tool, a line has been added to the requirements file of the ExternalLibs package. Please contact Florence Ranjard if you wish to customise this for your site:

set IRST_DIR "${LHCBHOME}/software/NEW/Tools/RuleChecker/pro"

The patterns required to tell CMT what to do in order to execute the RuleChecker are defined in the GaudiPolicy package: the requirements file contains the following global pattern and the following fragment declarations:

pattern -global RuleChecker \
  document rule_checker <package>Chk -group=RuleChecker \
  ../src/*.cpp ../src/Lib/*.cpp ../src/component/*.cpp

make_fragment rule_checker -header=rule_checker_header \
                                                                  -trailer=rule_checker_trailer -suffix=viol
make_fragment rule_checker_trailer

The corresponding fragments (rule_checker_header,rule_checker,rule_checker_trailer) are in the cmt/fragments subdirectory of GaudiPolicy.