RADE

C++ Source Checker

mkCheckSource Quick Reference

Checking programming rules
Quick Reference

Abstract

The mkCheckSource command checks source code for validity against some programming rules. 
This command takes as input parameters the type of run and the pattern of sources or frameworks to analyse.
The errors detected are reported in html or text format.

Synopsis

mkCheckSource [-d workspace_dir] [-p concatenation_path_list] [-f framework_list_pattern | -s source_paths_pattern | -sourcelist source_path_pattern_file] [-Check | -CheckTst] [-settings setting_file_path] [-html html_output_dir] [-h]

Usage

You can specify the workspace directory containing the frameworks (or sources) to analyze. If no workspace directory is provided, the tools will look for a workspace directory including the directory of run. If none of the directories including the directory of run is a workspace, the tool will exit. If the command is launched from the root directory of a workspace, this option is useless.

You must specify the source code to analyze. You can specify :

You can specify the rules activated during the run (default will check only code frameworks, against default rules) : 

You can specify an output directory for html output. If the directory does not exist, it will be created. If none is specified, detected errors will be reported in standard output. 

[Top]

Options

The mkCheckSource command accepts the following options:
 
-h Help of the command.
-d workspace_dir

Workspace directory containing the frameworks (or sources) to analyze. If no workspace directory is provided, the tool will look for a workspace directory including the directory of run. If none of the directories including the directory of run is a workspace, the tool will exit. If the command is launched from the root directory of a workspace, this option is useless.

-p concatenation_path_list

List of paths corresponding to the workspace concatenation. Paths must be  separated by ";" on NT and ":" on UNIX. If this option is not specify (it is recommended not to specify this option), the tool will take the default concatenation_path_list used by mkmk (reading the Install_config file).

-f framework_list_pattern

Framework, list of frameworks or pattern matching a list of frameworks to analyze. These frameworks must be included in the workspace directory.

-s source_paths_pattern

Source path, list of source paths or pattern matching a list of source paths to analyze. Every source must be included in a framework contained in the workspace directory.

-sourcelist source_path_pattern_file

File containing a source path, a list of source paths or a pattern matching a list of source paths. One source path by line. Paths may be absolute or relative to run directory. Every source must be included in a framework contained in the workspace directory. This option is similar to option "-s source_paths_pattern", but input is a file. This option is useful on NT when you need  to analyze a  lot of source paths if you get the system error message "command line too long" with option "-s source_paths_pattern".

-Check

Code frameworks will be checked, against default rules.

-CheckTst

Both code and test frameworks will be checked, against default rules.

-settings setting_file_path

Specify your own setting file. This setting file will be appended to default settings file if used with option -Check or -CheckTst, or will replace any other if used alone. You can specify several setting_file_path by using this option several times.

-html html_output_dir

Directory for html output. If the output directory does not exist, it will be created. html_output_dir will contain a file named "Main.html", which is the main report file. If this option is not specified, errors detected will be reported in standard output.

If neither -Check nor -CheckTst is specified, only code frameworks will be checked.

[Top]

Examples

Let's consider the following Workspace named MyWorkspaceRoot.

This Workspace includes 3 code frameworks :

  • CAAApplicationFrame
  • CAAAssemblyUI
  • CAABskDocument

And 3 test frameworks :

  • CAAApplicationFrame.tst
  • CAAAssemblyUI.tst
  • CAABskDocument.tst

 

Analyzing every code frameworks

Every source file, of every module, of frameworks CAAApplicationFrame, CAAAssemblyUI and CAABskDocument will be analyzed, with default check settings. Assuming that tool is launched from E:\MyWorkspaceRoot. Output will be generated in E:\Csc.out\Main.html.

E:
cd E:\MyWorkspaceRoot
mkCheckSource -f * -html E:\Csc.out 
or 
E:
cd E:\MyWorkspaceRoot
mkCheckSource -f * -Check -html E:\Csc.out 

If tool is not launched from a directory under workspace directory:
mkCheckSource -d E:\MyWorkspaceRoot -f * -html E:\Csc.out 
or 
mkCheckSource -d E:\MyWorkspaceRoot -f * -Check -html E:\Csc.out 

 

Analyzing every code and test frameworks

Every source file, of every module, of frameworks CAAApplicationFrame, CAAAssemblyUI, CAABskDocument, CAAApplicationFrame.tst, CAAAssemblyUI.tst and CAABskDocument.tst will be analyzed, with default check test settings. Assuming that tool is launched from E:\MyWorkspaceRoot. Output will be generated in E:\Csc.out\Main.html.
E:
cd E:\MyWorkspaceRoot
mkCheckSource -f * -CheckTst -html E:\Csc.out 

