# reviewdog

> Parses linter output and posts findings in changed lines as review comments on GitHub, GitLab, and Bitbucket, or filters lint results by diff locally.

Stars: 9.7k · Language: Go · License: MIT · Categories: Dev Tools

- Repository: https://github.com/reviewdog/reviewdog
- Website: https://medium.com/@haya14busa/reviewdog-a-code-review-dog-who-keeps-your-codebase-healthy-d957c471938b#.8xctbaw5u
- Page: https://www.trmn.sh/tools/reviewdog

## Install

- Homebrew: `brew install --cask reviewdog/tap/reviewdog`
- Go: `go install github.com/reviewdog/reviewdog/cmd/reviewdog@latest`
- Scoop: `scoop install reviewdog`

## Overview

reviewdog is a code review automation tool that reads the output of linters and compilers, then posts findings as review comments on code hosting services. It only reports findings that fall within the diff of the patch under review, so existing issues elsewhere in the codebase are filtered out. It can also run locally to filter lint output by a diff, for example `git diff FETCH_HEAD`.

Input is read from stdin and parsed with 'errorformat', a port of Vim's errorformat. For example, `golint ./... | reviewdog -efm="%f:%l:%c: %m" -diff="git diff FETCH_HEAD"`. Pre-defined formats for common tools are listed with `reviewdog -list` and selected with `-f={name}`. It also accepts Reviewdog Diagnostic Format (rdjson and rdjsonl), checkstyle, and SARIF formats. RDFormat supports multiline ranged comments, severity, rule codes with URLs, and code suggestions. For example, `eslint -f rdjson . | reviewdog -f=rdjson -reporter=github-pr-review` using eslint-formatter-rdjson.

Output is selected with the `-reporter` flag. Options include local (default), github-pr-check, github-check, github-pr-review, github-annotations, github-pr-annotations, gitlab-mr-discussion, gitlab-mr-commit, and bitbucket-code-report. The README documents use in GitHub Actions, Travis CI, Circle CI, GitLab CI, Bitbucket Pipelines, and Jenkins. It also describes a config file, exit codes, and a filter mode. It is intended for developers and CI maintainers who want lint results shown on pull requests or merge requests, regardless of language or linter.

### Installation

```bash
# via Homebrew
brew install --cask reviewdog/tap/reviewdog
```

```bash
# via Go
go install github.com/reviewdog/reviewdog/cmd/reviewdog@latest
```

```bash
# via Scoop
scoop install reviewdog
```

![reviewdog local demo](https://media.trmn.sh/cached/80e294fc4b2743f892362209f4dabea3da0bec3e7d5ccadcbce46c341b151376.gif)

![Review comment in a pull request](https://media.trmn.sh/cached/c54b66116281cd038ab70d82a339ebeddb83499287e670f7e3db7faa1159798b.png)

![github-pr-check sample](https://media.trmn.sh/cached/d0f633953c0e7ddff8a6c5125b9dc67128ccf9ed9cc6476ca516aee71957f4d4.png)

## Alternatives

- [Terragrunt](https://www.trmn.sh/tools/terragrunt.md): Orchestration tool for OpenTofu/Terraform infrastructure code, used to scale and manage Infrastructure as Code across many modules and environments. (Go, 9.9k stars)
- [scc](https://www.trmn.sh/tools/scc.md): Code counter written in Go that reports lines of code, comments, complexity, ULOC and COCOMO estimates across many languages, with multiple output formats. (Go, 8.9k stars)
- [ipatool](https://www.trmn.sh/tools/ipatool.md): CLI for searching the App Store for iOS, iPadOS, tvOS, visionOS and macOS apps and downloading .ipa or macOS .pkg packages. (Go, 12.0k stars)
- [Krew](https://www.trmn.sh/tools/krew.md): Package manager for kubectl plugins: discover, install, and manage plugins from a central index, similar to apt, dnf, or brew. (Go, 7.0k stars)
- [Popeye](https://www.trmn.sh/tools/popeye.md): Read-only scanner that lints live Kubernetes clusters for misconfigurations, unused resources, and over/under allocation, with console, JSON, and HTML reports. (Go, 6.5k stars)

---

Canonical: https://www.trmn.sh/tools/reviewdog
