Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🐶 Automated code review tool integrated with any code analysis tools regardless of programming language

License

NotificationsYou must be signed in to change notification settings

reviewdog/reviewdog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
reviewdog

reviewdog - A code review dog who keeps your codebase healthy.

LICENSEGoDocreleasesnightly releases
GitHub ActionsreviewdogreleaseCircleCI StatusCoverage Status
GitLab Supportedaction-bumpr supportedContributor CovenantGitHub Releases StatsStars

reviewdog provides a way to post review comments to code hosting services,such as GitHub, automatically by integrating with any linter tools with ease.It uses an output of lint tools and posts them as a comment if findings are inthe diff of patches to review.

reviewdog also supports running in the local environment to filter the output of lint toolsby diff.

design doc

Table of Contents

github-pr-check samplecomment in pull-requestcommit statussample-comment.pngreviewdog-local-demo.gif

Installation

# Install the latest version. (Install it into ./bin/ by default).$ curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/fd59714416d6d9a1c0692d872e38e7f8448df4fc/install.sh| sh -s# Specify installation directory ($(go env GOPATH)/bin/) and version.$ curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/fd59714416d6d9a1c0692d872e38e7f8448df4fc/install.sh| sh -s -- -b$(go env GOPATH)/bin [vX.Y.Z]# In alpine linux (as it does not come with curl by default)$ wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/fd59714416d6d9a1c0692d872e38e7f8448df4fc/install.sh| sh -s [vX.Y.Z]

Nightly releases

You can also usenightly reviewdog releaseto try the latest reviewdog improvements every day!

$ curl -sfL https://raw.githubusercontent.com/reviewdog/nightly/30fccfe9f47f7e6fd8b3c38aa0da11a6c9f04de7/install.sh| sh -s -- -b$(go env GOPATH)/bin
steps:-uses:reviewdog/action-setup@d8edfce3dd5e1ec6978745e801f9c50b5ef80252# v1.4.0with:reviewdog_version:latest# Optional. [latest,nightly,v.X.Y.Z]

homebrew / linuxbrew

You can also install reviewdog using brew:

$ brew install reviewdog/tap/reviewdog$ brew upgrade reviewdog/tap/reviewdog

Scoop on Windows

> scoop install reviewdog

Build with go install

$ go install github.com/reviewdog/reviewdog/cmd/reviewdog@latest

Input Format

'errorformat'

reviewdog accepts any compiler or linter result from stdin and parses it withscan-f like'errorformat',which is the port of Vim'serrorformatfeature.

For example, if the result format is{file}:{line number}:{column number}: {message},errorformat should be%f:%l:%c: %m and you can pass it as-efm arguments.

$ golint ./...comment_iowriter.go:11:6: exportedtype CommentWriter should have comment or be unexported$ golint ./...| reviewdog -efm="%f:%l:%c: %m" -diff="git diff FETCH_HEAD"
namedescription
%ffile name
%lline number
%ccolumn number
%merror message
%%the single '%' character
......

Please seereviewdog/errorformatand:h errorformatif you want to deal with a more complex output. 'errorformat' can handle morecomplex output like a multi-line error message.

You can also try errorformat onthe Playground!

With this 'errorformat' feature, reviewdog can support any tool output with ease.

Available pre-defined 'errorformat'

But, you don't have to write 'errorformat' in many cases. reviewdog supportspre-defined errorformat for major tools.

You can find available errorformat name byreviewdog -list and you can use itwith-f={name}.

$ reviewdog -listgolint          linterfor Gosource code                                       - https://github.com/golang/lintgovet           Vet examines Gosource code and reports suspicious problems     - https://golang.org/cmd/vet/sbt             the interactive build tool                                      - http://www.scala-sbt.org/...
$ golint ./...| reviewdog -f=golint -diff="git diff FETCH_HEAD"

You can add supported pre-defined 'errorformat' by contributing toreviewdog/errorformat

Reviewdog Diagnostic Format (RDFormat)

reviewdog supportsReviewdog Diagnostic Format (RDFormat) as ageneric diagnostic format and it supports bothrdjson andrdjsonl formats.

This rdformat supports rich features like multiline ranged comments, severity,rule code with URL, andcode suggestions.

$<linter>|<convert-to-rdjson>| reviewdog -f=rdjson -reporter=github-pr-review# or$<linter>|<convert-to-rdjsonl>| reviewdog -f=rdjsonl -reporter=github-pr-review

