github.com/androidjp/reviewdog@v0.0.0-20220826111045-b4abb51cf85a/README.md (about)

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