Softilium: goode ideas, real tools Home | Download | Order | Contact me |

Using ClearCode

Home > ClearCode > ClearCode docs > Using ClearCode

What is ClearCode

ClearCode is a source code analysis tool. It is language-independent regexp-based tool that examines your source code for common rules or your own project-specific rules.

How ClearCode works

ClearCode uses regular expressions (also known as "regexps") to examine source code for dangerous code.

Each project manager knows many rules for source code that specified only for his project.

ClearCode shows you "dangerous" code fragment. And you may fix it from built-in editor.

I use ClearCode all time while I am doing project/build management in software projects.

ClearCode checks whole folder and all sub-folders recursively.

Where to obtain details for regexps syntax?

ClearCode uses PCRE (Perl-compatible regular expressions) engine. See details at  http://www.pcre.org/.

Where to define rules?

ClearCode uses INI files to store rules.

There are two kinds of INI files: global and local. Global INI file resides in the same folder with "ClearCode.exe" and has same name, typically: "ClearCode.ini". Local INI has same name and can be placed in source code folders optionally to tune "folder-specified rules". When you check these folders with ClearCode, information from local INI files will be used, too.

Rules syntax

Rules are placed in INI file sections.

There are two kinds of sections:

1. Sections that define rules for source code checking. Parameters are:

FileMasks  

File mask(s) for retrieving files for checking. Multiple masks are separated by ";".  

FindPattern  

If this regexp is matched then rule reports error.  

StopPattern  

If both "FindPattern" and "StopPattern" are matched, rule do not reports anything.  

SplitRule  

This regexp defined bounds for splitting whole source code into "virtual sections". If "SplitRule" is defined, each "virtual section" will be examined for FindPattern/StopPattern  

Message  

Explained error message.  

Active  

Activity of this rule. By default all rules are active (1). But you can turn rule off by assigning "0" into "Active" parameter.  

CheckAllForCheck, CheckAllForStop, CheckAllForSplit  

Tells ClearCode to do not clear comments from source file before applying FindPattern, StopPattern, SplitRule. By default, all CheckAllXXX values are "False".  

2. Sections that define rules for detecting comments in source code (See "CheckAll" parameter). Parameters are:

FileMasks  

File mask(s) for retrieving files for checking. Multiple masks are separated by ";"  

LineComment  

Regexp for detecting line comments.  

BeginComment  

Regexp for detect begin of multi-line comment.  

EndComment  

Regexp for detect end of multi-line comment.  

Options

Global and local INI files may contains [Options] section that describes some behavior details in ClearCode.

Parameter name  

Default Value  

Global INI  

Local INI  

HTMLEncoding  

No default value  

ClearCode uses this parameter when you issue a command "Save messages"  

Defining this parameter in local INI does anything.  

LogFileName  

No default value  

ClearCode uses this parameter to log all messages from this folder only. If folder contains error, local "LofGileName" file will be created.  

You can turn this behavior off for local folders by setting "LogFileName" to empty string. Also, you can change log file name for local folders.  

Recursive  

Y or 0  

Tell ClearCode to check specified folder recursively.  

Same as global. Frequently used to prevent some folders from checking.  

You can override global rules at any level of local INI files. How? Just example:

== global ClearCase.ini ==

[SampleRule]

Active=1

FindPattern=ObsoletedProcCall

Message=ObsoletedProcCall is not allowed

== end of global ClearCase.ini ==

== local ClearCase.ini ==

[SampleRule]

Active=0

== end of local ClearCase.ini ==

Isn't so difficult?


 Next
=== Documentation is generated by Word2Help ===

Copyright © 2000-2005, Nick Mokhnatov, Independent software developer. Terms of use. Privacy statement.
Updated on Sun, February 11, 2007