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

Filters output from static analysis tools, showing only recently changed lines of code

License

NotificationsYou must be signed in to change notification settings

bradleyfalzon/revgrep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build StatusCoverage StatusGoDoc

revgrep is a CLI tool used to filter static analysis tools to only lines changed based on a commit reference.

Install

go get -u github.com/bradleyfalzon/revgrep/...

Usage

In the scenario below, a change was made causing a warning ingo vet on line 5, butgo vet will show all warnings.Usingrevgrep, you can show only warnings for lines of code that have been changed (in this case, hiding line 6).

[user@host dir (master)]$ go vetmain.go:5: missing argumentfor Sprintf("%s"): format reads arg 1, have only 0 argsmain.go:6: missing argumentfor Sprintf("%s"): format reads arg 1, have only 0 args[user@host dir (master)]$ go vet|& revgrepmain.go:5: missing argumentfor Sprintf("%s"): format reads arg 1, have only 0 args

|& is shown above as many static analysis programs write tostderr, notstdout,|& combines bothstderr andstdout. It could also be achieved withgo vet 2>&1 | revgrep.

revgrep CLI tool will return an exit status of 1 if any issues match, else it will return 0. Consider using${PIPESTATUS[0]} for the exit status of thego vet command in the above example.

Usage: revgrep [options] [from-rev] [to-rev]from-rev filters issues to lines changed since (and including) this revision  to-rev filters issues to lines changed since (and including) this revision, requires <from-rev>  If no revisions are given, and there are unstaged changes or untracked files, only those changes are shown  If no revisions are given, and there are no unstaged changes or untracked files, only changes in HEAD~ are shown  If from-rev is given and to-rev is not, only changes between from-rev and HEAD are shown.    -d    Show debug output      -regexp string              Regexp to match path, line number, optional column number, and message

Other Examples

Issues between branches:

[user@host dir (feature/branch)]$ go vet|& revgrep master

Issues since last push:

[user@host dir (master)]$ go vet|& revgrep origin/master

About

Filters output from static analysis tools, showing only recently changed lines of code

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp