github.com/reviewdog/reviewdog@v0.17.5-0.20240516205324-0cd103a83d58/README.md (about) 1 <div align="center"> 2 <a href="https://github.com/reviewdog/reviewdog"> 3 <img alt="reviewdog" src="https://raw.githubusercontent.com/haya14busa/i/d598ed7dc49fefb0018e422e4c43e5ab8f207a6b/reviewdog/reviewdog.logo.png"> 4 </a> 5 </div> 6 7 <h2 align="center"> 8 reviewdog - A code review dog who keeps your codebase healthy. 9 </h2> 10 11 <div align="center"> 12 <a href="./LICENSE"> 13 <img alt="LICENSE" src="https://img.shields.io/badge/license-MIT-blue.svg?maxAge=43200"> 14 </a> 15 <a href="https://godoc.org/github.com/reviewdog/reviewdog"> 16 <img alt="GoDoc" src="https://img.shields.io/badge/godoc-reference-4F73B3.svg?label=godoc.org&maxAge=43200&logo=go"> 17 </a> 18 <a href="./CHANGELOG.md"> 19 <img alt="releases" src="https://img.shields.io/github/release/reviewdog/reviewdog.svg?logo=github"> 20 </a> 21 <a href="https://github.com/reviewdog/nightly"> 22 <img alt="nightly releases" src="https://img.shields.io/github/v/release/reviewdog/nightly.svg?logo=github"> 23 </a> 24 </div> 25 26 <div align="center"> 27 <a href="https://github.com/reviewdog/reviewdog/actions?query=workflow%3AGo+event%3Apush+branch%3Amaster"> 28 <img alt="GitHub Actions" src="https://github.com/reviewdog/reviewdog/workflows/Go/badge.svg"> 29 </a> 30 <a href="https://github.com/reviewdog/reviewdog/actions?query=workflow%3Areviewdog+event%3Apush+branch%3Amaster"> 31 <img alt="reviewdog" src="https://github.com/reviewdog/reviewdog/workflows/reviewdog/badge.svg?branch=master&event=push"> 32 </a> 33 <a href="https://github.com/reviewdog/reviewdog/actions?query=workflow%3Arelease"> 34 <img alt="release" src="https://github.com/reviewdog/reviewdog/workflows/release/badge.svg"> 35 </a> 36 <a href="https://travis-ci.org/reviewdog/reviewdog"><img alt="Travis Status" src="https://img.shields.io/travis/reviewdog/reviewdog/master.svg?label=Travis&logo=travis"></a> 37 <a href="https://circleci.com/gh/reviewdog/reviewdog"><img alt="CircleCI Status" src="http://img.shields.io/circleci/build/github/reviewdog/reviewdog/master.svg?label=CircleCI&logo=circleci"></a> 38 <a href="https://codecov.io/github/reviewdog/reviewdog"><img alt="Coverage Status" src="https://img.shields.io/codecov/c/github/reviewdog/reviewdog/master.svg?logo=codecov"></a> 39 </div> 40 41 <div align="center"> 42 <a href="https://gitlab.com/reviewdog/reviewdog/pipelines"> 43 <img alt="GitLab Supported" src="https://img.shields.io/badge/GitLab%20-Supported-fc6d26?logo=gitlab"> 44 </a> 45 <a href="https://github.com/haya14busa/action-bumpr"> 46 <img alt="action-bumpr supported" src="https://img.shields.io/badge/bumpr-supported-ff69b4?logo=github&link=https://github.com/haya14busa/action-bumpr"> 47 </a> 48 <a href="https://github.com/reviewdog/.github/blob/master/CODE_OF_CONDUCT.md"> 49 <img alt="Contributor Covenant" src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg"> 50 </a> 51 <a href="https://somsubhra.github.io/github-release-stats/?username=reviewdog&repository=reviewdog&per_page=30"> 52 <img alt="GitHub Releases Stats" src="https://img.shields.io/github/downloads/reviewdog/reviewdog/total.svg?logo=github"> 53 </a> 54 <a href="https://starchart.cc/reviewdog/reviewdog"><img alt="Stars" src="https://img.shields.io/github/stars/reviewdog/reviewdog.svg?style=social"></a> 55 </div> 56 <br /> 57 58 reviewdog provides a way to post review comments to code hosting services, 59 such as GitHub, automatically by integrating with any linter tools with ease. 60 It uses an output of lint tools and posts them as a comment if findings are in 61 the diff of patches to review. 62 63 reviewdog also supports running in the local environment to filter the output of lint tools 64 by diff. 65 66 [design doc](https://docs.google.com/document/d/1mGOX19SSqRowWGbXieBfGPtLnM0BdTkIc9JelTiu6wA/edit?usp=sharing) 67 68 ## Table of Contents 69 70 - [Installation](#installation) 71 - [Input Format](#input-format) 72 * ['errorformat'](#errorformat) 73 * [Available pre-defined 'errorformat'](#available-pre-defined-errorformat) 74 * [Reviewdog Diagnostic Format (RDFormat)](#reviewdog-diagnostic-format-rdformat) 75 * [Diff](#diff) 76 * [checkstyle format](#checkstyle-format) 77 * [SARIF format](#sarif-format) 78 - [Code Suggestions](#code-suggestions) 79 - [reviewdog config file](#reviewdog-config-file) 80 - [Reporters](#reporters) 81 * [Reporter: Local (-reporter=local) [default]](#reporter-local--reporterlocal-default) 82 * [Reporter: GitHub Checks (-reporter=github-pr-check)](#reporter-github-checks--reportergithub-pr-check) 83 * [Reporter: GitHub Checks (-reporter=github-check)](#reporter-github-checks--reportergithub-check) 84 * [Reporter: GitHub PullRequest review comment (-reporter=github-pr-review)](#reporter-github-pullrequest-review-comment--reportergithub-pr-review) 85 * [Reporter: GitLab MergeRequest discussions (-reporter=gitlab-mr-discussion)](#reporter-gitlab-mergerequest-discussions--reportergitlab-mr-discussion) 86 * [Reporter: GitLab MergeRequest commit (-reporter=gitlab-mr-commit)](#reporter-gitlab-mergerequest-commit--reportergitlab-mr-commit) 87 * [Reporter: Bitbucket Code Insights Reports (-reporter=bitbucket-code-report)](#reporter-bitbucket-code-insights-reports--reporterbitbucket-code-report) 88 - [Supported CI services](#supported-ci-services) 89 * [GitHub Actions](#github-actions) 90 * [Travis CI](#travis-ci) 91 * [Circle CI](#circle-ci) 92 * [GitLab CI](#gitlab-ci) 93 * [Bitbucket Pipelines](#bitbucket-pipelines) 94 * [Common (Jenkins, local, etc...)](#common-jenkins-local-etc) 95 + [Jenkins with GitHub pull request builder plugin](#jenkins-with-github-pull-request-builder-plugin) 96 - [Exit codes](#exit-codes) 97 - [Filter mode](#filter-mode) 98 - [Articles](#articles) 99 100 [![github-pr-check sample](https://user-images.githubusercontent.com/3797062/40884858-6efd82a0-6756-11e8-9f1a-c6af4f920fb0.png)](https://github.com/reviewdog/reviewdog/pull/131/checks) 101 ![comment in pull-request](https://user-images.githubusercontent.com/3797062/40941822-1d775064-6887-11e8-98e9-4775d37d47f8.png) 102 ![commit status](https://user-images.githubusercontent.com/3797062/40941738-d62acb0a-6886-11e8-858d-7b97aded2a42.png) 103 [![sample-comment.png](https://raw.githubusercontent.com/haya14busa/i/dc0ccb1e110515ea407c146d99b749018db05c45/reviewdog/sample-comment.png)](https://github.com/reviewdog/reviewdog/pull/24#discussion_r84599728) 104 ![reviewdog-local-demo.gif](https://raw.githubusercontent.com/haya14busa/i/dc0ccb1e110515ea407c146d99b749018db05c45/reviewdog/reviewdog-local-demo.gif) 105 106 ## Installation 107 108 ```shell 109 # Install the latest version. (Install it into ./bin/ by default). 110 $ curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s 111 112 # Specify installation directory ($(go env GOPATH)/bin/) and version. 113 $ curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s -- -b $(go env GOPATH)/bin [vX.Y.Z] 114 115 # In alpine linux (as it does not come with curl by default) 116 $ wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | sh -s [vX.Y.Z] 117 ``` 118 119 ### Nightly releases 120 121 You can also use [nightly reviewdog release](https://github.com/reviewdog/nightly) 122 to try the latest reviewdog improvements every day! 123 124 ```shell 125 $ curl -sfL https://raw.githubusercontent.com/reviewdog/nightly/master/install.sh | sh -s -- -b $(go env GOPATH)/bin 126 ``` 127 128 ### GitHub Action: [reviewdog/action-setup](https://github.com/reviewdog/action-setup) 129 130 ```yaml 131 steps: 132 - uses: reviewdog/action-setup@v1 133 with: 134 reviewdog_version: latest # Optional. [latest,nightly,v.X.Y.Z] 135 ``` 136 137 ### homebrew / linuxbrew 138 You can also install reviewdog using brew: 139 140 ```shell 141 $ brew install reviewdog/tap/reviewdog 142 $ brew upgrade reviewdog/tap/reviewdog 143 ``` 144 145 ### [Scoop](https://scoop.sh/) on Windows 146 147 ``` 148 > scoop install reviewdog 149 ``` 150 151 ### Build with go install 152 153 ```shell 154 $ go install github.com/reviewdog/reviewdog/cmd/reviewdog@latest 155 ``` 156 157 ## Input Format 158 159 ### 'errorformat' 160 161 reviewdog accepts any compiler or linter result from stdin and parses it with 162 scan-f like [**'errorformat'**](https://github.com/reviewdog/errorformat), 163 which is the port of Vim's [errorformat](https://vim-jp.org/vimdoc-en/quickfix.html#error-file-format) 164 feature. 165 166 For example, if the result format is `{file}:{line number}:{column number}: {message}`, 167 errorformat should be `%f:%l:%c: %m` and you can pass it as `-efm` arguments. 168 169 ```shell 170 $ golint ./... 171 comment_iowriter.go:11:6: exported type CommentWriter should have comment or be unexported 172 $ golint ./... | reviewdog -efm="%f:%l:%c: %m" -diff="git diff FETCH_HEAD" 173 ``` 174 175 | name | description | 176 | ---- | ----------- | 177 | %f | file name | 178 | %l | line number | 179 | %c | column number | 180 | %m | error message | 181 | %% | the single '%' character | 182 | ... | ... | 183 184 Please see [reviewdog/errorformat](https://github.com/reviewdog/errorformat) 185 and [:h errorformat](https://vim-jp.org/vimdoc-en/quickfix.html#error-file-format) 186 if you want to deal with a more complex output. 'errorformat' can handle more 187 complex output like a multi-line error message. 188 189 You can also try errorformat on [the Playground](https://reviewdog.github.io/errorformat-playground/)! 190 191 With this 'errorformat' feature, reviewdog can support any tool output with ease. 192 193 ### Available pre-defined 'errorformat' 194 195 But, you don't have to write 'errorformat' in many cases. reviewdog supports 196 pre-defined errorformat for major tools. 197 198 You can find available errorformat name by `reviewdog -list` and you can use it 199 with `-f={name}`. 200 201 ```shell 202 $ reviewdog -list 203 golint linter for Go source code - https://github.com/golang/lint 204 govet Vet examines Go source code and reports suspicious problems - https://golang.org/cmd/vet/ 205 sbt the interactive build tool - http://www.scala-sbt.org/ 206 ... 207 ``` 208 209 ```shell 210 $ golint ./... | reviewdog -f=golint -diff="git diff FETCH_HEAD" 211 ``` 212 213 You can add supported pre-defined 'errorformat' by contributing to [reviewdog/errorformat](https://github.com/reviewdog/errorformat) 214 215 ### Reviewdog Diagnostic Format (RDFormat) 216 217 reviewdog supports [Reviewdog Diagnostic Format (RDFormat)](./proto/rdf/) as a 218 generic diagnostic format and it supports both [rdjson](./proto/rdf/#rdjson) and 219 [rdjsonl](./proto/rdf/#rdjsonl) formats. 220 221 This rdformat supports rich features like multiline ranged comments, severity, 222 rule code with URL, and [code suggestions](#code-suggestions). 223 224 ```shell 225 $ <linter> | <convert-to-rdjson> | reviewdog -f=rdjson -reporter=github-pr-review 226 # or 227 $ <linter> | <convert-to-rdjsonl> | reviewdog -f=rdjsonl -reporter=github-pr-review 228 ``` 229 230 #### Example: ESLint with RDFormat 231 232 ![eslint reviewdog rdjson demo](https://user-images.githubusercontent.com/3797062/97085944-87233a80-165b-11eb-94a8-0a47d5e24905.png) 233 234 You can use [eslint-formatter-rdjson](https://www.npmjs.com/package/eslint-formatter-rdjson) 235 to output `rdjson` as eslint output format. 236 237 ```shell 238 $ npm install --save-dev eslint-formatter-rdjson 239 $ eslint -f rdjson . | reviewdog -f=rdjson -reporter=github-pr-review 240 ``` 241 242 Or you can also use [reviewdog/action-eslint](https://github.com/reviewdog/action-eslint) for GitHub Actions. 243 244 ### Diff 245 246 ![reviewdog with gofmt example](https://user-images.githubusercontent.com/3797062/89168305-a3ad5a80-d5b7-11ea-8939-be7ac1976d30.png) 247 248 reviewdog supports diff (unified format) as an input format especially useful 249 for [code suggestions](#code-suggestions). 250 reviewdog can integrate with any code suggestions tools or formatters to report suggestions. 251 252 `-f.diff.strip`: option for `-f=diff`: strip NUM leading components from diff file names (equivalent to 'patch -p') (default is 1 for git diff) (default 1) 253 254 ```shell 255 $ <any-code-fixer/formatter> # e.g. eslint --fix, gofmt 256 $ TMPFILE=$(mktemp) 257 $ git diff >"${TMPFILE}" 258 $ git stash -u && git stash drop 259 $ reviewdog -f=diff -f.diff.strip=1 -reporter=github-pr-review < "${TMPFILE}" 260 ``` 261 262 Or you can also use [reviewdog/action-suggester](https://github.com/reviewdog/action-suggester) for GitHub Actions. 263 264 If diagnostic tools support diff output format, you can pipe the diff directly. 265 266 ```shell 267 $ gofmt -s -d . | reviewdog -name="gofmt" -f=diff -f.diff.strip=0 -reporter=github-pr-review 268 $ shellcheck -f diff $(shfmt -f .) | reviewdog -f=diff 269 ``` 270 271 ### checkstyle format 272 273 reviewdog also accepts [checkstyle XML format](http://checkstyle.sourceforge.net/) as well. 274 If the linter supports checkstyle format as a report format, you can use 275 -f=checkstyle instead of using 'errorformat'. 276 277 ```shell 278 # Local 279 $ eslint -f checkstyle . | reviewdog -f=checkstyle -diff="git diff" 280 281 # CI (overwrite tool name which is shown in review comment by -name arg) 282 $ eslint -f checkstyle . | reviewdog -f=checkstyle -name="eslint" -reporter=github-check 283 ``` 284 285 Also, if you want to pass other Json/XML/etc... format to reviewdog, you can write a converter. 286 287 ```shell 288 $ <linter> | <convert-to-checkstyle> | reviewdog -f=checkstyle -name="<linter>" -reporter=github-pr-check 289 ``` 290 291 ### SARIF format 292 293 reviewdog supports [SARIF 2.1.0 JSON format](https://sarifweb.azurewebsites.net/). 294 You can use reviewdog with -f=sarif option. 295 296 ```shell 297 # Local 298 $ eslint -f @microsoft/eslint-formatter-sarif . | reviewdog -f=sarif -diff="git diff" 299 ```` 300 301 ## Code Suggestions 302 303 ![eslint reviewdog suggestion demo](https://user-images.githubusercontent.com/3797062/97085944-87233a80-165b-11eb-94a8-0a47d5e24905.png) 304 ![reviewdog with gofmt example](https://user-images.githubusercontent.com/3797062/89168305-a3ad5a80-d5b7-11ea-8939-be7ac1976d30.png) 305 306 reviewdog supports *code suggestions* feature with [rdformat](#reviewdog-diagnostic-format-rdformat) or [diff](#diff) input. 307 You can also use [reviewdog/action-suggester](https://github.com/reviewdog/action-suggester) for GitHub Actions. 308 309 reviewdog can suggest code changes along with diagnostic results if a diagnostic tool supports code suggestions data. 310 You can integrate reviewdog with any code fixing tools and any code formatter with [diff](#diff) input as well. 311 312 ### Code Suggestions Support Table 313 Note that not all reporters provide support for code suggestions. 314 315 | `-reporter` | Suggestion support | 316 | ---------------------------- | ------- | 317 | **`local`** | NO [1] | 318 | **`github-check`** | NO [2] | 319 | **`github-pr-check`** | NO [2] | 320 | **`github-pr-review`** | OK | 321 | **`gitlab-mr-discussion`** | OK | 322 | **`gitlab-mr-commit`** | NO [2] | 323 | **`gerrit-change-review`** | NO [1] | 324 | **`bitbucket-code-report`** | NO [2] | 325 | **`gitea-pr-review`** | NO [2] | 326 327 - [1] The reporter service supports the code suggestion feature, but reviewdog does not support it yet. See [#678](https://github.com/reviewdog/reviewdog/issues/678) for the status. 328 - [2] The reporter service itself doesn't support the code suggestion feature. 329 330 ## reviewdog config file 331 332 reviewdog can also be controlled via the .reviewdog.yml configuration file instead of "-f" or "-efm" arguments. 333 334 With .reviewdog.yml, you can run the same commands for both CI service and local 335 environment including editor integration with ease. 336 337 #### .reviewdog.yml 338 339 ```yaml 340 runner: 341 <tool-name>: 342 cmd: <command> # (required) 343 errorformat: # (optional if you use `format`) 344 - <list of errorformat> 345 format: <format-name> # (optional if you use `errorformat`. e.g. golint,rdjson,rdjsonl) 346 name: <tool-name> # (optional. you can overwrite <tool-name> defined by runner key) 347 level: <level> # (optional. same as -level flag. [info,warning,error]) 348 349 # examples 350 golint: 351 cmd: golint ./... 352 errorformat: 353 - "%f:%l:%c: %m" 354 level: warning 355 govet: 356 cmd: go vet -all . 357 format: govet 358 your-awesome-linter: 359 cmd: awesome-linter run 360 format: rdjson 361 name: AwesomeLinter 362 ``` 363 364 ```shell 365 $ reviewdog -diff="git diff FETCH_HEAD" 366 project/run_test.go:61:28: [golint] error strings should not end with punctuation 367 project/run.go:57:18: [errcheck] defer os.Setenv(name, os.Getenv(name)) 368 project/run.go:58:12: [errcheck] os.Setenv(name, "") 369 # You can use -runners to run only specified runners. 370 $ reviewdog -diff="git diff FETCH_HEAD" -runners=golint,govet 371 project/run_test.go:61:28: [golint] error strings should not end with punctuation 372 # You can use -conf to specify config file path. 373 $ reviewdog -conf=./.reviewdog.yml -reporter=github-pr-check 374 ``` 375 376 Output format for project config based run is one of the following formats. 377 378 - `<file>: [<tool name>] <message>` 379 - `<file>:<lnum>: [<tool name>] <message>` 380 - `<file>:<lnum>:<col>: [<tool name>] <message>` 381 382 ## Reporters 383 384 reviewdog can report results both in the local environment and review services as 385 continuous integration. 386 387 ### Reporter: Local (-reporter=local) [default] 388 389 reviewdog can find newly introduced findings by filtering linter results 390 using diff. You can pass the diff command as `-diff` arg. 391 392 ```shell 393 $ golint ./... | reviewdog -f=golint -diff="git diff FETCH_HEAD" 394 ``` 395 396 ### Reporter: GitHub Checks (-reporter=github-pr-check) 397 398 [![github-pr-check sample annotation with option 1](https://user-images.githubusercontent.com/3797062/64875597-65016f80-d688-11e9-843f-4679fb666f0d.png)](https://github.com/reviewdog/reviewdog/pull/275/files#annotation_6177941961779419) 399 [![github-pr-check sample](https://user-images.githubusercontent.com/3797062/40884858-6efd82a0-6756-11e8-9f1a-c6af4f920fb0.png)](https://github.com/reviewdog/reviewdog/pull/131/checks) 400 401 github-pr-check reporter reports results to [GitHub Checks](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/about-status-checks). 402 403 You can change the report level for this reporter by `level` field in [config 404 file](#reviewdog-config-file) or `-level` flag. You can control GitHub status 405 check results with this feature. (default: error) 406 407 | Level | GitHub Status | 408 | --------- | ------------- | 409 | `info` | neutral | 410 | `warning` | neutral | 411 | `error` | failure | 412 413 There are two options to use this reporter. 414 415 #### Option 1) Run reviewdog from GitHub Actions w/ secrets.GITHUB_TOKEN 416 417 Example: [.github/workflows/reviewdog.yml](.github/workflows/reviewdog.yml) 418 419 ```yaml 420 - name: Run reviewdog 421 env: 422 REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} 423 run: | 424 golint ./... | reviewdog -f=golint -reporter=github-pr-check 425 ``` 426 427 See [GitHub Actions](#github-actions) section too. You can also use public 428 reviewdog GitHub Actions. 429 430 #### Option 2) Install reviewdog GitHub Apps 431 reviewdog CLI sends a request to reviewdog GitHub App server and the server post 432 results as GitHub Checks, because Check API is only supported for GitHub App and 433 GitHub Actions. 434 435 1. Install reviewdog Apps. https://github.com/apps/reviewdog 436 2. Set `REVIEWDOG_TOKEN` or run reviewdog CLI in trusted CI providers. 437 - Get token from `https://reviewdog.app/gh/{owner}/{repo-name}`. 438 439 ```shell 440 $ export REVIEWDOG_TOKEN="<token>" 441 $ reviewdog -reporter=github-pr-check 442 ``` 443 444 Note: Token is not required if you run reviewdog in Travis or AppVeyor. 445 446 *Caution* 447 448 As described above, github-pr-check reporter with Option 2 depends on 449 reviewdog GitHub App server. 450 The server is running with haya14busa's pocket money for now and I may break 451 things, so I cannot ensure that the server is running 24h and 365 days. 452 453 **UPDATE:** Started getting support by [opencollective](https://opencollective.com/reviewdog) 454 and GitHub sponsor. 455 See [Supporting reviewdog](#supporting-reviewdog) 456 457 You can use github-pr-review reporter or use run reviewdog under GitHub Actions 458 if you don't want to depend on reviewdog server. 459 460 ### Reporter: GitHub Checks (-reporter=github-check) 461 462 It's basically the same as `-reporter=github-pr-check` except it works not only for 463 Pull Request but also for commit. 464 465 [![sample comment outside diff](https://user-images.githubusercontent.com/3797062/69917921-e0680580-14ae-11ea-9a56-de9e3cbac005.png)](https://github.com/reviewdog/reviewdog/pull/364/files) 466 467 You can create [reviewdog badge](#reviewdog-badge-) for this reporter. 468 469 ### Reporter: GitHub PullRequest review comment (-reporter=github-pr-review) 470 471 [![sample-comment.png](https://raw.githubusercontent.com/haya14busa/i/dc0ccb1e110515ea407c146d99b749018db05c45/reviewdog/sample-comment.png)](https://github.com/reviewdog/reviewdog/pull/24#discussion_r84599728) 472 473 github-pr-review reporter reports results to GitHub PullRequest review comments 474 using GitHub Personal API Access Token. 475 [GitHub Enterprise](https://github.com/enterprise) is supported too. 476 477 - Go to https://github.com/settings/tokens and generate a new API token. 478 - Check `repo` for private repositories or `public_repo` for public repositories. 479 480 ```shell 481 $ export REVIEWDOG_GITHUB_API_TOKEN="<token>" 482 $ reviewdog -reporter=github-pr-review 483 ``` 484 485 For GitHub Enterprise, set the API endpoint by an environment variable. 486 487 ```shell 488 $ export GITHUB_API="https://example.githubenterprise.com/api/v3/" 489 $ export REVIEWDOG_INSECURE_SKIP_VERIFY=true # set this as you need to skip verifying SSL 490 ``` 491 492 See [GitHub Actions](#github-actions) section too if you can use GitHub 493 Actions. You can also use public reviewdog GitHub Actions. 494 495 ### Reporter: GitHub PR Annotations (-reporter=github-pr-annotations) 496 497 github-pr-annotations uses the GitHub Actions annotation format to output errors 498 and warnings to `stdout` e.g. 499 500 ``` 501 ::error line=11,col=41,file=app/index.md::[vale] reported by reviewdog 🐶%0A[demo.Spelling] Did you really mean 'boobarbaz'?%0A%0ARaw Output:%0A{"message": "[demo.Spelling] Did you really mean 'boobarbaz'?", "location": {"path": "app/index.md", "range": {"start": {"line": 11, "column": 41}}}, "severity": "ERROR"} 502 ``` 503 504 This reporter requires a valid GitHub API token to generate a diff, but will not 505 use the token to report errors. 506 507 ### Reporter: GitLab MergeRequest discussions (-reporter=gitlab-mr-discussion) 508 509 [![gitlab-mr-discussion sample](https://user-images.githubusercontent.com/3797062/41810718-f91bc540-773d-11e8-8598-fbc09ce9b1c7.png)](https://gitlab.com/reviewdog/reviewdog/-/merge_requests/113#note_83411103) 510 511 Required GitLab version: >= v10.8.0 512 513 gitlab-mr-discussion reporter reports results to GitLab MergeRequest discussions using 514 GitLab Personal API Access token. 515 Get the token with `api` scope from https://gitlab.com/profile/personal_access_tokens. 516 517 ```shell 518 $ export REVIEWDOG_GITLAB_API_TOKEN="<token>" 519 $ reviewdog -reporter=gitlab-mr-discussion 520 ``` 521 522 The `CI_API_V4_URL` environment variable, defined automatically by Gitlab CI (v11.7 onwards), will be used to find out the Gitlab API URL. 523 524 Alternatively, `GITLAB_API` can also be defined, in which case it will take precedence over `CI_API_V4_URL`. 525 526 ```shell 527 $ export GITLAB_API="https://example.gitlab.com/api/v4" 528 $ export REVIEWDOG_INSECURE_SKIP_VERIFY=true # set this as you need to skip verifying SSL 529 ``` 530 531 ### Reporter: GitLab MergeRequest commit (-reporter=gitlab-mr-commit) 532 533 gitlab-mr-commit is similar to [gitlab-mr-discussion](#reporter-gitlab-mergerequest-discussions--reportergitlab-mr-discussion) reporter but reports results to each commit in GitLab MergeRequest. 534 535 gitlab-mr-discussion is recommended, but you can use gitlab-mr-commit reporter 536 if your GitLab version is under v10.8.0. 537 538 ```shell 539 $ export REVIEWDOG_GITLAB_API_TOKEN="<token>" 540 $ reviewdog -reporter=gitlab-mr-commit 541 ``` 542 543 ### Reporter: Gerrit Change review (-reporter=gerrit-change-review) 544 545 gerrit-change-review reporter reports results to Gerrit Change using Gerrit Rest APIs. 546 547 The reporter supports Basic Authentication and Git-cookie based authentication for reporting results. 548 549 Set `GERRIT_USERNAME` and `GERRIT_PASSWORD` environment variables for basic authentication, and put `GIT_GITCOOKIE_PATH` for git cookie-based authentication. 550 551 ```shell 552 $ export GERRIT_CHANGE_ID=changeID 553 $ export GERRIT_REVISION_ID=revisionID 554 $ export GERRIT_BRANCH=master 555 $ export GERRIT_ADDRESS=http://<gerrit-host>:<gerrit-port> 556 $ reviewdog -reporter=gerrit-change-review 557 ``` 558 559 ### Reporter: Bitbucket Code Insights Reports (-reporter=bitbucket-code-report) 560 561 [![bitbucket-code-report](https://user-images.githubusercontent.com/9948629/96770123-c138d600-13e8-11eb-8e46-250b4bb393bd.png)](https://bitbucket.org/Trane9991/reviewdog-example/pull-requests/1) 562 [![bitbucket-code-annotations](https://user-images.githubusercontent.com/9948629/97054896-5e813f00-158e-11eb-9ad7-f8d75489b8ba.png)](https://bitbucket.org/Trane9991/reviewdog-example/pull-requests/1) 563 564 bitbucket-code-report generates the annotated 565 [Bitbucket Code Insights](https://support.atlassian.com/bitbucket-cloud/docs/code-insights/) report. 566 567 For now, only the `no-filter` mode is supported, so the whole project is scanned on every run. 568 Reports are stored per commit and can be viewed per commit from Bitbucket Pipelines UI or 569 in Pull Request. In the Pull Request UI affected code lines will be annotated in the diff, 570 as well as you will be able to filter the annotations by **This pull request** or **All**. 571 572 If running from [Bitbucket Pipelines](#bitbucket-pipelines), no additional configuration is needed (even credentials). 573 If running locally or from some other CI system you would need to provide Bitbucket API credentials: 574 575 - For Basic Auth you need to set the following env variables: 576 `BITBUCKET_USER` and `BITBUCKET_PASSWORD` 577 - For AccessToken Auth you need to set `BITBUCKET_ACCESS_TOKEN` 578 579 ```shell 580 $ export BITBUCKET_USER="my_user" 581 $ export BITBUCKET_PASSWORD="my_password" 582 $ reviewdog -reporter=bitbucket-code-report 583 ``` 584 585 To post a report to the Bitbucket Server use `BITBUCKET_SERVER_URL` variable: 586 ```shell 587 $ export BITBUCKET_USER="my_user" 588 $ export BITBUCKET_PASSWORD="my_password" 589 $ export BITBUCKET_SERVER_URL="https://bitbucket.my-company.com" 590 $ reviewdog -reporter=bitbucket-code-report 591 ``` 592 593 ## Supported CI services 594 595 ### [GitHub Actions](https://github.com/features/actions) 596 597 Example: [.github/workflows/reviewdog.yml](.github/workflows/reviewdog.yml) 598 599 ```yaml 600 name: reviewdog 601 on: [pull_request] 602 jobs: 603 reviewdog: 604 name: reviewdog 605 runs-on: ubuntu-latest 606 steps: 607 # ... 608 - uses: reviewdog/action-setup@v1 609 with: 610 reviewdog_version: latest # Optional. [latest,nightly,v.X.Y.Z] 611 - name: Run reviewdog 612 env: 613 REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} 614 run: | 615 reviewdog -reporter=github-pr-check -runners=golint,govet 616 # or 617 reviewdog -reporter=github-pr-review -runners=golint,govet 618 ``` 619 620 <details> 621 <summary><strong>Example (github-check reporter):</strong></summary> 622 623 [.github/workflows/reviewdog](.github/workflows/reviewdog.yml) 624 625 Only `github-check` reporter can run on the push event too. 626 627 ```yaml 628 name: reviewdog (github-check) 629 on: 630 push: 631 branches: 632 - master 633 pull_request: 634 635 jobs: 636 reviewdog: 637 name: reviewdog 638 runs-on: ubuntu-latest 639 steps: 640 # ... 641 - name: Run reviewdog 642 env: 643 REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} 644 run: | 645 reviewdog -reporter=github-check -runners=golint,govet 646 ``` 647 648 </details> 649 650 #### Public Reviewdog GitHub Actions 651 You can use public GitHub Actions to start using reviewdog with ease! :tada: :arrow_forward: :tada: 652 653 - Common 654 - [reviewdog/action-misspell](https://github.com/reviewdog/action-misspell) - Run [misspell](https://github.com/client9/misspell). 655 - [EPMatt/reviewdog-action-prettier](https://github.com/EPMatt/reviewdog-action-prettier) - Run [Prettier](https://prettier.io/). 656 - Text 657 - [reviewdog/action-alex](https://github.com/reviewdog/action-alex) - Run [alex](https://github.com/get-alex/alex) which catches insensitive, inconsiderate writing. (e.g. master/slave) 658 - [reviewdog/action-languagetool](https://github.com/reviewdog/action-languagetool) - Run [languagetool](https://github.com/languagetool-org/languagetool). 659 - [tsuyoshicho/action-textlint](https://github.com/tsuyoshicho/action-textlint) - Run [textlint](https://github.com/textlint/textlint) 660 - [tsuyoshicho/action-redpen](https://github.com/tsuyoshicho/action-redpen) - Run [redpen](https://github.com/redpen-cc/redpen) 661 - Markdown 662 - [reviewdog/action-markdownlint](https://github.com/reviewdog/action-markdownlint) - Run [markdownlint](https://github.com/DavidAnson/markdownlint) 663 - Docker 664 - [reviewdog/action-hadolint](https://github.com/reviewdog/action-hadolint) - Run [hadolint](https://github.com/hadolint/hadolint) to lint `Dockerfile`. 665 - Env 666 - [dotenv-linter/action-dotenv-linter](https://github.com/dotenv-linter/action-dotenv-linter) - Run [dotenv-linter](https://github.com/dotenv-linter/dotenv-linter) to lint `.env` files. 667 - Shell script 668 - [reviewdog/action-shellcheck](https://github.com/reviewdog/action-shellcheck) - Run [shellcheck](https://github.com/koalaman/shellcheck). 669 - [reviewdog/action-shfmt](https://github.com/reviewdog/action-shfmt) - Run [shfmt](https://github.com/mvdan/sh). 670 - Go 671 - [reviewdog/action-staticcheck](https://github.com/reviewdog/action-staticcheck) - Run [staticcheck](https://staticcheck.io/). 672 - [reviewdog/action-golangci-lint](https://github.com/reviewdog/action-golangci-lint) - Run [golangci-lint](https://github.com/golangci/golangci-lint) and supported linters individually by golangci-lint. 673 - JavaScript 674 - [reviewdog/action-eslint](https://github.com/reviewdog/action-eslint) - Run [eslint](https://github.com/eslint/eslint). 675 - [mongolyy/reviewdog-action-biome](https://github.com/mongolyy/reviewdog-action-biome) - Run [Biome](https://biomejs.dev/). 676 - TypeScript 677 - [EPMatt/reviewdog-action-tsc](https://github.com/EPMatt/reviewdog-action-tsc) - Run [tsc](https://www.typescriptlang.org/docs/handbook/compiler-options.html). 678 - CSS 679 - [reviewdog/action-stylelint](https://github.com/reviewdog/action-stylelint) - Run [stylelint](https://github.com/stylelint/stylelint). 680 - Vim script 681 - [reviewdog/action-vint](https://github.com/reviewdog/action-vint) - Run [vint](https://github.com/Vimjas/vint). 682 - [tsuyoshicho/action-vimlint](https://github.com/tsuyoshicho/action-vimlint) - Run [vim-vimlint](https://github.com/syngan/vim-vimlint) 683 - Terraform 684 - [reviewdog/action-tflint](https://github.com/reviewdog/action-tflint) - Run [tflint](https://github.com/terraform-linters/tflint). 685 - [reviewdog/action-terraform-validate](https://github.com/reviewdog/action-terraform-validate) - Run [terraform validate](https://developer.hashicorp.com/terraform/cli/commands/validate). 686 - YAML 687 - [reviewdog/action-yamllint](https://github.com/reviewdog/action-yamllint) - Run [yamllint](https://github.com/adrienverge/yamllint). 688 - Ruby 689 - [reviewdog/action-brakeman](https://github.com/reviewdog/action-brakeman) - Run [brakeman](https://github.com/presidentbeef/brakeman). 690 - [reviewdog/action-reek](https://github.com/reviewdog/action-reek) - Run [reek](https://github.com/troessner/reek). 691 - [reviewdog/action-rubocop](https://github.com/reviewdog/action-rubocop) - Run [rubocop](https://github.com/rubocop/rubocop). 692 - [vk26/action-fasterer](https://github.com/vk26/action-fasterer) - Run [fasterer](https://github.com/DamirSvrtan/fasterer). 693 - [PrintReleaf/action-standardrb](https://github.com/PrintReleaf/action-standardrb) - Run [standardrb](https://github.com/standardrb/standard). 694 - [tk0miya/action-erblint](https://github.com/tk0miya/action-erblint) - Run [erb-lint](https://github.com/Shopify/erb-lint) 695 - [tk0miya/action-steep](https://github.com/tk0miya/action-steep) - Run [steep](https://github.com/soutaro/steep) 696 - [blooper05/action-rails_best_practices](https://github.com/blooper05/action-rails_best_practices) - Run [rails_best_practices](https://github.com/flyerhzm/rails_best_practices) 697 - [tomferreira/action-bundler-audit](https://github.com/tomferreira/action-bundler-audit) - Run [bundler-audit](https://github.com/rubysec/bundler-audit) 698 - Python 699 - [wemake-python-styleguide](https://github.com/wemake-services/wemake-python-styleguide) - Run wemake-python-styleguide 700 - [tsuyoshicho/action-mypy](https://github.com/tsuyoshicho/action-mypy) - Run [mypy](https://pypi.org/project/mypy/) 701 - [jordemort/action-pyright](https://github.com/jordemort/action-pyright) - Run [pyright](https://github.com/Microsoft/pyright) 702 - [dciborow/action-pylint](https://github.com/dciborow/action-pylint) - Run [pylint](https://github.com/pylint-dev/pylint) 703 - [reviewdog/action-black](https://github.com/reviewdog/action-black) - Run [black](https://github.com/psf/black) 704 - Kotlin 705 - [ScaCap/action-ktlint](https://github.com/ScaCap/action-ktlint) - Run [ktlint](https://ktlint.github.io/). 706 - Android Lint 707 - [dvdandroid/action-android-lint](https://github.com/DVDAndroid/action-android-lint) - Run [Android Lint](https://developer.android.com/studio/write/lint) 708 - Ansible 709 - [reviewdog/action-ansiblelint](https://github.com/reviewdog/action-ansiblelint) - Run [ansible-lint](https://github.com/ansible/ansible-lint) 710 - GitHub Actions 711 - [reviewdog/action-actionlint](https://github.com/reviewdog/action-actionlint) - Run [actionlint](https://github.com/rhysd/actionlint) 712 - Protocol Buffers 713 - [yoheimuta/action-protolint](https://github.com/yoheimuta/action-protolint) - Run [protolint](https://github.com/yoheimuta/protolint) 714 715 ... and more on [GitHub Marketplace](https://github.com/marketplace?utf8=✓&type=actions&query=reviewdog). 716 717 Missing actions? Check out [reviewdog/action-template](https://github.com/reviewdog/action-template) and create a new reviewdog action! 718 719 Please open a Pull Request to add your created reviewdog actions here :sparkles:. 720 I can also put your repositories under reviewdog org and co-maintain the actions. 721 Example: [action-tflint](https://github.com/reviewdog/reviewdog/issues/322). 722 723 #### Graceful Degradation for Pull Requests from forked repositories 724 725 ![Graceful Degradation example](https://user-images.githubusercontent.com/3797062/71781334-e2266b00-3010-11ea-8a38-dee6e30c8162.png) 726 727 `GITHUB_TOKEN` for Pull Requests from a forked repository doesn't have write 728 access to Check API nor Review API due to [GitHub Actions 729 restriction](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token). 730 731 Instead, reviewdog uses [Logging commands of GitHub 732 Actions](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#set-an-error-message-error) 733 to post results as 734 [annotations](https://docs.github.com/en/rest/checks/runs#annotations-object) 735 similar to `github-pr-check` reporter. 736 737 Note that there is a limitation for annotations created by logging commands, 738 such as [max # of annotations per run](https://github.com/reviewdog/reviewdog/issues/411#issuecomment-570893427). 739 You can check GitHub Actions log to see full results in such cases. 740 741 #### reviewdog badge [![reviewdog](https://github.com/reviewdog/reviewdog/workflows/reviewdog/badge.svg?branch=master&event=push)](https://github.com/reviewdog/reviewdog/actions?query=workflow%3Areviewdog+event%3Apush+branch%3Amaster) 742 743 As [`github-check` reporter](#reporter-github-checks--reportergithub-pr-check) support running on commit, we can create reviewdog 744 [GitHub Action badge](https://docs.github.com/en/actions/using-workflows#adding-a-workflow-status-badge-to-your-repository) 745 to check the result against master commit for example. :tada: 746 747 Example: 748 ``` 749 <!-- Replace <OWNER> and <REPOSITORY>. It assumes workflow name is "reviewdog" --> 750 [![reviewdog](https://github.com/<OWNER>/<REPOSITORY>/workflows/reviewdog/badge.svg?branch=master&event=push)](https://github.com/<OWNER>/<REPOSITORY>/actions?query=workflow%3Areviewdog+event%3Apush+branch%3Amaster) 751 ``` 752 753 ### Travis CI 754 755 #### Travis CI (-reporter=github-pr-check) 756 757 If you use -reporter=github-pr-check in Travis CI, you don't need to set `REVIEWDOG_TOKEN`. 758 759 Example: 760 761 ```yaml 762 install: 763 - mkdir -p ~/bin/ && export PATH="~/bin/:$PATH" 764 - curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b ~/bin 765 766 script: 767 - reviewdog -conf=.reviewdog.yml -reporter=github-pr-check 768 ``` 769 770 #### Travis CI (-reporter=github-pr-review) 771 772 Store GitHub API token by [travis encryption keys](https://docs.travis-ci.com/user/encryption-keys/). 773 774 ```shell 775 $ gem install travis 776 $ travis encrypt REVIEWDOG_GITHUB_API_TOKEN=<token> --add env.global 777 ``` 778 Example: 779 780 ```yaml 781 env: 782 global: 783 - secure: <token> 784 785 install: 786 - mkdir -p ~/bin/ && export PATH="~/bin/:$PATH" 787 - curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b ~/bin 788 789 script: 790 - >- 791 golint ./... | reviewdog -f=golint -reporter=github-pr-review 792 ``` 793 794 Examples 795 - https://github.com/azu/textlint-reviewdog-example 796 797 ### Circle CI 798 799 Store `REVIEWDOG_GITHUB_API_TOKEN` (or `REVIEWDOG_TOKEN` for github-pr-check) in 800 [Environment variables - CircleCI](https://circleci.com/docs/environment-variables/#setting-environment-variables-for-all-commands-without-adding-them-to-git) 801 802 #### .circleci/config.yml sample 803 804 ```yaml 805 version: 2 806 jobs: 807 build: 808 docker: 809 - image: golang:latest 810 steps: 811 - checkout 812 - run: curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b ./bin 813 - run: go vet ./... 2>&1 | ./bin/reviewdog -f=govet -reporter=github-pr-review 814 815 # Deprecated: prefer GitHub Actions to use github-pr-check reporter. 816 - run: go vet ./... 2>&1 | ./bin/reviewdog -f=govet -reporter=github-pr-check 817 ``` 818 819 ### GitLab CI 820 821 Store `REVIEWDOG_GITLAB_API_TOKEN` in [GitLab CI variable](https://docs.gitlab.com/ee/ci/variables/#variables). 822 823 #### .gitlab-ci.yml sample 824 825 ```yaml 826 reviewdog: 827 script: 828 - reviewdog -reporter=gitlab-mr-discussion 829 # Or 830 - reviewdog -reporter=gitlab-mr-commit 831 ``` 832 833 ### Bitbucket Pipelines 834 835 No additional configuration is needed. 836 837 #### bitbucket-pipelines.yml sample 838 839 ```yaml 840 pipelines: 841 default: 842 - step: 843 name: Reviewdog 844 image: golangci/golangci-lint:v1.31-alpine 845 script: 846 - wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | 847 sh -s -- -b $(go env GOPATH)/bin 848 - golangci-lint run --out-format=line-number ./... | reviewdog -f=golangci-lint -reporter=bitbucket-code-report 849 ``` 850 851 ### Common (Jenkins, local, etc...) 852 853 You can use reviewdog to post review comments from anywhere with following 854 environment variables. 855 856 | name | description | 857 | ---- | ----------- | 858 | `CI_PULL_REQUEST` | Pull Request number (e.g. 14) | 859 | `CI_COMMIT` | SHA1 for the current build | 860 | `CI_REPO_OWNER` | repository owner (e.g. "reviewdog" for https://github.com/reviewdog/errorformat) | 861 | `CI_REPO_NAME` | repository name (e.g. "errorformat" for https://github.com/reviewdog/errorformat) | 862 | `CI_BRANCH` | [optional] branch of the commit | 863 864 ```shell 865 $ export CI_PULL_REQUEST=14 866 $ export CI_REPO_OWNER=haya14busa 867 $ export CI_REPO_NAME=reviewdog 868 $ export CI_COMMIT=$(git rev-parse HEAD) 869 ``` 870 and set a token if required. 871 872 ```shell 873 $ REVIEWDOG_TOKEN="<token>" 874 $ REVIEWDOG_GITHUB_API_TOKEN="<token>" 875 $ REVIEWDOG_GITLAB_API_TOKEN="<token>" 876 ``` 877 878 If a CI service doesn't provide information such as Pull Request ID - reviewdog can guess it by a branch name and commit SHA. 879 Just pass the flag `guess`: 880 881 ```shell 882 $ reviewdog -conf=.reviewdog.yml -reporter=github-pr-check -guess 883 ``` 884 885 #### Jenkins with GitHub pull request builder plugin 886 - [GitHub pull request builder plugin - Jenkins - Jenkins Wiki](https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin) 887 - [Configuring a GitHub app account - Jenkins - CloudBees](https://docs.cloudbees.com/docs/cloudbees-ci/latest/cloud-admin-guide/github-app-auth) - required to use github-pr-check formatter without reviewdog server or GitHub actions. 888 889 ```shell 890 $ export CI_PULL_REQUEST=${ghprbPullId} 891 $ export CI_REPO_OWNER=haya14busa 892 $ export CI_REPO_NAME=reviewdog 893 $ export CI_COMMIT=${ghprbActualCommit} 894 $ export REVIEWDOG_INSECURE_SKIP_VERIFY=true # set this as you need 895 896 # To submit via reviewdog server using github-pr-check reporter 897 $ REVIEWDOG_TOKEN="<token>" reviewdog -reporter=github-pr-check 898 # Or, to submit directly via API using github-pr-review reporter 899 $ REVIEWDOG_GITHUB_API_TOKEN="<token>" reviewdog -reporter=github-pr-review 900 # Or, to submit directly via API using github-pr-check reporter (requires GitHub App Account configured) 901 $ REVIEWDOG_SKIP_DOGHOUSE=true REVIEWDOG_GITHUB_API_TOKEN="<token>" reviewdog -reporter=github-pr-check 902 ``` 903 904 ## Exit codes 905 By default reviewdog will return `0` as exit code even if it finds errors. 906 If `-fail-on-error` flag is passed, reviewdog exits with `1` when at least one error was found/reported. 907 This can be helpful when you are using it as a step in your CI pipeline and want to mark the step failed if any error found by linter. 908 909 See also `-level` flag for [github-pr-check/github-check](#reporter-github-checks--reportergithub-pr-check) reporters. 910 reviewdog will exit with `1` if reported check status is `failure` as well if `-fail-on-error=true`. 911 912 ## Filter mode 913 reviewdog filter results by diff and you can control how reviewdog filter results by `-filter-mode` flag. 914 Available filter modes are as below. 915 916 ### `added` (default) 917 Filter results by added/modified lines. 918 ### `diff_context` 919 Filter results by diff context. i.e. changed lines +-N lines (N=3 for example). 920 ### `file` 921 Filter results by added/modified file. i.e. reviewdog will report results as long as they are in added/modified file even if the results are not in actual diff. 922 ### `nofilter` 923 Do not filter any results. Useful for posting results as comments as much as possible and check other results in console at the same time. 924 925 `-fail-on-error` also works with any filter-mode and can catch all results from any linters with `nofilter` mode. 926 927 Example: 928 ```shell 929 $ reviewdog -reporter=github-pr-review -filter-mode=nofilter -fail-on-error 930 ``` 931 932 ### Filter Mode Support Table 933 Note that not all reporters provide full support for filter mode due to API limitation. 934 e.g. `github-pr-review` reporter uses [GitHub Review 935 API](https://docs.github.com/en/rest/pulls/reviews) but this API don't support posting comments outside diff context, 936 so reviewdog will use [Check annotation](https://docs.github.com/en/rest/checks/runs) as fallback to post those comments [1]. 937 938 | `-reporter` \ `-filter-mode` | `added` | `diff_context` | `file` | `nofilter` | 939 | ---------------------------- | ------- | -------------- | ----------------------- | ---------- | 940 | **`local`** | OK | OK | OK | OK | 941 | **`github-check`** | OK | OK | OK | OK | 942 | **`github-pr-check`** | OK | OK | OK | OK | 943 | **`github-pr-review`** | OK | OK | Partially Supported [1] | Partially Supported [1] | 944 | **`github-pr-annotations`** | OK | OK | OK | OK | 945 | **`gitlab-mr-discussion`** | OK | OK | OK | Partially Supported [2] | 946 | **`gitlab-mr-commit`** | OK | Partially Supported [2] | Partially Supported [2] | Partially Supported [2] | 947 | **`gerrit-change-review`** | OK | OK? [3] | OK? [3] | Partially Supported? [2][3] | 948 | **`bitbucket-code-report`** | NO [4] | NO [4] | NO [4] | OK | 949 | **`gitea-pr-review`** | OK | OK | Partially Supported [2] | Partially Supported [2] | 950 951 - [1] Report results that are outside the diff file with Check annotation as fallback if it's running in GitHub actions instead of Review API (comments). All results will be reported to console as well. 952 - [2] Report results that are outside the diff file to console. 953 - [3] It should work, but not been verified yet. 954 - [4] Not implemented at the moment 955 956 ## Debugging 957 958 Use the `-tee` flag to show debug info. 959 960 ```shell 961 reviewdog -filter-mode=nofilter -tee 962 ``` 963 964 ## Articles 965 - [reviewdog — A code review dog who keeps your codebase healthy ](https://medium.com/@haya14busa/reviewdog-a-code-review-dog-who-keeps-your-codebase-healthy-d957c471938b) 966 - [reviewdog ♡ GitHub Check — improved automated review experience](https://medium.com/@haya14busa/reviewdog-github-check-improved-automated-review-experience-58f89e0c95f3) 967 - [Automated Code Review on GitHub Actions with reviewdog for any languages/tools](https://medium.com/@haya14busa/automated-code-review-on-github-actions-with-reviewdog-for-any-languages-tools-20285e04448e) 968 - [GitHub Actions to guard your workflow](https://evrone.com/blog/github-actions) 969 970 ## :bird: Author 971 haya14busa [![GitHub followers](https://img.shields.io/github/followers/haya14busa.svg?style=social&label=Follow)](https://github.com/haya14busa) 972 973 ## Contributors 974 975 [![Contributors](https://opencollective.com/reviewdog/contributors.svg?width=890)](https://github.com/reviewdog/reviewdog/graphs/contributors) 976 977 ### Supporting reviewdog 978 979 Become GitHub Sponsor for [each contributor](https://github.com/reviewdog/reviewdog/graphs/contributors) 980 or become a backer or sponsor from [opencollective](https://opencollective.com/reviewdog). 981 982 [![Become a backer](https://opencollective.com/reviewdog/tiers/backer.svg?avatarHeight=64)](https://opencollective.com/reviewdog#backers)