Pull request review
prr
is a tool that brings mailing list style code reviews to Github PRs.
This means offline reviews and inline comments, more or less.
To that end, prr
introduces a new workflow for reviewing PRs:
- Download the PR into a "review file" on your filesystem
- Mark up the review file using your favorite text editor
- Submit the review at your convenience
The tool was born of frustration from using the point-and-click editor text boxes on PRs. I happen to do a lot of code review and tabbing to and from the browser to cross reference code from the changes was driving me nuts.
Installation / Quickstart
-
Install
prr
:-
Option 1: Install rust toolchain (if you haven't already): https://rustup.rs/
-
Option 2: Homebrew
-
-
Create a Github Personal Access Token (PAT) for
prr
:prr
will need this token so it can make GH API calls on your behalf. Create the token by going toSettings -> Developer settings -> Personal access tokens -> Generate new token
and give the tokenrepo
permissions.Keep the newly generated token handy for the next step.
-
Create a
prr
config file:where
$YOUR_PAT_FROM_LAST_STEP
is the PAT token from step 3 andworkdir
is the directory you wantprr
to place all your review files. -
Review your first PR:
Feel free to test
prr
out against my test repository, by the way.For details on how to actually mark up the review file, see the next section titled "Features"
Features
Review comment
Description: PR-level review comment. You only get one of these per review.
Syntax: Non-whitespace, non-quoted text at the beginning of the review file.
Inline comment
Description: Inline comment attached to a specific line of the diff.
Syntax: None-whitespace, non-quoted text on a newline immediately following a quoted non-header part of the diff.
Spanned inline comment
Description: Like an inline comment, except it covers a span of lines.
Syntax: To start a span, insert one or more newlines immediately before a quoted, non-header part of the diff. To terminate a span, insert a inline comment.
Review directives
Description: Meta-directives to give to prr
in review comment. Currently
only supports approving, requesting changes to, and commenting on a PR.
Syntax: @prr approve
, @prr reject
, or @prr comment
.
Vim integration
"Vim integration" is a bit overselling it, but I've created some ftdetect
and syntax
configs to enable syntax highlighting for prr
review files.
It can be pretty hard to look at a diff without having deletes and additions highlighted in different colors.
Config
prr
supports various configuration options. The config file must be located
at $XDG_CONFIG_HOME/prr/config.toml
. This typically expands to
$HOME/.config/prr/config.toml
.
[prr]
The [prr]
table controls installation wide settings. Currently this is the
only table.
prr.token
: Personal authentication token (required)prr.workdir
: Directory to place review files (optional)prr.url
: URL to github API (optional)