GithubHelp home page GithubHelp logo

isabella232 / revgrep Goto Github PK

View Code? Open in Web Editor NEW

This project forked from golangci/revgrep

0.0 0.0 0.0 62 KB

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

License: Apache License 2.0

Go 100.00%

revgrep's Introduction

Overview

Build Status Coverage Status GoDoc

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 in go vet on line 5, but go vet will show all warnings. Using revgrep, you can show only warnings for lines of code that have been changed (in this case, hiding line 6).

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

|& is shown above as many static analysis programs write to stderr, not stdout, |& combines both stderr and stdout. It could also be achieved with go 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 the go 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

revgrep's People

Contributors

bradleyfalzon avatar golangcidev avatar schallert avatar natefinch avatar rski avatar ernado avatar hydroflame avatar svilgelm avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.