Helix Swarm Guide (2018.3)

Reviews

This section describes the configurables that can be set for reviews.

Disable self-approval of reviews by authors

The Swarm 2015.2 release provides the ability to disable review approval by authors, even if they are moderators or administrators. This is useful for development workflows where review by others is of paramount importance.

To disable review approval by authors, update the SWARM_ROOT/data/config.php file to include the following configuration item within the reviews block:

            'reviews' => array(
'disable_self_approve' => true,
),

The default value is false.

Moderator behavior when a review spans multiple branches

By default, when a review spans multiple project branches that have different moderators, only one moderator from any one of the branches needs to approve the review. Set the configurable to each to require one moderator from each branch approve the review. If a moderator belongs to more than one of the branches spanned by the review, their approval will count for each of the branches they belong to.

To require one moderator from each branch to approve a review, edit the SWARM_ROOT/data/config.php file and set the moderator_approval configurable to each in the reviews section of the codeblock:

            'reviews' => array(
'moderator_approval' => 'each', // 'any|each'
),

The default value is any.

Prevent Approve for reviews with open tasks

When enabled, Swarm will not allow you to Approve, or Approve and Commit a review that has open tasks. To approve, or approve and commit a review with open tasks, you must address the tasks first and then set them to Task Addressed, or Not a Task, see Set a task to Task Addressed or Not a Task for details.

Important

If the open tasks on the review are archived, the review can then be approved, or approved and committed.

To prevent reviews being approved, or approved and committed when the review has open tasks, update the SWARM_ROOT/data/config.php file to include the following configuration item within the reviews block:

            'reviews' => array(
'disable_approve_when_tasks_open' => true,
),

The default value is false, in this case a warning is displayed for the open tasks but the action is allowed.

Protected end states

By default, you can update the content of a review no matter what state the review is in. Reviews can be protected from content change if they are in a specified state by using the end_states configurable.

If workflow is disabled (default):

When the content of a review is updated, the end_states array is checked to see if the review can be updated. If the review state matches a state in the end-states array the submit is rejected.

If workflow is enabled:

The end_states configurable sets the protected review states. A combination of the global end_rules configurable and workflows determines which projects and branches have protected reviews.

To set the protected review states, update the SWARM_ROOT/data/config.php file to include the following configuration item within the reviews block. In this example the Archived, Rejected, and Approved : Committed states are specified:

            'reviews' => array(
'end_states' => array('archived','rejected', 'approved:commit'),
),

Valid review states for the array:

  • archived: the review state is Archived.
  • rejected: the review state is Rejected.
  • approved:commit: the review has been approved and committed, the review state is Approved : Commit.
  • approved: the review state is Approved.

By default the array is empty, review content can be updated no matter what state the review is in.

Process shelf file delete when

By default, when you delete files from a shelved changelist, the files are not removed from the associated review.

When you have a review state set in the process_shelf_delete_when array, Swarm will automatically carry out the following steps when a file is deleted from a shelf:

  1. Check to see if the shelf is associated with a review.
  2. The deleted file is only removed from the review if the review state matches the review state in the process_shelf_delete_when array.
Tip
  • More than one review state can be specified in the process_shelf_delete_when array.
  • When files are removed from a review, any votes on the review become stale. The vote counts are reset, and the vote indicators are muted.
  • If process_shelf_delete_when is configured and the review is in a state that is specified in the array: When the review contains a file that is a common to multiple changelists that are associated with the review, if the owner of any of the associated pending changelists deletes the common file from their shelf, that file will be removed from the review, and a new version of the review will be created. This is true even if the file is not the most recent version in the review.

Important

Required for process_shelf_delete_when:

Important

Do not use the Swarm user that is configured in the Swarm configuration file when deleting shelves, or deleting files from shelves. The Swarm logic processes the shelve-delete trigger event, if the event is invoked by the Swarm user it is rejected. The delete operations will fail.

To remove files from a review when they have been deleted from an associated shelved changelist and the review is in a specified state, update the SWARM_ROOT/data/config.php file to include the following configuration item within the reviews block. In this example the Needs Review and Needs Revision states are specified:

            'reviews' => array(
'process_shelf_delete_when' => array('needsReview', 'needsRevision'),
),

Valid review states for the array:

  • needsReview: the review state is Needs Review.
  • needsRevision: the review state is Needs Revision.
  • rejected: the review state is Rejected.
  • approved: the review state is Approved.
  • Leave the array empty to disable this feature, see below. This is the default setting for the array.
  •             'reviews' => array(
    'process_shelf_delete_when' => array(),
    ),

