All source files must meet project standards
To ensure that developers are following coding guidelines or other standards, you can evaluate their source files. You can create preoperation triggers to run user-defined programs, and cancel the commands that trigger them. For example, you can disallow checkin of C-language files that do not satisfy quality metrics. Suppose that you have defined an element type, c_source, for C language files (*.c).
Trigger definition on Linux and the UNIX system
cleartool mktrtype –element –all –eltype c_source \
–preop checkin –exec '/public/scripts/apply_metrics.sh $CLEARCASE_PN'
ApplyMetrics
Trigger definition on the Windows® system
cleartool mktrtype –element –all –eltype c_source ^
–preop checkin –exec "\\neon\scripts\appl_met.bat %CLEARCASE_PN%"
ApplyMetrics
This trigger type ApplyMetrics applies to all elements; it fires when any element of type
c_source is checked in. (When a new c_source element is created, the element is
monitored.) If a developer attempts to check in a c_source file that fails the
apply_metrics.sh or appl_met.bat test, the checkin fails.
Tip: The apply_metrics.sh script and the
appl_met.bat file can read the value of CLEARCASE_PN from its environment. Having it accept a
file name argument provides flexibility because the script or batch file can be invoked as a trigger
action, and developers can also use it manually.