Reviewdog
🐶 Automated code review tool integrated with any code analysis tools regardless of programming language
Install / Use
/learn @reviewdog/ReviewdogREADME
reviewdog provides a way to post review comments to code hosting services, such as GitHub, automatically by integrating with any linter tools with ease. It uses an output of lint tools and posts them as a comment if findings are in the diff of patches to review.
reviewdog also supports running in the local environment to filter the output of lint tools by diff.
Table of Contents
- Installation
- Input Format
- Code Suggestions
- reviewdog config file
- Reporters
- Reporter: Local (-reporter=local) [default]
- Reporter: GitHub PR Checks (-reporter=github-pr-check)
- Reporter: GitHub Checks (-reporter=github-check)
- Reporter: GitHub PullRequest review comment (-reporter=github-pr-review)
- Reporter: GitHub Annotations (-reporter=github-annotations)
- Reporter: GitHub PR Annotations (-reporter=github-pr-annotations)
- Reporter: GitLab MergeRequest discussions (-reporter=gitlab-mr-discussion)
- Reporter: GitLab MergeRequest commit (-reporter=gitlab-mr-commit)
- Reporter: Bitbucket Code Insights Reports (-reporter=bitbucket-code-report)
- Supported CI services
- Exit codes
- Filter mode
- Articles
Installation
# Install the latest version. (Install it into ./bin/ by default).
$ curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/fd59714416d6d9a1c0692d872e38e7f8448df4fc/install.sh | sh -s
# Specify installation directory ($(go env GOPATH)/bin/) and version.
$ curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/fd59714416d6d9a1c0692d872e38e7f8448df4fc/install.sh | sh -s -- -b $(go env GOPATH)/bin [vX.Y.Z]
# In alpine linux (as it does not come with curl by default)
$ wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/fd59714416d6d9a1c0692d872e38e7f8448df4fc/install.sh | sh -s [vX.Y.Z]
Nightly releases
You can also use nightly reviewdog release to try the latest reviewdog improvements every day!
$ curl -sfL https://raw.githubusercontent.com/reviewdog/nightly/30fccfe9f47f7e6fd8b3c38aa0da11a6c9f04de7/install.sh | sh -s -- -b $(go env GOPATH)/bin
GitHub Action: reviewdog/action-setup
steps:
- uses: reviewdog/action-setup@d8edfce3dd5e1ec6978745e801f9c50b5ef80252 # v1.4.0
with:
reviewdog_version: latest # Optional. [latest,nightly,v.X.Y.Z]
homebrew / linuxbrew
You can also install reviewdog using brew:
$ brew install reviewdog/tap/reviewdog
$ brew upgrade reviewdog/tap/reviewdog
Scoop on Windows
> scoop install reviewdog
Build with go install
$ go install github.com/reviewdog/reviewdog/cmd/reviewdog@latest
Input Format
'errorformat'
reviewdog accepts any compiler or linter result from stdin and parses it with scan-f like 'errorformat', which is the port of Vim's errorformat feature.
For example, if the result format is {file}:{line number}:{column number}: {message},
errorformat should be %f:%l:%c: %m and you can pass it as -efm arguments.
$ golint ./...
comment_iowriter.go:11:6: exported type CommentWriter should have comment or be unexported
$ golint ./... | reviewdog -efm="%f:%l:%c: %m" -diff="git diff FETCH_HEAD"
| name | description | | ---- | ----------- | | %f | file name | | %l | line number | | %c | column number | | %m | error message | | %% | the single '%' character | | ... | ... |
Please see reviewdog/errorformat and :h errorformat if you want to deal with a more complex output. 'errorformat' can handle more complex output like a multi-line error message.
You can also try errorformat on the Playground!
With this 'errorformat' feature, reviewdog can support any tool output with ease.
Available pre-defined 'errorformat'
But, you don't have to write 'errorformat' in many cases. reviewdog supports pre-defined errorformat for major tools.
You can find available errorformat name by reviewdog -list and you can use it
with -f={name}.
$ reviewdog -list
golint linter for Go source code - https://github.com/golang/lint
govet Ve



