Documentation

1. Compiling KWStyle

KWStyle is available under BSD-like license and can be downloaded here.
In order to compile KWStyle you need run CMake on the source directory, then compile KWStyle with your favorite compiler. KWStyle is currently tested on Visual Studios and gcc compiler.

2. Running KWStyle

KWStyle is running as a command line executable:

./KWStyle MyFile.cxxx

You can also specify all the command arguments in the KWStyle.xml file (or by using -xml).
In that case you can run KWStyle using:

./KWStyle auto

Different options are available to control the behavior of the testing:

Name
Argument
Example
XML Tag
Download
Verbose -v KWStyle -v MyFile.cxx
<Verbose>1</Verbose>
Specify a configuration file -xml [XMLDescriptionFile.xml] KWStyle -xml MyConfiguration.kws.xml
Overwrite default testing rules -o [Overwrite File.txt] KWStyle -o RulesOverwrite.txt
<OverwriteFile>overwrite.txt</OverwriteFile>
Write out testing report as HTML files -html [HTMLDirectory] KWStyle -html MyHTMLDirectoryOutput
<HTMLDirectory>KWStyleHTML</HTMLDirectory>
Do not show tests that are free of errors in the matrix view -lesshtml KWStyle -lessthtml -html MyHTMLDirectoryOutput
<LessHTML>1</LessHTML>
Specify a directory instead of a file -d [directory] (accept globbing expressions) KWStyle -d Insight/Code/Common
<Directory>MyDirectory</Directory>
Combined with -d, recurse the directory -R KWStyle -R -d Insight/Code
<Recursive>1</Recursive>
Specify a list of files -D [FilenamesFile.txt] KWStyle -D MyFilesToCheck.txt
<Files>MyFiles.txt</Files>
Specify a blacklist -b KWStyle -b BlackList.txt
<BlackList>MyFiles.txt</BlackList>
 

3. Integrating KWStyle with CDash (and CTest)

KWStyle can be integrated with CDash as part of the dashboard (see IGSTK or ITK dashboard and look for KWStyle).
In order to generate CDash compatible description you need to set these two options when running KWStyle.

Name
Argument
Example
Generate a CDash XML description of the errors -dart [BinaryDirectory] [maximum of errors to report (-1 is all)] [Group the errors per file (1) or per category (0)] -dart ${CTEST_BINARY_DIRECTORY} -1 1
Specify the URL of the generated files -kwsurl [URL of the generated file] KWStyle -kwsurl http://66.194.253.24/KWStyleExamples/IGSTK

CDash can be used easily with CTest to generate the dashboard. Here is an example of a ctest script for KWStyle.
Other scripts can be found in the KWStyle/Web/ctests/ directory.

4. XML Configuration description

It is often easier to run KWStyle with the -xml flag in order to specify a configuration file.
An example of a configuration file is available here: MyConfiguration.kws.xml

The XML tag: <File>MyFile</File> can be specified to run KWStyle on the given file without specifying the current argument.

When generating HTML reports (using the -html option) it is often usefull to add the project information:

<Project>This is my project</Project>
<ProjectLogo>C:\MyProject\myprojectLogo.jpg</ProjectLogo>
<KWStyleLogo>C:\KWStyle\KWStyleLogo.jpg</KWStyleLogo>
<ErrorThreshold>10</ErrorThreshold>

Note that in order to avoid the check of a feature you have to remove the corresponding line in the configuration file.
The complete description of the XML tags can be found here