Using a customized Naming script file
In HCL DevOps Test Embedded for Eclipse IDE (Test Embedded for Eclipse IDE), you can utilize the capabilities of Code Review to edit and customize a Perl Naming script file, adapting it to comply with your specific naming rules. With this feature, you have the flexibility to verify only the symbols found within the sources under test.
Testing symbols name with a customized script file
In Test Embedded or Test Embedded Studio, you can use Code Review to perform naming rule checks on the symbols in your source code under test.
- Enum names
- Struct/union fields names
- Variables names
- Functions names
These checks are performed using a Perl Naming script file that you can
customize to your specific naming rules. The Rules raised can be
Rule U99.1 to Rule U99.10. You have the flexibility to adjust their
level (error/warning) within the confure_2012.xml
and confrule.xml
files. The rule description is
passed as a parameter, that allow you to set it inside the Perl
script.
- Generate a .xob for each source
- Use the
crccc
to create a .xob file for each source, incorporating symbols such as@vars
,@types
,@fields
,@enums
,@fcts
,@files
, and@basetypes
. This process results in the generation of the Naming database in Perl.
- Use the
- Generate a cross reference file in Perl format
- Utilize
crcld
with the -xref option to generate a cross-reference file in Perl format (<xref_file_name.pl>), which includes information on files, types, variables, and functions.
- Utilize
- Create a Perl script with custom rules
- Create a Perl script that incorporates specific rules, by using the database created (<xref_file_name.pl>). See the database array description in the example script "NamingRules1.pl" located in <Installation folder>\lib\scripts. The Perl script creates an additional .xob file containing the application of your user-defined rules to the existing database.
- Generate the Code Review report
- Utilize
crcld
on all .xob files, which include those generated bycrccc
and your custom script file.
- Utilize
Setting the path to a customized Naming script file:
- From the Project Explorer view, select the project node.
- Right-click and select Settings.
- Select
- Select the Code Review checkbox.
- Select the sample file that you installed: Example “NamingRules1.pl".
- Click Apply.
Modifying the naming rules
You are provided with a tool along with the file 'NamingRules1.pl,' located in the folder <Installation folder>\lib\scripts.
The 'NamingRules1.pl' file contains several examples of Naming Rule checkers, all linked to the first rule, U99.1. You can copy and edit this example. Modify existing rules or add new rules based on the documentation found in the header file (database array description).
Using naming script from the command line in Makefile
crccc <source> <xob> <def> <opp> [<options>]
where: <source> is the C source file under analysis.
<xob> is the name of the generated object file.
<def> is the standard definitions file. This file is searched in the $ATLTGT directory.
<opp> is the parser options file. This file is searched in the $ATLTGT directory.
crccc mysource.c output.xob atus_c.def atl.opp rule=$TESTRT_DIR/plugins/Common/lib/confrule.xml
For
more information about the options, see C
Code Review Compiler - crccc.crcld -xref="<model_file>.pl" "<crccc_result_file>.xob" -RULE="<confrule file>.xml" -TEST
<model_file>.pl
: Contains data needed for custom namecheck rules.<model_file>.R99.1.xob
: File to be used in the final launch ofcrcld
.
You can use this xob file as usual on next call to crcld:
crcld -crc="<crc_file_name>.crc" "<all other xob file name>.xob" "<model_file>.R99.1.xob" -RULE="<confrule_file>.xml" -TEST