Example: ESLint with RDFormat

eslint reviewdog rdjson demo

You can useeslint-formatter-rdjsonto outputrdjson as eslint output format.

$ npm install --save-dev eslint-formatter-rdjson$ eslint -f rdjson.| reviewdog -f=rdjson -reporter=github-pr-review

Or you can also usereviewdog/action-eslint for GitHub Actions.

Diff

reviewdog with gofmt example

reviewdog supports diff (unified format) as an input format especially usefulforcode suggestions.reviewdog can integrate with any code suggestions tools or formatters to report suggestions.

-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)

$<any-code-fixer/formatter># e.g. eslint --fix, gofmt$ TMPFILE=$(mktemp)$ git diff>"${TMPFILE}"$ git stash -u&& git stash drop$ reviewdog -f=diff -f.diff.strip=1 -reporter=github-pr-review<"${TMPFILE}"

Or you can also usereviewdog/action-suggester for GitHub Actions.

If diagnostic tools support diff output format, you can pipe the diff directly.

$ gofmt -s -d.| reviewdog -name="gofmt" -f=diff -f.diff.strip=0 -reporter=github-pr-review$ shellcheck -f diff$(shfmt -f .)| reviewdog -f=diff

checkstyle format

reviewdog also acceptscheckstyle XML format as well.If the linter supports checkstyle format as a report format, you can use-f=checkstyle instead of using 'errorformat'.

# Local$ eslint -f checkstyle.| reviewdog -f=checkstyle -diff="git diff"# CI (overwrite tool name which is shown in review comment by -name arg)$ eslint -f checkstyle.| reviewdog -f=checkstyle -name="eslint" -reporter=github-check

Also, if you want to pass other Json/XML/etc... format to reviewdog, you can write a converter.

$<linter>|<convert-to-checkstyle>| reviewdog -f=checkstyle -name="<linter>" -reporter=github-pr-check

SARIF format

reviewdog supportsSARIF 2.1.0 JSON format.You can use reviewdog with -f=sarif option.

# Local$ eslint -f @microsoft/eslint-formatter-sarif.| reviewdog -f=sarif -diff="git diff"

Code Suggestions

eslint reviewdog suggestion demoreviewdog with gofmt example

reviewdog supportscode suggestions feature withrdformat ordiff input.You can also usereviewdog/action-suggester for GitHub Actions.

reviewdog can suggest code changes along with diagnostic results if a diagnostic tool supports code suggestions data.You can integrate reviewdog with any code fixing tools and any code formatter withdiff input as well.

Code Suggestions Support Table

Note that not all reporters provide support for code suggestions.

-reporterSuggestion support
localNO [1]
github-checkNO [2]
github-pr-checkNO [2]
github-annotationsNO [2]
github-pr-annotationsNO [2]
github-pr-reviewOK
gitlab-mr-discussionOK
gitlab-mr-commitNO [2]
gerrit-change-reviewNO [1]
bitbucket-code-reportNO [2]
gitea-pr-reviewNO [2]
  • [1] The reporter service supports the code suggestion feature, but reviewdog does not support it yet. See#678 for the status.
  • [2] The reporter service itself doesn't support the code suggestion feature.

reviewdog config file

reviewdog can also be controlled via the .reviewdog.yml configuration file instead of "-f" or "-efm" arguments.

With .reviewdog.yml, you can run the same commands for both CI service and localenvironment including editor integration with ease.

.reviewdog.yml

runner:<tool-name>:cmd:<command># (required)errorformat:# (optional if you use `format`)      -<list of errorformat>format:<format-name># (optional if you use `errorformat`. e.g. golint,rdjson,rdjsonl)name:<tool-name># (optional. you can overwrite <tool-name> defined by runner key)level:<level># (optional. same as -level flag. [info,warning,error])# examplesgolint:cmd:golint ./...errorformat:      -"%f:%l:%c: %m"level:warninggovet:cmd:go vet -all .format:govetyour-awesome-linter:cmd:awesome-linter runformat:rdjsonname:AwesomeLinter
$ reviewdog -diff="git diff FETCH_HEAD"project/run_test.go:61:28: [golint] error strings should not end with punctuationproject/run.go:57:18: [errcheck]        defer os.Setenv(name, os.Getenv(name))project/run.go:58:12: [errcheck]        os.Setenv(name,"")# You can use -runners to run only specified runners.$ reviewdog -diff="git diff FETCH_HEAD" -runners=golint,govetproject/run_test.go:61:28: [golint] error strings should not end with punctuation# You can use -conf to specify config file path.$ reviewdog -conf=./.reviewdog.yml -reporter=github-pr-check