Note

If a review is Approved and Committed or Archived, files will not be removed from the review when they are deleted in an associated shelf. This is true even if the approved:commit or archived states are in the process_shelf_delete_when array.

Allow author change

When enabled, the author of a review can be changed. This is useful in the case where the original author is no longer available, and someone else needs to take over ownership.

To allow the author of a review to be changed, update the SWARM_ROOT/data/config.php file to include the following configuration item within the reviews block:

            'reviews' => array(
'allow_author_change' => true,
),

The default value is false.

Allow author obliterate review

When enabled, users can obliterate reviews that they have authored. For details about how to obliterate a review, see Obliterate Review.

Important

By default, only users with admin and super user rights can obliterate a review. Perforce recommends that the allow_author_obliterate configurable is kept at its default value of false. An obliterated review cannot be reinstated, not even by Perforce Support.

To allow users to obliterate reviews that they have authored, update the SWARM_ROOT/data/config.php file to include the following configuration item within the reviews block:

            'reviews' => array(
'allow_author_obliterate' => true,
),

The default value is false.

Synchronize review description

By enabling the synchronization of review descriptions, it becomes possible to update the description of a review by updating the description of a changelist associated with the review. Whenever an associated changelist is saved, the text of the review will be updated to match.

Note

Attaching another changelist to a review, or updating the files in a changelist will not trigger this update, but updating the description of additional attached changelists will.

To enable synchronize review descriptions, update the SWARM_ROOT/data/config.php file to include the following configuration item within the reviews block:

            'reviews' => array(
'sync_descriptions' => true,
),

The default value is false.

Expand all file limit

The review page has an Expand All button that opens all the files within that review. If the number of files is large, clicking the button might affect performance.

The expand_all_file_limit disables the button if the number of files in the review exceeds the given value. If the value is set to zero, the button is always enabled and can therefore open all the files.

To change the expand all file limit, update the SWARM_ROOT/data/config.php file to include the following configuration item within the reviews block:

            'reviews' => array(
'expand_all_file_limit' => 10,
),

The default value if the option is not specified is 10.

Expand group reviewers

By default, reviewer group members are not displayed in the Individuals area of the reviews page when they interact with a review (vote, comment, update, commit, archive, etc.). This avoids overloading the Individuals area with individual avatars if you have large reviewer groups.

Note

An exception to this behavior is when a member of a reviewer group is also an individual required reviewer, in this case their avatar will be displayed in the Individuals area.

When expand_group_reviewers is set to true, reviewer group members are added to the Individuals area of the review page when they interact with the review (vote, comment, update, commit, archive, etc.). If you have large reviewer groups, this might affect performance.

To expand group reviewers, update the SWARM_ROOT/data/config.php file to include the following configuration item within the reviews block:

            'reviews' => array(
'expand_group_reviewers' => true,
),

The default value is false.

Disable tests on approve and commit

When an approved review is committed, disable_tests_on_approve_commit is used to determine if the automated tests are run on the commit (Automated tests) must be configured). This is a global setting and is used for all of the Swarm projects.

Note
  • When a changelist is committed outside of Swarm and the changelist has been approved, this setting is used to determine if automated tests should be run.
  • When a changelist is committed outside of Swarm and the changelist does not have a review, this setting is ignored and the automated tests are run.
  • When a changelist is committed outside of Swarm and the changelist has not been approved, this setting is ignored and the automated tests are run.
Tip

The disable_tests_on_approve_commit setting is also used when Approve and Commit is selected from Review State dropdown button on the review page.

To disable tests on approve and commit, update the SWARM_ROOT/data/config.php file to include the following configuration item within the reviews block:

            'reviews' => array(
'disable_tests_on_approve_commit' => true,
),
  • disable_tests_on_approve_commit = false: automated tests will be run when a review is approved and committed. This is the default setting.
  • disable_tests_on_approve_commit = true: automated tests will not be run when a review is approved and committed. This is useful when the tests take a long time and the codeline is stable.

More context lines

The Review display and Changelist display pages have Show More Lines above and Show More Lines Below buttons on the file diff view when a file is expanded. The buttons are used to display more lines of context for the file being viewed. By default 10 extra lines are displayed.

To change the number of lines displayed when the buttons are clicked, update the SWARM_ROOT/data/config.php file to include the following configuration item within the reviews block:

            'reviews' => array(
'more_context_lines' =>15, // defaults to 10 lines
),

The default value if the option is not specified is 10.