github.com/bgpat/reviewdog@v0.0.0-20230909064023-077e44ca1f66/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 service,
    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  diff of patches to review.
    62  
    63  reviewdog also supports run in the local environment to filter an 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  By this 'errorformat' feature, reviewdog can support any tools 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 feature 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 tools 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 of code suggestion.
   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`**   | NO [1]  |
   322  | **`gitlab-mr-commit`**       | NO [2]  |
   323  | **`gerrit-change-review`**   | NO [1]  |
   324  | **`bitbucket-code-report`**  | NO [2]  |
   325  
   326  - [1] The reporter service support code suggestion feature, but reviewdog does not support it yet. See [#678](https://github.com/reviewdog/reviewdog/issues/678) for the status.
   327  - [2] The reporter service itself doesn't support code suggestion feature.
   328  
   329  ## reviewdog config file
   330  
   331  reviewdog can also be controlled via the .reviewdog.yml configuration file instead of "-f" or "-efm" arguments.
   332  
   333  With .reviewdog.yml, you can run the same commands both CI service and local
   334  environment including editor integration with ease.
   335  
   336  #### .reviewdog.yml
   337  
   338  ```yaml
   339  runner:
   340    <tool-name>:
   341      cmd: <command> # (required)
   342      errorformat: # (optional if you use `format`)
   343        - <list of errorformat>
   344      format: <format-name> # (optional if you use `errorformat`. e.g. golint,rdjson,rdjsonl)
   345      name: <tool-name> # (optional. you can overwrite <tool-name> defined by runner key)
   346      level: <level> # (optional. same as -level flag. [info,warning,error])
   347  
   348    # examples
   349    golint:
   350      cmd: golint ./...
   351      errorformat:
   352        - "%f:%l:%c: %m"
   353      level: warning
   354    govet:
   355      cmd: go vet -all .
   356      format: govet
   357    your-awesome-linter:
   358      cmd: awesome-linter run
   359      format: rdjson
   360      name: AwesomeLinter
   361  ```
   362  
   363  ```shell
   364  $ reviewdog -diff="git diff FETCH_HEAD"
   365  project/run_test.go:61:28: [golint] error strings should not end with punctuation
   366  project/run.go:57:18: [errcheck]        defer os.Setenv(name, os.Getenv(name))
   367  project/run.go:58:12: [errcheck]        os.Setenv(name, "")
   368  # You can use -runners to run only specified runners.
   369  $ reviewdog -diff="git diff FETCH_HEAD" -runners=golint,govet
   370  project/run_test.go:61:28: [golint] error strings should not end with punctuation
   371  # You can use -conf to specify config file path.
   372  $ reviewdog -conf=./.reviewdog.yml -reporter=github-pr-check
   373  ```
   374  
   375  Output format for project config based run is one of the following formats.
   376  
   377  - `<file>: [<tool name>] <message>`
   378  - `<file>:<lnum>: [<tool name>] <message>`
   379  - `<file>:<lnum>:<col>: [<tool name>] <message>`
   380  
   381  ## Reporters
   382  
   383  reviewdog can report results both in local environment and review services as
   384  continuous integration.
   385  
   386  ### Reporter: Local (-reporter=local) [default]
   387  
   388  reviewdog can find newly introduced findings by filtering linter results
   389  using diff. You can pass diff command as `-diff` arg.
   390  
   391  ```shell
   392  $ golint ./... | reviewdog -f=golint -diff="git diff FETCH_HEAD"
   393  ```
   394  
   395  ### Reporter: GitHub Checks (-reporter=github-pr-check)
   396  
   397  [![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)
   398  [![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)
   399  
   400  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).
   401  
   402  You can change report level for this reporter by `level` field in [config
   403  file](#reviewdog-config-file) or `-level` flag. You can control GitHub status
   404  check result with this feature. (default: error)
   405  
   406  | Level     | GitHub Status |
   407  | --------- | ------------- |
   408  | `info`    | neutral       |
   409  | `warning` | neutral       |
   410  | `error`   | failure       |
   411  
   412  There are two options to use this reporter.
   413  
   414  #### Option 1) Run reviewdog from GitHub Actions w/ secrets.GITHUB_TOKEN
   415  
   416  Example: [.github/workflows/reviewdog.yml](.github/workflows/reviewdog.yml)
   417  
   418  ```yaml
   419  - name: Run reviewdog
   420    env:
   421      REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   422    run: |
   423      golint ./... | reviewdog -f=golint -reporter=github-pr-check
   424  ```
   425  
   426  See [GitHub Actions](#github-actions) section too. You can also use public
   427  reviewdog GitHub Actions.
   428  
   429  #### Option 2) Install reviewdog GitHub Apps
   430  reviewdog CLI send a request to reviewdog GitHub App server and the server post
   431  results as GitHub Checks, because Check API only supported for GitHub App and
   432  GitHub Actions.
   433  
   434  1. Install reviewdog Apps. https://github.com/apps/reviewdog
   435  2. Set `REVIEWDOG_TOKEN` or run reviewdog CLI in trusted CI providers.
   436    - Get token from `https://reviewdog.app/gh/{owner}/{repo-name}`.
   437  
   438  ```shell
   439  $ export REVIEWDOG_TOKEN="<token>"
   440  $ reviewdog -reporter=github-pr-check
   441  ```
   442  
   443  Note: Token is not required if you run reviewdog in Travis or AppVeyor.
   444  
   445  *Caution*
   446  
   447  As described above, github-pr-check reporter with Option 2 depends on
   448  reviewdog GitHub App server.
   449  The server is running with haya14busa's pocket money for now and I may break
   450  things, so I cannot ensure that the server is running 24h and 365 days.
   451  
   452  **UPDATE:** Started getting support by [opencollective](https://opencollective.com/reviewdog)
   453  and GitHub sponsor.
   454  See [Supporting reviewdog](#supporting-reviewdog)
   455  
   456  You can use github-pr-review reporter or use run reviewdog under GitHub Actions
   457  if you don't want to depend on reviewdog server.
   458  
   459  ### Reporter: GitHub Checks (-reporter=github-check)
   460  
   461  It's basically same as `-reporter=github-pr-check` except it works not only for
   462  Pull Request but also for commit.
   463  
   464  [![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)
   465  
   466  You can create [reviewdog badge](#reviewdog-badge-) for this reporter.
   467  
   468  ### Reporter: GitHub PullRequest review comment (-reporter=github-pr-review)
   469  
   470  [![sample-comment.png](https://raw.githubusercontent.com/haya14busa/i/dc0ccb1e110515ea407c146d99b749018db05c45/reviewdog/sample-comment.png)](https://github.com/reviewdog/reviewdog/pull/24#discussion_r84599728)
   471  
   472  github-pr-review reporter reports results to GitHub PullRequest review comments
   473  using GitHub Personal API Access Token.
   474  [GitHub Enterprise](https://github.com/enterprise) is supported too.
   475  
   476  - Go to https://github.com/settings/tokens and generate new API token.
   477  - Check `repo` for private repositories or `public_repo` for public repositories.
   478  
   479  ```shell
   480  $ export REVIEWDOG_GITHUB_API_TOKEN="<token>"
   481  $ reviewdog -reporter=github-pr-review
   482  ```
   483  
   484  For GitHub Enterprise, set API endpoint by environment variable.
   485  
   486  ```shell
   487  $ export GITHUB_API="https://example.githubenterprise.com/api/v3/"
   488  $ export REVIEWDOG_INSECURE_SKIP_VERIFY=true # set this as you need to skip verifying SSL
   489  ```
   490  
   491  See [GitHub Actions](#github-actions) section too if you can use GitHub
   492  Actions. You can also use public reviewdog GitHub Actions.
   493  
   494  ### Reporter: GitLab MergeRequest discussions (-reporter=gitlab-mr-discussion)
   495  
   496  [![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)
   497  
   498  Required GitLab version: >= v10.8.0
   499  
   500  gitlab-mr-discussion reporter reports results to GitLab MergeRequest discussions using
   501  GitLab Personal API Access token.
   502  Get the token with `api` scope from https://gitlab.com/profile/personal_access_tokens.
   503  
   504  ```shell
   505  $ export REVIEWDOG_GITLAB_API_TOKEN="<token>"
   506  $ reviewdog -reporter=gitlab-mr-discussion
   507  ```
   508  
   509  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.
   510  
   511  Alternatively, `GITLAB_API` can also be defined, in which case it will take precedence over `CI_API_V4_URL`.
   512  
   513  ```shell
   514  $ export GITLAB_API="https://example.gitlab.com/api/v4"
   515  $ export REVIEWDOG_INSECURE_SKIP_VERIFY=true # set this as you need to skip verifying SSL
   516  ```
   517  
   518  ### Reporter: GitLab MergeRequest commit (-reporter=gitlab-mr-commit)
   519  
   520  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.
   521  
   522  gitlab-mr-discussion is recommended, but you can use gitlab-mr-commit reporter
   523  if your GitLab version is under v10.8.0.
   524  
   525  ```shell
   526  $ export REVIEWDOG_GITLAB_API_TOKEN="<token>"
   527  $ reviewdog -reporter=gitlab-mr-commit
   528  ```
   529  
   530  ### Reporter: Gerrit Change review (-reporter=gerrit-change-review)
   531  
   532  gerrit-change-review reporter reports result to Gerrit Change using Gerrit Rest APIs.
   533  
   534  The reporter supports Basic Authentication and Git-cookie based authentication for reporting results.
   535  
   536  Set `GERRIT_USERNAME` and `GERRIT_PASSWORD` environment variables for basic authentication, and put `GIT_GITCOOKIE_PATH` for git cookie based authentication.
   537  
   538  ```shell
   539  $ export GERRIT_CHANGE_ID=changeID
   540  $ export GERRIT_REVISION_ID=revisionID
   541  $ export GERRIT_BRANCH=master
   542  $ export GERRIT_ADDRESS=http://<gerrit-host>:<gerrit-port>
   543  $ reviewdog -reporter=gerrit-change-review
   544  ```
   545  
   546  ### Reporter: Bitbucket Code Insights Reports (-reporter=bitbucket-code-report)
   547  
   548  [![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)
   549  [![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)
   550  
   551  bitbucket-code-report generates the annotated
   552  [Bitbucket Code Insights](https://support.atlassian.com/bitbucket-cloud/docs/code-insights/) report.
   553  
   554  For now, only the `no-filter` mode supported, so the whole project is scanned on every run.
   555  Reports are stored per commit and can be viewed per commit from Bitbucket Pipelines UI or
   556  in Pull Request. In the Pull Request UI affected code lines will be annotated in the diff,
   557  as well as you will be able to filter the annotations by **This pull request** or **All**.
   558  
   559  If running from [Bitbucket Pipelines](#bitbucket-pipelines), no additional configuration is needed (even credentials).
   560  If running locally or from some other CI system you would need to provide Bitbucket API credentials:
   561  
   562  - For Basic Auth you need to set following env variables:
   563      `BITBUCKET_USER` and `BITBUCKET_PASSWORD`
   564  - For AccessToken Auth you need to set `BITBUCKET_ACCESS_TOKEN`
   565  
   566  ```shell
   567  $ export BITBUCKET_USER="my_user"
   568  $ export BITBUCKET_PASSWORD="my_password"
   569  $ reviewdog -reporter=bitbucket-code-report
   570  ```
   571  
   572  To post report to Bitbucket Server use `BITBUCKET_SERVER_URL` variable:
   573  ```shell
   574  $ export BITBUCKET_USER="my_user"
   575  $ export BITBUCKET_PASSWORD="my_password"
   576  $ export BITBUCKET_SERVER_URL="https://bitbucket.my-company.com"
   577  $ reviewdog -reporter=bitbucket-code-report
   578  ```
   579  
   580  ## Supported CI services
   581  
   582  ### [GitHub Actions](https://github.com/features/actions)
   583  
   584  Example: [.github/workflows/reviewdog.yml](.github/workflows/reviewdog.yml)
   585  
   586  ```yaml
   587  name: reviewdog
   588  on: [pull_request]
   589  jobs:
   590    reviewdog:
   591      name: reviewdog
   592      runs-on: ubuntu-latest
   593      steps:
   594        # ...
   595        - uses: reviewdog/action-setup@v1
   596          with:
   597            reviewdog_version: latest # Optional. [latest,nightly,v.X.Y.Z]
   598        - name: Run reviewdog
   599          env:
   600            REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   601          run: |
   602            reviewdog -reporter=github-pr-check -runners=golint,govet
   603            # or
   604            reviewdog -reporter=github-pr-review -runners=golint,govet
   605  ```
   606  
   607  <details>
   608  <summary><strong>Example (github-check reporter):</strong></summary>
   609  
   610  [.github/workflows/reviewdog](.github/workflows/reviewdog.yml)
   611  
   612  Only `github-check` reporter can run on push event too.
   613  
   614  ```yaml
   615  name: reviewdog (github-check)
   616  on:
   617    push:
   618      branches:
   619        - master
   620    pull_request:
   621  
   622  jobs:
   623    reviewdog:
   624      name: reviewdog
   625      runs-on: ubuntu-latest
   626      steps:
   627        # ...
   628        - name: Run reviewdog
   629          env:
   630            REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
   631          run: |
   632            reviewdog -reporter=github-check -runners=golint,govet
   633  ```
   634  
   635  </details>
   636  
   637  #### Public Reviewdog GitHub Actions
   638  You can use public GitHub Actions to start using reviewdog with ease! :tada: :arrow_forward: :tada:
   639  
   640  - Common
   641    - [reviewdog/action-misspell](https://github.com/reviewdog/action-misspell) - Run [misspell](https://github.com/client9/misspell).
   642    - [EPMatt/reviewdog-action-prettier](https://github.com/EPMatt/reviewdog-action-prettier) - Run [Prettier](https://prettier.io/).
   643  - Text
   644    - [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)
   645    - [reviewdog/action-languagetool](https://github.com/reviewdog/action-languagetool) - Run [languagetool](https://github.com/languagetool-org/languagetool).
   646    - [tsuyoshicho/action-textlint](https://github.com/tsuyoshicho/action-textlint) - Run [textlint](https://github.com/textlint/textlint)
   647    - [tsuyoshicho/action-redpen](https://github.com/tsuyoshicho/action-redpen) - Run [redpen](https://github.com/redpen-cc/redpen)
   648  - Markdown
   649    - [reviewdog/action-markdownlint](https://github.com/reviewdog/action-markdownlint) - Run [markdownlint](https://github.com/DavidAnson/markdownlint)
   650  - Docker
   651    - [reviewdog/action-hadolint](https://github.com/reviewdog/action-hadolint) - Run [hadolint](https://github.com/hadolint/hadolint) to lint `Dockerfile`.
   652  - Env
   653    - [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.
   654  - Shell script
   655    - [reviewdog/action-shellcheck](https://github.com/reviewdog/action-shellcheck) - Run [shellcheck](https://github.com/koalaman/shellcheck).
   656    - [reviewdog/action-shfmt](https://github.com/reviewdog/action-shfmt) - Run [shfmt](https://github.com/mvdan/sh).
   657  - Go
   658    - [reviewdog/action-staticcheck](https://github.com/reviewdog/action-staticcheck) - Run [staticcheck](https://staticcheck.io/).
   659    - [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.
   660  - JavaScript
   661    - [reviewdog/action-eslint](https://github.com/reviewdog/action-eslint) - Run [eslint](https://github.com/eslint/eslint).
   662  - TypeScript
   663    - [EPMatt/reviewdog-action-tsc](https://github.com/EPMatt/reviewdog-action-tsc) - Run [tsc](https://www.typescriptlang.org/docs/handbook/compiler-options.html).
   664  - CSS
   665    - [reviewdog/action-stylelint](https://github.com/reviewdog/action-stylelint) - Run [stylelint](https://github.com/stylelint/stylelint).
   666  - Vim script
   667    - [reviewdog/action-vint](https://github.com/reviewdog/action-vint) - Run [vint](https://github.com/Vimjas/vint).
   668    - [tsuyoshicho/action-vimlint](https://github.com/tsuyoshicho/action-vimlint) - Run [vim-vimlint](https://github.com/syngan/vim-vimlint)
   669  - Terraform
   670    - [reviewdog/action-tflint](https://github.com/reviewdog/action-tflint) - Run [tflint](https://github.com/terraform-linters/tflint).
   671  - YAML
   672    - [reviewdog/action-yamllint](https://github.com/reviewdog/action-yamllint) - Run [yamllint](https://github.com/adrienverge/yamllint).
   673  - Ruby
   674    - [reviewdog/action-brakeman](https://github.com/reviewdog/action-brakeman) - Run [brakeman](https://github.com/presidentbeef/brakeman).
   675    - [reviewdog/action-reek](https://github.com/reviewdog/action-reek) - Run [reek](https://github.com/troessner/reek).
   676    - [reviewdog/action-rubocop](https://github.com/reviewdog/action-rubocop) - Run [rubocop](https://github.com/rubocop/rubocop).
   677    - [vk26/action-fasterer](https://github.com/vk26/action-fasterer) - Run [fasterer](https://github.com/DamirSvrtan/fasterer).
   678    - [PrintReleaf/action-standardrb](https://github.com/PrintReleaf/action-standardrb) - Run [standardrb](https://github.com/standardrb/standard).
   679    - [tk0miya/action-erblint](https://github.com/tk0miya/action-erblint) - Run [erb-lint](https://github.com/Shopify/erb-lint)
   680    - [tk0miya/action-steep](https://github.com/tk0miya/action-steep) - Run [steep](https://github.com/soutaro/steep)
   681    - [blooper05/action-rails_best_practices](https://github.com/blooper05/action-rails_best_practices) - Run [rails_best_practices](https://github.com/flyerhzm/rails_best_practices)
   682    - [tomferreira/action-bundler-audit](https://github.com/tomferreira/action-bundler-audit) - Run [bundler-audit](https://github.com/rubysec/bundler-audit)
   683  - Python
   684    - [wemake-python-styleguide](https://github.com/wemake-services/wemake-python-styleguide) - Run wemake-python-styleguide
   685    - [tsuyoshicho/action-mypy](https://github.com/tsuyoshicho/action-mypy) - Run [mypy](https://pypi.org/project/mypy/)
   686    - [jordemort/action-pyright](https://github.com/jordemort/action-pyright) - Run [pyright](https://github.com/Microsoft/pyright)
   687    - [dciborow/action-pylint](https://github.com/dciborow/action-pylint) - Run [pylint](https://github.com/pylint-dev/pylint)
   688    - [reviewdog/action-black](https://github.com/reviewdog/action-black) - Run [black](https://github.com/psf/black)
   689  - Kotlin
   690    - [ScaCap/action-ktlint](https://github.com/ScaCap/action-ktlint) - Run [ktlint](https://ktlint.github.io/).
   691  - Android Lint
   692    - [dvdandroid/action-android-lint](https://github.com/DVDAndroid/action-android-lint) - Run [Android Lint](https://developer.android.com/studio/write/lint)
   693  - Ansible
   694    - [reviewdog/action-ansiblelint](https://github.com/reviewdog/action-ansiblelint) - Run [ansible-lint](https://github.com/ansible/ansible-lint)
   695  - GitHub Actions
   696    - [reviewdog/action-actionlint](https://github.com/reviewdog/action-actionlint) - Run [actionlint](https://github.com/rhysd/actionlint)
   697  - Protocol Buffers
   698    - [yoheimuta/action-protolint](https://github.com/yoheimuta/action-protolint) - Run [protolint](https://github.com/yoheimuta/protolint)
   699    
   700  ... and more on [GitHub Marketplace](https://github.com/marketplace?utf8=✓&type=actions&query=reviewdog).
   701  
   702  Missing actions? Check out [reviewdog/action-template](https://github.com/reviewdog/action-template) and create a new reviewdog action!
   703  
   704  Please open a Pull Request to add your created reviewdog actions here :sparkles:.
   705  I can also put your repositories under reviewdog org and co-maintain the actions.
   706  Example: [action-tflint](https://github.com/reviewdog/reviewdog/issues/322).
   707  
   708  #### Graceful Degradation for Pull Requests from forked repositories
   709  
   710  ![Graceful Degradation example](https://user-images.githubusercontent.com/3797062/71781334-e2266b00-3010-11ea-8a38-dee6e30c8162.png)
   711  
   712  `GITHUB_TOKEN` for Pull Requests from forked repository doesn't have write
   713  access to Check API nor Review API due to [GitHub Actions
   714  restriction](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token).
   715  
   716  Instead, reviewdog uses [Logging commands of GitHub
   717  Actions](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#set-an-error-message-error)
   718  to post results as
   719  [annotations](https://docs.github.com/en/rest/checks/runs#annotations-object)
   720  similar to `github-pr-check` reporter.
   721  
   722  Note that there is a limitation for annotations created by logging commands,
   723  such as [max # of annotations per run](https://github.com/reviewdog/reviewdog/issues/411#issuecomment-570893427).
   724  You can check GitHub Actions log to see full results in such cases.
   725  
   726  #### 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)
   727  
   728  As [`github-check` reporter](#reporter-github-checks--reportergithub-pr-check) support running on commit, we can create reviewdog
   729  [GitHub Action badge](https://docs.github.com/en/actions/using-workflows#adding-a-workflow-status-badge-to-your-repository)
   730  to check the result against master commit for example. :tada:
   731  
   732  Example:
   733  ```
   734  <!-- Replace <OWNER> and <REPOSITORY>. It assumes workflow name is "reviewdog" -->
   735  [![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)
   736  ```
   737  
   738  ### Travis CI
   739  
   740  #### Travis CI (-reporter=github-pr-check)
   741  
   742  If you use -reporter=github-pr-check in Travis CI, you don't need to set `REVIEWDOG_TOKEN`.
   743  
   744  Example:
   745  
   746  ```yaml
   747  install:
   748    - mkdir -p ~/bin/ && export PATH="~/bin/:$PATH"
   749    - curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b ~/bin
   750  
   751  script:
   752    - reviewdog -conf=.reviewdog.yml -reporter=github-pr-check
   753  ```
   754  
   755  #### Travis CI (-reporter=github-pr-review)
   756  
   757  Store GitHub API token by [travis encryption keys](https://docs.travis-ci.com/user/encryption-keys/).
   758  
   759  ```shell
   760  $ gem install travis
   761  $ travis encrypt REVIEWDOG_GITHUB_API_TOKEN=<token> --add env.global
   762  ```
   763  Example:
   764  
   765  ```yaml
   766  env:
   767    global:
   768      - secure: <token>
   769  
   770  install:
   771    - mkdir -p ~/bin/ && export PATH="~/bin/:$PATH"
   772    - curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b ~/bin
   773  
   774  script:
   775    - >-
   776      golint ./... | reviewdog -f=golint -reporter=github-pr-review
   777  ```
   778  
   779  Examples
   780  - https://github.com/azu/textlint-reviewdog-example
   781  
   782  ### Circle CI
   783  
   784  Store `REVIEWDOG_GITHUB_API_TOKEN` (or `REVIEWDOG_TOKEN` for github-pr-check) in
   785  [Environment variables - CircleCI](https://circleci.com/docs/environment-variables/#setting-environment-variables-for-all-commands-without-adding-them-to-git)
   786  
   787  #### .circleci/config.yml sample
   788  
   789  ```yaml
   790  version: 2
   791  jobs:
   792    build:
   793      docker:
   794        - image: golang:latest
   795      steps:
   796        - checkout
   797        - run: curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh| sh -s -- -b ./bin
   798        - run: go vet ./... 2>&1 | ./bin/reviewdog -f=govet -reporter=github-pr-review
   799  
   800        # Deprecated: prefer GitHub Actions to use github-pr-check reporter.
   801        - run: go vet ./... 2>&1 | ./bin/reviewdog -f=govet -reporter=github-pr-check
   802  ```
   803  
   804  ### GitLab CI
   805  
   806  Store `REVIEWDOG_GITLAB_API_TOKEN` in [GitLab CI variable](https://docs.gitlab.com/ee/ci/variables/#variables).
   807  
   808  #### .gitlab-ci.yml sample
   809  
   810  ```yaml
   811  reviewdog:
   812    script:
   813      - reviewdog -reporter=gitlab-mr-discussion
   814      # Or
   815      - reviewdog -reporter=gitlab-mr-commit
   816  ```
   817  
   818  ### Bitbucket Pipelines
   819  
   820  No additional configuration is needed.
   821  
   822  #### bitbucket-pipelines.yml sample
   823  
   824  ```yaml
   825  pipelines:
   826    default:
   827      - step:
   828          name: Reviewdog
   829          image: golangci/golangci-lint:v1.31-alpine
   830          script:
   831            - wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/master/install.sh | 
   832                sh -s -- -b $(go env GOPATH)/bin
   833            - golangci-lint run --out-format=line-number ./... | reviewdog -f=golangci-lint -reporter=bitbucket-code-report
   834  ```
   835  
   836  ### Common (Jenkins, local, etc...)
   837  
   838  You can use reviewdog to post review comments from anywhere with following
   839  environment variables.
   840  
   841  | name | description |
   842  | ---- | ----------- |
   843  | `CI_PULL_REQUEST` | Pull Request number (e.g. 14) |
   844  | `CI_COMMIT`       | SHA1 for the current build |
   845  | `CI_REPO_OWNER`   | repository owner (e.g. "reviewdog" for https://github.com/reviewdog/errorformat) |
   846  | `CI_REPO_NAME`    | repository name (e.g. "errorformat" for https://github.com/reviewdog/errorformat) |
   847  | `CI_BRANCH`       | [optional] branch of the commit |
   848  
   849  ```shell
   850  $ export CI_PULL_REQUEST=14
   851  $ export CI_REPO_OWNER=haya14busa
   852  $ export CI_REPO_NAME=reviewdog
   853  $ export CI_COMMIT=$(git rev-parse HEAD)
   854  ```
   855  and set a token if required.
   856  
   857  ```shell
   858  $ REVIEWDOG_TOKEN="<token>"
   859  $ REVIEWDOG_GITHUB_API_TOKEN="<token>"
   860  $ REVIEWDOG_GITLAB_API_TOKEN="<token>"
   861  ```
   862  
   863  If a CI service doesn't provide information such as Pull Request ID - reviewdog can guess it by branch name and commit SHA.
   864  Just pass the flag `guess`:
   865  
   866  ```shell
   867  $ reviewdog -conf=.reviewdog.yml -reporter=github-pr-check -guess
   868  ```
   869  
   870  #### Jenkins with GitHub pull request builder plugin
   871  - [GitHub pull request builder plugin - Jenkins - Jenkins Wiki](https://wiki.jenkins-ci.org/display/JENKINS/GitHub+pull+request+builder+plugin)
   872  - [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.
   873  
   874  ```shell
   875  $ export CI_PULL_REQUEST=${ghprbPullId}
   876  $ export CI_REPO_OWNER=haya14busa
   877  $ export CI_REPO_NAME=reviewdog
   878  $ export CI_COMMIT=${ghprbActualCommit}
   879  $ export REVIEWDOG_INSECURE_SKIP_VERIFY=true # set this as you need
   880  
   881  # To submit via reviewdog server using github-pr-check reporter
   882  $ REVIEWDOG_TOKEN="<token>" reviewdog -reporter=github-pr-check
   883  # Or, to submit directly via API using github-pr-review reporter
   884  $ REVIEWDOG_GITHUB_API_TOKEN="<token>" reviewdog -reporter=github-pr-review
   885  # Or, to submit directly via API using github-pr-check reporter (requires GitHub App Account configured)
   886  $ REVIEWDOG_SKIP_DOGHOUSE=true REVIEWDOG_GITHUB_API_TOKEN="<token>" reviewdog -reporter=github-pr-check
   887  ```
   888  
   889  ## Exit codes
   890  By default reviewdog will return `0` as exit code even if it finds errors.
   891  If `-fail-on-error` flag is passed, reviewdog exits with `1` when at least one error was found/reported.
   892  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.
   893  
   894  See also `-level` flag for [github-pr-check/github-check](#reporter-github-checks--reportergithub-pr-check) reporters.
   895  reviewdog will exit with `1` if reported check status is `failure` as well if `-fail-on-error=true`.
   896  
   897  ## Filter mode
   898  reviewdog filter results by diff and you can control how reviewdog filter results by `-filter-mode` flag.
   899  Available filter modes are as below.
   900  
   901  ### `added` (default)
   902  Filter results by added/modified lines.
   903  ### `diff_context`
   904  Filter results by diff context. i.e. changed lines +-N lines (N=3 for example).
   905  ### `file`
   906  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.
   907  ### `nofilter`
   908  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.
   909  
   910  `-fail-on-error` also works with any filter-mode and can catch all results from any linters with `nofilter` mode.
   911  
   912  Example:
   913  ```shell
   914  $ reviewdog -reporter=github-pr-review -filter-mode=nofilter -fail-on-error
   915  ```
   916  
   917  ### Filter Mode Support Table
   918  Note that not all reporters provide full support of filter mode due to API limitation.
   919  e.g. `github-pr-review` reporter uses [GitHub Review
   920  API](https://docs.github.com/en/rest/pulls/reviews) but it doesn't support posting comment outside diff (`diff_context`),
   921  so reviewdog will use [Check annotation](https://docs.github.com/en/rest/checks/runs) as fallback to post those comments [1]. 
   922  
   923  | `-reporter` \ `-filter-mode` | `added` | `diff_context` | `file`                  | `nofilter` |
   924  | ---------------------------- | ------- | -------------- | ----------------------- | ---------- |
   925  | **`local`**                  | OK      | OK             | OK                      | OK |
   926  | **`github-check`**           | OK      | OK             | OK                      | OK |
   927  | **`github-pr-check`**        | OK      | OK             | OK                      | OK |
   928  | **`github-pr-review`**       | OK      | OK             | Partially Supported [1] | Partially Supported [1] |
   929  | **`gitlab-mr-discussion`**   | OK      | OK             | OK                      | Partially Supported [2] |
   930  | **`gitlab-mr-commit`**       | OK      | Partially Supported [2] | Partially Supported [2] | Partially Supported [2] |
   931  | **`gerrit-change-review`**   | OK      | OK? [3]        | OK? [3]                 | Partially Supported? [2][3] |
   932  | **`bitbucket-code-report`**  | NO [4]  | NO [4]         | NO [4]                  | OK |
   933  
   934  - [1] Report results which is outside diff context 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.
   935  - [2] Report results which is outside diff file to console.
   936  - [3] It should work, but not verified yet.
   937  - [4] Not implemented at the moment
   938  
   939  ## Debugging
   940  
   941  Use the `-tee` flag to show debug info.
   942  
   943  ```shell
   944  reviewdog -filter-mode=nofilter -tee
   945  ```
   946  
   947  ## Articles
   948  - [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)
   949  - [reviewdog ♡ GitHub Check — improved automated review experience](https://medium.com/@haya14busa/reviewdog-github-check-improved-automated-review-experience-58f89e0c95f3)
   950  - [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)
   951  - [GitHub Actions to guard your workflow](https://evrone.com/blog/github-actions)
   952  
   953  ## :bird: Author
   954  haya14busa [![GitHub followers](https://img.shields.io/github/followers/haya14busa.svg?style=social&label=Follow)](https://github.com/haya14busa)
   955  
   956  ## Contributors
   957  
   958  [![Contributors](https://opencollective.com/reviewdog/contributors.svg?width=890)](https://github.com/reviewdog/reviewdog/graphs/contributors)
   959  
   960  ### Supporting reviewdog
   961  
   962  Become GitHub Sponsor for [each contributor](https://github.com/reviewdog/reviewdog/graphs/contributors)
   963  or become a backer or sponsor from [opencollective](https://opencollective.com/reviewdog).
   964  
   965  [![Become a backer](https://opencollective.com/reviewdog/tiers/backer.svg?avatarHeight=64)](https://opencollective.com/reviewdog#backers)