Output format for project config based run is one of the following formats.

  • <file>: [<tool name>] <message>
  • <file>:<lnum>: [<tool name>] <message>
  • <file>:<lnum>:<col>: [<tool name>] <message>

Reporters

reviewdog can report results both in the local environment and review services ascontinuous integration.

Reporter: Local (-reporter=local) [default]

reviewdog can find newly introduced findings by filtering linter resultsusing diff. You can pass the diff command as-diff arg.

$ golint ./...| reviewdog -f=golint -diff="git diff FETCH_HEAD"

Reporter: GitHub PR Checks (-reporter=github-pr-check)

github-pr-check sample annotation with option 1github-pr-check sample

github-pr-check reporter reports results toGitHub Checks.

You can change the report level for this reporter bylevel field inconfigfile or-level flag. You can control GitHub statuscheck results with this feature. (default: error)

LevelGitHub Status
infoneutral
warningneutral
errorfailure

There are two options to use this reporter.

Option 1) Run reviewdog from GitHub Actions w/ secrets.GITHUB_TOKEN

Example:.github/workflows/reviewdog.yml

-name:Run reviewdogenv:REVIEWDOG_GITHUB_API_TOKEN:${{ secrets.GITHUB_TOKEN }}run:|    golint ./... | reviewdog -f=golint -reporter=github-pr-check

SeeGitHub Actions section too. You can also use publicreviewdog GitHub Actions.

Option 2) Install reviewdog GitHub Apps

reviewdog CLI sends a request to reviewdog GitHub App server and the server postresults as GitHub Checks, because Check API is only supported for GitHub App andGitHub Actions.

  1. Install reviewdog Apps.https://github.com/apps/reviewdog
  2. SetREVIEWDOG_TOKEN or run reviewdog CLI in trusted CI providers.
  • Get token fromhttps://reviewdog.app/gh/{owner}/{repo-name}.
$export REVIEWDOG_TOKEN="<token>"$ reviewdog -reporter=github-pr-check

Note: Token is not required if you run reviewdog in Travis or AppVeyor.

Caution

As described above, github-pr-check reporter with Option 2 depends onreviewdog GitHub App server.The server is running with haya14busa's pocket money for now and I may breakthings, so I cannot ensure that the server is running 24h and 365 days.

UPDATE: Started getting support byopencollectiveand GitHub sponsor.SeeSupporting reviewdog

You can use github-pr-review reporter or use run reviewdog under GitHub Actionsif you don't want to depend on reviewdog server.

Reporter: GitHub Checks (-reporter=github-check)

It's basically the same as-reporter=github-pr-check except it works not only forPull Request but also for commit.

sample comment outside diff

You can createreviewdog badge for this reporter.

Reporter: GitHub PullRequest review comment (-reporter=github-pr-review)

sample-comment.png

github-pr-review reporter reports results to GitHub PullRequest review commentsusing GitHub Personal API Access Token.GitHub Enterprise is supported too.

$export REVIEWDOG_GITHUB_API_TOKEN="<token>"$ reviewdog -reporter=github-pr-review

For GitHub Enterprise, set the API endpoint by an environment variable.

$export GITHUB_API="https://example.githubenterprise.com/api/v3/"$export REVIEWDOG_INSECURE_SKIP_VERIFY=true# set this as you need to skip verifying SSL

SeeGitHub Actions section too if you can use GitHubActions. You can also use public reviewdog GitHub Actions.

Reporter: GitHub Annotations (-reporter=github-annotations)

github-annotations uses the GitHub Actions annotation format to output errorsand warnings tostdout e.g.

::error line=11,col=41,file=app/index.md::[vale] reported by reviewdog 🐶%0A[demo.Spelling] Did you really mean 'boobarbaz'?%0A%0ARaw Output:%0A{"message": "[demo.Spelling] Did you really mean 'boobarbaz'?", "location": {"path": "app/index.md", "range": {"start": {"line": 11, "column": 41}}}, "severity": "ERROR"}

