Menu Path: Rhapsody>Check-in Comment Rules

Required Access Rights:

  • Make changes with the IDE

Optional Access Rights:

  • Configure check-in comment rule

You can use the Check-in Comment Rules dialog to enforce check-in comments and to manage rules for check-in comments:

If more than one rule has been enabled, all enabled rules are applied to validate the check-in comment. The check-in comment must pass all enabled rules.

Dialog Element Description
Mandatory check-in comments checkbox Enable or disable enforcement of mandatory comments on commits. By default, check-in comments are not enforced by Rhapsody.
Add Rule button Add a rule.
Edit Rule button Edit a rule.
Remove Rule button Delete a rule.
Rules panel Lists the name and composition of each added rule, and allows you to enable or disable each rule with a checkbox.
Select All link Select all rules.
Deselect All link Deselect all rules.
Test Comment field Accepts a test comment.
Test button Initiate a test.
Test Result area (adjacent to the Test button)

Displays a message indicating the result of the test. An automatic test result message is provided if the test passes or fails, but you are able to configure a customized message to indicate a check-in comment has failed a specified rule.

Adding Check-in Comment Rules

To add a check-in comment rule:

  1. Navigate to Rhapsody>Check-in Comment Rules to open the Check-in Comment Rules dialog.
  2. Check the Mandatory check-in comments checkbox if you want to enforce comments on check-ins.
  3. Select the Add Rule button to display the Check-in Comment Rule dialog:

  4. Enter the following information in the appropriate fields:
    • The rule format expressed as a regular expression that the comment has to match. Refer to Regular Expressions Support for details.
    • The text of the failure message if the comment fails to match the regular expression.
  5. Test your rule:
    1. Enter a test comment in the Test Comment field.
    2. Select the Test button.
    3. Observe the test result message to verify the rule behaves according to your requirements.
  6. Select the OK button to add a new rule or the Cancel button to revert your changes.
  7. Select the OK button in the Check-in Comment Rules dialog to save your changes or the Cancel button to revert your changes.

Enforcing Check-in Comment Rules

By default, Rhapsody does not enforce check-in comment rules. To enforce check-in comment rules:

  1. Navigate to Rhapsody>Check-in Comment Rules to open the Check-in Comment Rules dialog.
  2. Check the Mandatory check-in comments checkbox to enforce comments on commits.
  3. Select the OK button to save your changes or the Cancel button to revert your changes.

Editing Check-in Comment Rules

To edit an check-in comment rule:

  1. Navigate to Rhapsody>Check-in Comment Rules to open the Check-in Comment Rules dialog.
  2. Select the rule you want to edit and select the Edit Rule button, or double-click the rule you want to edit to display the Check-in Comment Rule dialog.
  3. Make the appropriate changes in the Check-in Comment Rule dialog.
  4. Select the OK button to update the rule or the Cancel button to revert your changes.
  5. Select the OK button in the Check-in Comment Rules dialog to save your changes or the Cancel button to revert your changes.

Viewing Check-in Comment Rules

To view a check-in comment rule:

  1. Navigate to Rhapsody>Check-in Comment Rules to open the Check-in Comment Rules dialog.
  2. Double-click on a rule to view its details in the Check-in Comment Rule dialog.
  3. Select the OK button to close the Check-in Comment Rule dialog or the Cancel button to revert your changes.
  4. Select the OK button to close the Check-in Comment Rules dialog or the Cancel button to revert your changes.

Viewing Check-in Comment Rules in Read-only Mode

You are only able to open in the Check-in Comment Rules dialog in read-only mode if:

  • You do not have the 'Configure check-in comment rule' access right.
  • The Check-in Comment Rules dialog is already open in another Rhapsody IDE session.

In read-only mode, you can double-click on an existing rule in the Check-in Comment Rules dialog to view its details in the Check-in Comment Rule dialog.

Deleting Check-in Comment Rules

To delete a check-in comment rule:

  1. Navigate to Rhapsody>Check-in Comment Rules to open the Check-in Comment Rules dialog.
  2. Select the rule you want to delete and select the Remove Rule button.
  3. Select the OK button to save your changes or the Cancel button to revert your changes.

Disabling Check-in Comment Rules

To disable a check-in comment rule:

  1. Navigate to Rhapsody>Check-in Comment Rules to open the Check-in Comment Rules dialog.
  2. Uncheck the checkbox associated with the rule you want to disable.
  3. Select the OK button to save your changes or the Cancel button to revert your changes.

Regular Expressions Support

Rhapsody supports the Java regex library. Refer to http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html for details.

Rhapsody uses the following regex modes of operation:

  • Case-sensitive matching.
  • Partial matching - if an exact match is required, place ^ at the beginning and $ at the end of the entire input sequence.
  • DOTALL mode can be enabled by placing the embedded flag expression (?s) at the beginning of the regular expression.

For example, the regular expression check-in comment rule:

Example 1: Enforce the ticket number in check-in comment

Since regular expressions use partial matching, a single rule can address the requirement to enforce inclusion of the ticket number in a check-in comment.

Field Text
Name Include the ticket number
Regular Expression
(?i)Ticket:
Error Message Please include the ticket number in the check-in comment, the format is "Ticket:xxxx"

(?i) enables case-insensitive matching. Refer to http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#CASE_INSENSITIVE for details.

Valid Check-in Comments

Modified the JavaScript filter in Laboratory Route
 
Ticket: AA-1
Modified the JavaScript filter in Laboratory Route
 
ticket: AA-1

Invalid Check-in Comments

Modified the JavaScript filter in Laboratory Route

Example 2: Enforce author, ticket number, reviewer in check-in comments regardless of order

Three rules can be created separately to address author, ticket number and reviewer.

Field Text
Name Include the author
Regular Expression
(?i)Author:
Error Message Please include the author in the commit message, the format is "Author:xxxx"
Field Text
Name Include the ticket number
Regular Expression
(?i)Ticket:
Error Message Please include the ticket number in the check-in comment, the format is "Ticket:xxxx"
Field Text
Name Include the reviewer
Regular Expression
(?i)Reviewer:
Error Message Please include the reviewer in the check-in comment, the format is "Reviewer:xxxx"

Valid Check-in Comments

Modified the JavaScript filter in Laboratory Route

Author: James 
Ticket: AA-1
Reviewer: Bob
Modified the JavaScript filter in Laboratory Route

Author: James 
Reviewer: Bob
Ticket: AA-1

Invalid Check-in Comments

Modified the JavaScript filter in Laboratory Route

Ticket: AA-1
Author: James 

Example 3: Enforce author, ticket number, reviewer in check-in comment in order

A single rule can be created.

Field Text
Name Include the author, ticket number, reviewer in sequence
Regular Expression
(?s)(?i)Author:.*Ticket:.*Reviewer:

(?s) enables DOTALL mode which uses . to match any character, including the line terminator. Refer to http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#DOTALL for details.

Error Message

Please include the author, ticket number, reviewer in the check-in comment in sequence, the format is:

xxxxxxxxxxxxxxxxxx
Author: xxx
Ticket: xxx
Reviewer: xxx
xxxxxxxxxxxxxxxxxx

Valid Check-in Comments

Modified the JavaScript filter in Laboratory Route

Author: James 
Ticket: AA-1
Reviewer: Bob

Invalid Check-in Comments

Modified the JavaScript filter in Laboratory Route.

Reviewer: Bob 
Author: James 
Ticket: AA-1