Command Line Interface

The TICS client is used to check the quality of your code before committing (or pushing) it to the repository. You invoke the TICS client from the command-line as follows:

TICS [ @ ] { input } ... [ -- { compiler options } ]

Passing the files to analyze to TICS

Examples of TICS calls are TICS xyz.cpp abc.c and TICS @xyz.vcxproj. The TICS executable accepts multiple files as arguments (including wildcards in directory and file names). It can also process a list of input files from a file list. This is achieved by prefixing the file list with an "at" symbol '@', e.g., TICS @Address.lst. It is not allowed to nest file lists.

Note also that the client will check against the ARCHIVE.txt file(s) unless a list of source files is directly passed to the client, for instance TICS src1.cpp src2.cpp src3.cpp. If it however contains any containers (for instance a file list or a directory) then then the ARCHIVE.txt will be used.

When the ARCHIVE.txt is used by the TICS client and different code types such as TESTCODE_FILE and EXTERNAL_FILE are specified within the ARCHIVE.txt file, the default behaviour of the TICS client is to exclude all files that are not marked as production code. If you still want to analyze files that are a part of test code or external code, you can still do this by either passing the files as an explicit argument to TICS, or using the -ignorefilters command line option which will ignore the contents of the ARCHIVE.txt file.

Passing compiler options

When the -- option is used, all following options will be passed to the compiler. The -- option helps to use TICS as a compiler replacement in makefiles.

Allowed TICS options

The following TICS options are allowed:

-archivefile file
use the given archive file for the archive extraction
-buildrelationsearchdepth int
maximum depth to search for makefiles (relative to the source file)
-calc METRICS
calculate the specified (comma separated) metric type(s). For instance: -calc CODINGSTANDARD
-cdtoken
allows you to specify a custom client-data token for the purpose of the Client Viewer functionality. Only alphanumerical characters and underscore are permitted.
-changed
only check files that have changed with respect to the database
-checkedoutonly
only check files that are checked out
-compiler CodeComposer|Csc|Gcc|Keil|MULTI|None|Qac|Tasking|VC|<string>
use the specified compiler
-compileroptions string
pass the specified (comma separated) options to the compiler
-config string
use the given compiler configuration
-delta string
show new violations relative to a given SCM tag in the database
-deltaonly
show only new violations relative to the database
-exitsqa
use the QA statement acceptation (yes/no) and quality gate status (when used in combination with -viewer) as exit code (zero if and only if successful)
-exitviolations
use the number of violations as exit code
-getrules
generate rule configuration for TICSConfig
-groupfile file
use the given group file
-help
show this help info
-hlpcfg
generate help output for TICSConfig
-ide eclipse|rrt|slickedit|tasking|tornado|vs11|vs12|vs14|vs15|vs16
format output for the specified ide
-ignorefilters
Ignore all ARCHIVE filters. All build files, source files and directories provided to the TICS client as input will be analyzed without an ARCHIVE check.
-level int
show violations upto the specified level
-log int
show diagnostic messages upto the specified log level
-lowpriority
run the TICS client with low priority
-maxresults int
show maximally the specified number of violations
-msbuildinplace
perform MSBuild in the project directory
-nocalc METRICS
do not calculate the specified (comma separated) metric type(s). For instance: -calc ALL -nocalc DUPLICATEDCODE
-noconfig
do not use TICSConfig settings
-nodelta
do not show deltas
-nologo
suppress TICS logo output
-noproject
do not use the TICSPROJECT environment variable
-norecalc METRICS
do not recalculate the specified (comma separated) metric type(s) for unchanged files. For instance: -recalc ALL -norecalc DUPLICATEDCODE
-nowarn
suppress all warnings
-out file
output the analysis results to file in plain text format
-overviews
show violation overview tables [default: on]
-parallel
indicate that the client is running concurrently with other instances
-project string
quality database that is used to compare results
-projfile file
use the given project file
-qg
ensures that TICS queries the viewer for quality gate results (implies -viewer)
-recalc METRICS
recalculate the specified (comma separated) metric type(s) for unchanged files. For instance: -recalc COMPILERWARNING
-resultdir resultdir
Use the given result directory for code coverage.
-results
show violation messages [default: on]
-rules
generate rule files for the TICS plugin
-showresolved
show resolved violations in violation overview
-showsuppressions
show suppressed violations in violation overview
-showsynopsis
show rule synopsis in violation overview [default: on]
-sort level|linenr|new
sort the violations according to the specified criterion (default 'linenr')
-srcfile file
source file that is used to check header file
-st
dump stack trace in case of errors
-synchronize
synchronize the file server files with the client
-timeinfo
show timing information on individual process stages [default: on]
-tmpdir dir
use the specified directory for intermediate files
-totaloverviews
show cumulative violation overview tables [default: on]
-version
show version info and exit
-viewer
uploads client results to the TICS Viewer for the purpose of the Client Viewer functionality
-xml file
output the analysis results to file in XML format