This reporter requires a valid GitHub API token to generate a diff, but will notuse the token to report errors.

Reporter: GitHub PR Annotations (-reporter=github-pr-annotations)

Same asgithub-annotations but only works for Pull Requests.

Reporter: GitLab MergeRequest discussions (-reporter=gitlab-mr-discussion)

gitlab-mr-discussion sample

Required GitLab version: >= v10.8.0

gitlab-mr-discussion reporter reports results to GitLab MergeRequest discussions usingGitLab Personal API Access token.Get the token withapi scope fromhttps://gitlab.com/profile/personal_access_tokens.

$export REVIEWDOG_GITLAB_API_TOKEN="<token>"$ reviewdog -reporter=gitlab-mr-discussion

TheCI_API_V4_URL environment variable, defined automatically by Gitlab CI (v11.7 onwards), will be used to find out the Gitlab API URL.

Alternatively,GITLAB_API can also be defined, in which case it will take precedence overCI_API_V4_URL.

$export GITLAB_API="https://example.gitlab.com/api/v4"$export REVIEWDOG_INSECURE_SKIP_VERIFY=true# set this as you need to skip verifying SSL

Reporter: GitLab MergeRequest commit (-reporter=gitlab-mr-commit)

gitlab-mr-commit is similar togitlab-mr-discussion reporter but reports results to each commit in GitLab MergeRequest.

gitlab-mr-discussion is recommended, but you can use gitlab-mr-commit reporterif your GitLab version is under v10.8.0.

$export REVIEWDOG_GITLAB_API_TOKEN="<token>"$ reviewdog -reporter=gitlab-mr-commit

Reporter: Gerrit Change review (-reporter=gerrit-change-review)

gerrit-change-review reporter reports results to Gerrit Change using Gerrit Rest APIs.

The reporter supports Basic Authentication and Git-cookie based authentication for reporting results.

SetGERRIT_USERNAME andGERRIT_PASSWORD environment variables for basic authentication, and putGIT_GITCOOKIE_PATH for git cookie-based authentication.

$export GERRIT_CHANGE_ID=changeID$export GERRIT_REVISION_ID=revisionID$export GERRIT_BRANCH=master$export GERRIT_ADDRESS=http://<gerrit-host>:<gerrit-port>$ reviewdog -reporter=gerrit-change-review

Reporter: Bitbucket Code Insights Reports (-reporter=bitbucket-code-report)

bitbucket-code-reportbitbucket-code-annotations

bitbucket-code-report generates the annotatedBitbucket Code Insights report.

For now, only theno-filter mode is supported, so the whole project is scanned on every run.Reports are stored per commit and can be viewed per commit from Bitbucket Pipelines UI orin Pull Request. In the Pull Request UI affected code lines will be annotated in the diff,as well as you will be able to filter the annotations byThis pull request orAll.

If running fromBitbucket Pipelines, no additional configuration is needed (even credentials).If running locally or from some other CI system you would need to provide Bitbucket API credentials:

  • For Basic Auth you need to set the following env variables:BITBUCKET_USER andBITBUCKET_PASSWORD
  • For AccessToken Auth you need to setBITBUCKET_ACCESS_TOKEN
$export BITBUCKET_USER="my_user"$export BITBUCKET_PASSWORD="my_password"$ reviewdog -reporter=bitbucket-code-report

To post a report to the Bitbucket Server useBITBUCKET_SERVER_URL variable:

$export BITBUCKET_USER="my_user"$export BITBUCKET_PASSWORD="my_password"$export BITBUCKET_SERVER_URL="https://bitbucket.my-company.com"$ reviewdog -reporter=bitbucket-code-report

Supported CI services

Example:.github/workflows/reviewdog.yml

name:reviewdogon:[pull_request]jobs:reviewdog:name:reviewdogruns-on:ubuntu-lateststeps:# ...      -uses:reviewdog/action-setup@d8edfce3dd5e1ec6978745e801f9c50b5ef80252# v1.4.0with:reviewdog_version:latest# Optional. [latest,nightly,v.X.Y.Z]      -name:Run reviewdogenv:REVIEWDOG_GITHUB_API_TOKEN:${{ secrets.GITHUB_TOKEN }}run:|          reviewdog -reporter=github-pr-check -runners=golint,govet          # or          reviewdog -reporter=github-pr-review -runners=golint,govet
Example (github-check reporter):

.github/workflows/reviewdog