If tool is not launched from a directory under workspace directory:
mkCheckSource -d E:\MyWorkspaceRoot -f * -CheckTst -html E:\Csc.out 

 

Analyzing every test frameworks.

Every source file, of every module, of frameworks CAAApplicationFrame.tst, CAAAssemblyUI.tst and CAABskDocument.tst will be analyzed, with default check test settings. Assuming that tool is launched from E:\MyWorkspaceRoot. Output will be generated in E:\Csc.out\Main.html.
E:
cd E:\MyWorkspaceRoot
mkCheckSource -f *.tst -CheckTst -html E:\Csc.out 

If tool is not launched from a directory under workspace directory:
mkCheckSource -d E:\MyWorkspaceRoot -f *.tst -CheckTst -html E:\Csc.out

 

Analyzing only one framework.

Every source file, of every module, of framework CAAApplicationFrame will be analyzed. Assuming that tool is launched from E:\MyWorkspaceRoot. Output will be generated in E:\Csc.out\Main.html.
E:
cd E:\MyWorkspaceRoot
mkCheckSource -f CAAApplicationFrame -html E:\Csc.out 

If tool is not launched from a directory under workspace directory:
mkCheckSource -d E:\MyWorkspaceRoot -f CAAApplicationFrame -html E:\Csc.out 

 

Analyzing a pattern matching a list of frameworks.

Every source file, of every modules, of frameworks CAAApplicationFrame, CAABskDocument and CAABskDocument.tst will be analyzed. Assuming that tool is launched from E:\MyWorkspaceRoot. Output will be generated in E:\Csc.out\Main.html.
E:
cd E:\MyWorkspaceRoot
mkCheckSource -f CAAApplicationFrame CAABsk* -CheckTst -html E:\Csc.out 

If tool is not launched from a directory under workspace directory:
mkCheckSource -d E:\MyWorkspaceRoot -f CAAApplicationFrame CAABsk* -CheckTst -html E:\Csc.out 

 

Analyzing only one source file

Only source E:\MyWorkspaceRoot\CAAAfrGeoCommands.m\src\source001.cpp will be analyzed. Output will be generated in E:\Csc.out\Main.html. Assuming that tool is launched from E:\MyWorkspaceRoot.
E:
cd E:\MyWorkspaceRoot
mkCheckSource -s CAAApplicationFrame\CAAAfrGeoCommands.m\src\source001.cpp -html E:\Csc.out 

If tool is not launched from E:\MyWorkspaceRoot (option "-d workspace_dir" is useless):
mkCheckSource -s E:\MyWorkspaceRoot\CAAApplicationFrame\CAAAfrGeoCommands.m\src\source001.cpp -html E:\Csc.out 

 

Analyzing a pattern matching a list of source files

Every source file, of module CAAAfrGeoCommands of framework CAAApplicationFrame, and every source file, of every module, of framework CAAAssemblyUI will be analyzed. Assuming that tool is launched from E:\MyWorkspaceRoot. Output will be generated in E:\Csc.out\Main.html.
E:
cd E:\MyWorkspaceRoot
mkCheckSource -s CAAApplicationFrame\CAAAfrGeoCommands.m\src\*.cpp CAAAssemblyUI\*.m\src\*.cpp -html E:\Csc.out 

If tool is not launched from E:\MyWorkspaceRoot (option "-d workspace_dir" is useless):
mkCheckSource -s E:\MyWorkspaceRoot\CAAApplicationFrame\CAAAfrGeoCommands.m\src\*.cpp
	E:\MyWorkspaceRoot\CAAAssemblyUI\*.m\src\*.cpp -html E:\Csc.out 

 

Using your own Setting File

Let's assume that you wrote your own setting file, E:\Settings_User.xml [1].

If you want to use only this setting file (no delivered setting file will be taken into account):
mkCheckSource -f * -settings E:\Settings_User.xml -html E:\Csc.out 

If you want your own settings to be added to default delivered setting file:
mkCheckSource -f * -Check -settings E:\Settings_User.xml -html E:\Csc.out 

 

Using several Setting Files

Let's assume that you wrote 2 setting files, E:\Settings_User.xml and E:\Settings_User2.xml.

If you want the settings defined in Settings_User2.xml to be added to Settings_User.xml (Settings_User.xml will first be taken into account), the command is:
mkCheckSource -f * -settings E:\Settings_User.xml -settings E:\Settings_User2.xml -html E:\Csc.out 

[Top]

References

[1] Setting Files
[Top]

History

Version: 1 [Apr 2001] Document created
[Top]

Copyright © 2001, Dassault Systèmes. All rights reserved.