Configuring TICS

It is possible to configure TICS via a graphical user interface named TICSConfig. You can open TICSConfig by executing TICSConfig from the command-line. From an IDE, you can open TICSConfig by clicking the respective toolbar icon. TICSConfig will store settings persistently on disk (on Windows located in the directory %APPDATA%/TICS) and subsequent runs will take these settings into account.

List of Metrics supported by TICS client

The following metrics can be passed as an argument to the client:

Note that some of these are metric aliases that allow to invoke multiple metrics with a single argument. These are the following:

The following example shows how to use a metric alias:

TICS -calc AVGCYCLOMATICCOMPLEXITY,UNITTESTCOVERAGE /home/user/repository

This invocation of the client will invoke the following metrics on the directory /home/user/repository: AVGCYCLOMATICCOMPLEXITY, UNITBRANCHCOVERAGE, UNITDECISIONCOVERAGE, UNITFUNCTIONCOVERAGE, UNITSTATEMENTCOVERAGE.

The following metric abbreviations are available:

The following example shows how to use a metric abbreviation:

TICS -calc CY,UTC /home/user/repository

This invocation of the client will invoke the following metrics on the directory /home/user/repository: AVGCYCLOMATICCOMPLEXITY, MAXCYCLOMATICCOMPLEXITY, UNITBRANCHCOVERAGE, UNITDECISIONCOVERAGE, UNITFUNCTIONCOVERAGE, UNITSTATEMENTCOVERAGE.

Violation Suppression

It is possible to suppress individual violations. Suppressing a violation can be done by using special comments in the code. These special comments start with "//TICS" or "/*TICS". After the preceding "//TICS" or "/*TICS" one can specify what rules are suppressed by means of a sequence of "-ruleid" statements. E.g.

//TICS -OBJ_16 -DCL_12

The rules specified in the TICS violation suppression comment are suppressed for the remainder of the file, starting at the line that contains the comment. The comment has file scope, i.e., it will not apply to included files or enclosing files. It is allowed to use wildcards to specify rules. To switch on a rule again, one can use "+ruleid" statements. It is also possible to suppress a rule of only one specific source line. This is possible with the option "!ruleid". Anything past whitespace or past either one of the special characters : , \ is treated as a comment.

The following example shows how this facility can be used in practice.

//TICS -OBJ_?: TODO still need to be fixed after discussion
// MainFrm.cpp : implementation of the CMainFrame class
//

#include "stdafx.h"
#include "test.h"

#include "MainFrm.h"

#ifdef _DEBUG
#define new DEBUG_NEW      //TICS !OSD_3:  AppWizard generated code
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMainFrame

IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd)

//TICS -*: AppWizard and ClassWizard generated code
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
      //{{AFX_MSG_MAP(CMainFrame)
        // NOTE - the ClassWizard will add and remove mapping macros here.
        // DO NOT EDIT what you see in these blocks of generated code !
      ON_WM_CREATE()
      //}}AFX_MSG_MAP
END_MESSAGE_MAP()
//TICS +*

IMPORTANT NOTES