Onlygithub-check reporter can run on the push event too.

name:reviewdog (github-check)on:push:branches:      -masterpull_request:jobs:reviewdog:name:reviewdogruns-on:ubuntu-lateststeps:# ...      -name:Run reviewdogenv:REVIEWDOG_GITHUB_API_TOKEN:${{ secrets.GITHUB_TOKEN }}run:|          reviewdog -reporter=github-check -runners=golint,govet

Public Reviewdog GitHub Actions

You can use public GitHub Actions to start using reviewdog with ease! 🎉▶️ 🎉

... and more onGitHub Marketplace.

Missing actions? Check outreviewdog/action-template and create a new reviewdog action!

Please open a Pull Request to add your created reviewdog actions here ✨.I can also put your repositories under reviewdog org and co-maintain the actions.Example:action-tflint.

Graceful Degradation for Pull Requests from forked repositories

Graceful Degradation example

GITHUB_TOKEN for Pull Requests from a forked repository doesn't have writeaccess to Check API nor Review API due toGitHub Actionsrestriction.

Instead, reviewdog usesLogging commands of GitHubActionsto post results asannotationssimilar togithub-pr-check reporter.

Note that there is a limitation for annotations created by logging commands,such asmax # of annotations per run.You can check GitHub Actions log to see full results in such cases.

reviewdog badgereviewdog

Asgithub-check reporter support running on commit, we can create reviewdogGitHub Action badgeto check the result against master commit for example. 🎉

Example:

