# Pull request reviews

Rectifier reviews pull requests on GitHub, Bitbucket and Azure DevOps, and merge requests on GitLab. It posts each
finding on its line, and a summary with a verdict.

## Ask for a review

Start a comment with `@imbik-rectifier review` on a PR in GitHub or GitLab. On Bitbucket and Azure DevOps, start it
with `@rectifier review` instead. Either can be followed by one of these words:

| Word | Effect |
| --- | --- |
| (none) | The default review type in Settings, or the repository's override: a full review unless you set it to light. A full review usually takes 4 to 10 minutes. |
| `full` | A full review |
| `light` | A light review: fewer checks, finds less |

Example: `@imbik-rectifier review light`. On Bitbucket and Azure DevOps: `@rectifier review light`.

A light review says so at the end of its summary. On GitHub, while a review runs, the "Rectifier review" check on
the commit says whether it is a full or a light review, if the Rectifier app has write access to checks and the check is
turned on for your account. On Bitbucket and Azure DevOps, a similar status appears when
the "Show a status" [setting](#settings) is on. GitLab shows no status.

- Only people the repository trusts can ask: owners, members and collaborators on GitHub, project members on GitLab,
  and members of the workspace on Bitbucket. On Azure DevOps, anyone who can comment in a private project can ask.
- On GitLab, adding `imbik-rectifier` as a reviewer also asks for a review.

### Set the review type for one PR

If a repository reviews PRs automatically and one PR needs the other review type, put `[rectifier.type=full]`
or `[rectifier.type=light]` at the top of its description. Each review of that PR that does not name a type then
uses the tag's type. This includes the first automatic review, each review after a push, and a comment without
`full` or `light`. A comment that names a type still gets that type. The tag also works in the title, but a squash
merge copies the title into the commit message.

On GitHub, a comment that names a type also keeps it for later reviews of the PR, when it comes from someone the
repository trusts and Rectifier reads it within an hour: Rectifier writes the tag for that type into the PR,
replacing the tag that counts (the title's, else the description's) or adding one at the top of the description. The newest choice wins: to change it, comment with the other type or edit the tag. The edit is made by
the Rectifier app, so a workflow of yours that runs when a PR is edited runs once for it, and a tool that rewrites PR
descriptions can remove the tag. On GitLab, Bitbucket and Azure DevOps, add or edit the tag yourself.

## Settings

| Setting | Default | Effect |
| --- | --- | --- |
| Default review type | Full | Full or light, for every review that does not name a type: an automatic one, or a comment without `full` or `light` |
| Review PRs when opened | Off | Reviews each new or reopened change, and each draft marked ready |
| Review PRs on every push | Off | Reviews again after each push to a change that is not a draft |
| Request changes at | High | The lowest severity that blocks |
| Message for a coding agent | Off | Ends each finding's comment with a message to paste into a coding agent to fix it |
| Show a status | Off | Bitbucket and Azure DevOps only. Shows the review's progress as a status while it runs: on the commit on Bitbucket, on the pull request on Azure DevOps. A merge check or policy that waits for the status waits for the review to end. The status never fails, so it does not block a merge on what the review found |

### Repository overrides

One repository can use a different value for some settings, in the repository overrides on the Settings page:
default review type, the two review triggers, cross-repository reading (GitHub and GitLab only), whether to show a
status (Bitbucket and Azure DevOps only) and the severity that requests changes. Choose a repository, then add the
settings it changes. It follows your organization for the rest. On the Repositories page, a repository
with overrides links to them.


## Re-reviews

- A later review reads only what changed since the last one. It reads the whole change after a rebase, a
  force push, a change of target branch, and in a few other cases.
- A finding already posted is not posted again. The summary still lists it as "(earlier round)", and it still counts
  toward the verdict.

## Replies and resolved threads

- The next review reads replies to its findings. If a reply says the code changed, the reviewer checks the current code. If the fix is there, the finding isn't reported again. 
- To dismiss a finding, resolve its thread. If a repository member resolves it and the code near it does not change,
  later reviews hold that finding back, meaning it does not count toward the verdict. Critical findings
  are never held back. Unresolve the thread to undo this. On Azure DevOps, resolving a thread does not hold a finding
  back, because Azure DevOps does not say who resolved it.

