TICS Analyzer - The TIOBE Coding Standard Checker - User Guide

The TIOBE Coding Standard (TICS) analyzer is capable of checking source code to inspect whether it adheres to the coding standards. Currently, TICS checks C, C++, C#, and Java code.

Table of Contents

Command Line Interface
Violation Suppression
Visual Studio.NET 2003, 2005 and 2008 Integration
Visual Studio 6 Integration
Tasking EDE Integration
Questions and Suggestions

Command Line Interface

TICS can be called from within a command shell by means of TICS [ @ ] { input } ... [ -- { compiler options } ]. Examples of TICS calls are TICS xyz.cpp abc.c and TICS @xyz.dsp. 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. 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.

The following TICS options are allowed.

-- { compiler options } all following arguments will be passed to the compiler
-checkedoutonly only check files that are checked out
-compiler compiler use compiler as compiler (one of CodeComposer|Custom|DDK|Gcc|Keil|MULTI|Qac|Tasking|Tornado|VC)
-compileroptions options pass the specified (comma separated) options to the compiler
-config config use config as compiler configuration
-delta scm tag show only new violations relative to scm tag in the database
-deltaonly show only new violations relative to database
-exitsqa use the QA acceptation (yes/no) as the exit code
-exitviolations use the number of violations found as the exit code
-help show all options
-ide ide name format the output for the given ide (where ide name is one of eclipse|rrt|tasking|tornado|vs6|vs7|vs8|vs9)
-level integer show violations upto specified level
-log integer show diagnostics and keep intermediate files
-lowpriority Only used by the client wrapper on Windows. Start the server TICS executable with low priority. This may be convenient when running TICS from an IDE add-in.
-maxresults integer show maximally the specified number of violations
-noconfig do not use TICSConfig settings
-nodelta do not show deltas
-noproject do not use the TICSPROJECT environment variable
-nowarn suppress all warnings
-overviews show overview tables after processing each file (default)
-project name use quality database name to compare results
-projfile projfile use projfile as project file for the input file
-results show violation messages after processing each file (default)
-srcfile file source file that is used to check specified header file
-st dump stack trace in case of errors
-synchronize synchronize the server files with the client
-timeinfo show timing information on process stages (default)
-tmpdir dir write intermediate files in directory dir (instead of a default temporary directory)
-totaloverviews show cumulative overview tables after processing all files (default)
-version show version info and exit

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 starts 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".

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

  • Do not suppress a rule because there is a false positive in TICS or in case you think the coding standard document should be adjusted. If so, inform the TICS support team instead.
  • Suppressions are stored in the database. So, although they are not shown in the overviews of a TICS run, they are visible in the TICS viewer.

Visual Studio.NET 2003, 2005 and 2008 Integration

The TICS add-in for Visual Studio.NET 2003, 2005 and 2008 consists of a toolbar with four buttons (see the picture below).

image
The TICS buttons have the following meaning.
  • image Analyze the active File: pressing this button starts the TICS analysis. It results in an overview of the violations of the available coding standards.

  • image Analyze all files in project: pressing this button starts analyzing all files in the current dsp project file. It results in a consolidated overview for all files in the project.

  • image Cancel analysis: pressing this button cancels the TICS run.

  • image Rules and Options configuration: in order to focus on a certain set of violations it is possible to define a personalized view of violations within TICS. When pressing this button the following dialog appears.

    image
    The Rules tab: specify which violations to show.

    The rules are categorized by language and by level. Rules can be switched on and off per level or individually. If a rule has been switched off it is not shown anymore in the output window of Visual Studio. Note that hidden violations are still detected and being used for statistical overviews. You can right-click on a rule for its documentation. The settings specified by the user are saved in the HIDDEN.txt file.

    image
    The tab General Options provides general TICS options.
    image
    The tab Analyzer Options provides options for the TICS analyzer.
    image
    In the tab File Options options can be set for individual files.

    It is possible to run TICS for new files that are not yet part of the archive. To this end, compiler options and include paths need to be specified explicitly to be able to analyze source files properly. These options are also used to indicate what source file corresponds to an include file that is going to be checked by TICS in case there is no connection to the TICS Quality Database.

    Note that paths are not supported, so only the name of the file is checked during code checking.

    To set options for a file directly, right-click a file in Visual Studio and select TICS file options... from the context menu.


Visual Studio 6 Integration

The TICS add-in for Visual Studio 6 consists of a toolbar with six buttons (see the picture below).
image
The TICS buttons have the following meaning.
  • image Start/Stop Analyzing File: pressing this button starts the TICS analysis. It results in an overview of the violations of the available coding standards. To cancel the current run, press the button again.
  • image Analyze all Files in Project: pressing this button starts analyzing all files in the current dsp project file. It results in a consolidated overview for all files in the project. To cancel the current run, press the button again.
  • image Hide/Show Violations: in order to focus on a certain set of violations it is possible to define a personalized view of violations within TICS. When pressing the button Hide/Show Violations the following dialog appears.
    image
    The rules in the column Hide are hidden when running TICS. This means that they are not shown anymore in the output window of Visual Studio. Note that hidden violations are still detected and being used for statistical overviews. The settings specified by the user are saved. The level slider enables selecting all rules up to a certain level.
  • image TICS Settings: it is possible to run TICS for new files that are not yet part of the archive. To this end, compiler options and include paths need to be specified explicitly to be able to analyze source files properly. The settings button enables setting these properties. This same button is also used to indicate what source file corresponds to an include file that is going to be checked by TICS in case there is no connection to the TICS Quality Database.
  • image Help/About: this button gives information about the release number, provides a clickable reference to this document and explains what to do in case you have questions, suggestions or remarks.

Tasking EDE Integration

It is possible to run TICS from within the Tasking IDE called EDE. To this end you have to perform the following steps.
  • Open your Tasking project in the IDE
  • Select Project->Properties...
  • Select the Tools tab
  • Select Category Custom
  • Press the first button of Description: to add a new entry
  • Enter TICS and press OK
  • Enter TICS.exe %b%e -project auto in the Command: menu
  • Select Redirect output, Save current file and Use VSDOS from Command Options:
The Project Properties dialog should now look as follows.
image
  • Select the Errors tab
  • Press the Custom Error Parsers...
  • Specify TICS as Parser name:
  • Specify ^([^ \t\n(].+)[ \t(]([0-9]+)[ \t):]+(.*)$ as Pattern:
  • Specify 1 for Filename:
  • Specify 2 for Line number:
  • Specify 3 for Error message:
Now the Custom Error Parser dialog will look as follows.
image
  • Press OK to go back to the Errors tab
  • Specify _ErrorInfoParser TICS as Error Parser 1: and press OK
  • Now you can check a file by using Tools->TICS, the output will appear in the Build window
In order to use TICS support for Tasking one should make sure that the input file is part of a Tasking project file (extension .prj) and that the corresponding Tasking make file (extension .mak) is available.

Questions and Suggestions

The major goal of TICS is to improve the quality of the code archive by checking adherence to the coding standards. The TICS team welcomes any ideas or suggestions to achieve this goal faster and/or better. In case of questions or suggestion please e-mail to tics@tiobe.com or contact your local QA manager.