<!-- Replace <OWNER> and <REPOSITORY>. It assumes workflow name is "reviewdog" -->[![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)

Travis CI

Travis CI (-reporter=github-pr-check)

If you use -reporter=github-pr-check in Travis CI, you don't need to setREVIEWDOG_TOKEN.

Example:

install:  -mkdir -p ~/bin/ && export PATH="~/bin/:$PATH"  -curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/fd59714416d6d9a1c0692d872e38e7f8448df4fc/install.sh| sh -s -- -b ~/binscript:  -reviewdog -conf=.reviewdog.yml -reporter=github-pr-check

Travis CI (-reporter=github-pr-review)

Store GitHub API token bytravis encryption keys.

$ gem install travis$ travis encrypt REVIEWDOG_GITHUB_API_TOKEN=<token> --add env.global

Example:

env:global:    -secure:<token>install:  -mkdir -p ~/bin/ && export PATH="~/bin/:$PATH"  -curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/fd59714416d6d9a1c0692d872e38e7f8448df4fc/install.sh| sh -s -- -b ~/binscript:  ->-    golint ./... | reviewdog -f=golint -reporter=github-pr-review

Examples

Circle CI

StoreREVIEWDOG_GITHUB_API_TOKEN (orREVIEWDOG_TOKEN for github-pr-check) inEnvironment variables - CircleCI

.circleci/config.yml sample

version:2jobs:build:docker:      -image:golang:lateststeps:      -checkout      -run:curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/fd59714416d6d9a1c0692d872e38e7f8448df4fc/install.sh| sh -s -- -b ./bin      -run:go vet ./... 2>&1 | ./bin/reviewdog -f=govet -reporter=github-pr-review# Deprecated: prefer GitHub Actions to use github-pr-check reporter.      -run:go vet ./... 2>&1 | ./bin/reviewdog -f=govet -reporter=github-pr-check

GitLab CI

StoreREVIEWDOG_GITLAB_API_TOKEN inGitLab CI variable.

.gitlab-ci.yml sample

reviewdog:script:    -reviewdog -reporter=gitlab-mr-discussion# Or    -reviewdog -reporter=gitlab-mr-commit

Bitbucket Pipelines

No additional configuration is needed.

bitbucket-pipelines.yml sample

pipelines:default:    -step:name:Reviewdogimage:golangci/golangci-lint:v1.31-alpinescript:          -wget -O - -q https://raw.githubusercontent.com/reviewdog/reviewdog/fd59714416d6d9a1c0692d872e38e7f8448df4fc/install.sh |sh -s -- -b $(go env GOPATH)/bin          -golangci-lint run --out-format=line-number ./... | reviewdog -f=golangci-lint -reporter=bitbucket-code-report

Common (Jenkins, local, etc...)

You can use reviewdog to post review comments from anywhere with followingenvironment variables.

namedescription
CI_PULL_REQUESTPull Request number (e.g. 14)
CI_COMMITSHA1 for the current build
CI_REPO_OWNERrepository owner (e.g. "reviewdog" forhttps://github.com/reviewdog/errorformat)
CI_REPO_NAMErepository name (e.g. "errorformat" forhttps://github.com/reviewdog/errorformat)
CI_BRANCH[optional] branch of the commit
$export CI_PULL_REQUEST=14$export CI_REPO_OWNER=haya14busa$export CI_REPO_NAME=reviewdog$export CI_COMMIT=$(git rev-parse HEAD)

and set a token if required.

$ REVIEWDOG_TOKEN="<token>"$ REVIEWDOG_GITHUB_API_TOKEN="<token>"$ REVIEWDOG_GITLAB_API_TOKEN="<token>"

If a CI service doesn't provide information such as Pull Request ID - reviewdog can guess it by a branch name and commit SHA.Just pass the flagguess:

$ reviewdog -conf=.reviewdog.yml -reporter=github-pr-check -guess

Jenkins with GitHub pull request builder plugin

$export CI_PULL_REQUEST=${ghprbPullId}$export CI_REPO_OWNER=haya14busa$export CI_REPO_NAME=reviewdog$export CI_COMMIT=${ghprbActualCommit}$export REVIEWDOG_INSECURE_SKIP_VERIFY=true# set this as you need# To submit via reviewdog server using github-pr-check reporter$ REVIEWDOG_TOKEN="<token>" reviewdog -reporter=github-pr-check# Or, to submit directly via API using github-pr-review reporter$ REVIEWDOG_GITHUB_API_TOKEN="<token>" reviewdog -reporter=github-pr-review# Or, to submit directly via API using github-pr-check reporter (requires GitHub App Account configured)$ REVIEWDOG_SKIP_DOGHOUSE=true REVIEWDOG_GITHUB_API_TOKEN="<token>" reviewdog -reporter=github-pr-check

Exit codes

By default (-fail-level=none) reviewdog will return0 as exit code even if it finds errors.reviewdog will exit with code 1 with-fail-level=[any,info,warning,error] flag if it finds at least 1 issue with severity greater than or equal to the given level.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.

You can also use-level flag to configure default report revel.

Filter mode

reviewdog filter results by diff and you can control how reviewdog filter results by-filter-mode flag.Available filter modes are as below.

added (default)

Filter results by added/modified lines.

diff_context

Filter results by diff context. i.e. changed lines +-N lines (N=3 for example).

file

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.

nofilter

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.

-fail-on-error also works with any filter-mode and can catch all results from any linters withnofilter mode.

Example:

$ reviewdog -reporter=github-pr-review -filter-mode=nofilter -fail-on-error

Filter Mode Support Table

Note that not all reporters provide full support for filter mode due to API limitation.e.g.github-pr-review reporter usesGitHub ReviewAPI but this API don't support posting comments outside diff context,so reviewdog will useCheck annotation as fallback to post those comments [1].

-reporter \-filter-modeaddeddiff_contextfilenofilter
localOKOKOKOK
github-checkOKOKOKOK
github-pr-checkOKOKOKOK
github-pr-reviewOKOKPartially Supported [1]Partially Supported [1]
github-pr-annotationsOKOKOKOK
gitlab-mr-discussionOKOKOKPartially Supported [2]
gitlab-mr-commitOKPartially Supported [2]Partially Supported [2]Partially Supported [2]
gerrit-change-reviewOKOK? [3]OK? [3]Partially Supported? [2][3]
bitbucket-code-reportNO [4]NO [4]NO [4]OK
gitea-pr-reviewOKOKPartially Supported [2]Partially Supported [2]
  • [1] Report results that are outside the diff file with Check annotation as fallback if it's running in GitHub actions instead of Review API (comments). All results will be reported to console as well.
  • [2] Report results that are outside the diff file to console.
  • [3] It should work, but not been verified yet.
  • [4] Not implemented at the moment

Debugging

Use the-tee flag to show debug info.

reviewdog -filter-mode=nofilter -tee

Articles

🐦 Author

haya14busaGitHub followers

Contributors

Contributors

Supporting reviewdog

Become GitHub Sponsor foreach contributoror become a backer or sponsor fromopencollective.

Become a backer

Sponsor this project

  •  

[8]ページ先頭

©2009-2025 Movatter.jp