Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8a62d15
fix tests running on Mac OS X
golangcidev May 8, 2018
dfd919b
make API
golangcidev May 8, 2018
d9c87f5
add --relative to git diff
golangcidev May 26, 2018
8a5b416
fix gopherci suggestions
golangcidev May 28, 2018
7f46a04
use long form of git ls-files --others
rski Aug 7, 2018
47e4fa1
don't take gitignored files into account
rski Aug 7, 2018
276a5c0
Merge pull request #1 from rski/master
Aug 12, 2018
6e8fe4b
Use bufio.Reader to handle large git histories
schallert Feb 18, 2020
29bbd2e
build up long lines if hit prefix
schallert Feb 18, 2020
d2524e8
don't process long lines
schallert Feb 18, 2020
cd28932
Merge pull request #4 from schallert/schallert/large_input
ernado Feb 8, 2021
67a810d
add flag to report changes anywhere in changed files
natefinch Sep 29, 2021
7b16880
early return
natefinch Sep 30, 2021
c22e500
Merge pull request #6 from natefinch/natefinch/wholefiles
SVilgelm Sep 30, 2021
f795587
chore: update Go version
ldez Jul 31, 2022
de67110
chore: update tests
ldez Jul 31, 2022
718b653
chore: add Makefile and linter configuration
ldez Jul 31, 2022
11f174f
chore: use GitHub Actions
ldez Jul 31, 2022
817ce76
docs: cleanup readme
ldez Jul 31, 2022
224990c
chore: apply linter
ldez Jul 31, 2022
731d42a
chore: windows support
ldez Jul 31, 2022
dac327f
fix: ignore color on diff
ldez Aug 4, 2022
745bb2f
fix: ensure that a commit reference is always taken as a commit refer…
ldez Aug 4, 2022
66007ad
chore: update Go, and linter
ldez Sep 2, 2023
358f9e2
fix: force use of default diff (#7)
dan-smetana Sep 2, 2023
02be60d
fix: diff with --default-prefix
ldez Oct 23, 2023
415fa50
fix: git version on Windows
ldez Oct 23, 2023
be6d820
chore: update Go, CI, and linter
ldez Apr 9, 2024
c18688b
fix: improve git diff errors
ldez Apr 9, 2024
4d9d983
docs: update install section
ldez Apr 9, 2024
03b3134
chore: update linter, and workflow
ldez Jan 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Main

on:
push:
branches:
- master
- main
pull_request:

jobs:

main:
name: Main Process
runs-on: ubuntu-latest
env:
GO_VERSION: stable
GOLANGCI_LINT_VERSION: v1.63.4
CGO_ENABLED: 0

steps:

- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Check and get dependencies
run: |
go mod tidy
git diff --exit-code go.mod
git diff --exit-code go.sum

# https://golangci-lint.run/usage/install#other-ci
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }}
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin ${GOLANGCI_LINT_VERSION}

- name: Make
run: make
31 changes: 31 additions & 0 deletions .github/workflows/go-cross.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Go Matrix

on:
push:
branches:
- master
- main
pull_request:

jobs:

cross:
name: Go
runs-on: ${{ matrix.os }}
env:
CGO_ENABLED: 0

strategy:
matrix:
go-version: [ stable, oldstable ]
os: [ubuntu-latest, macos-latest, windows-latest]

steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Test
run: go test -v -cover ./...

71 changes: 71 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
linters:
enable-all: true
disable:
- exportloopref # deprecated
- cyclop # duplicate of gocyclo
- sqlclosecheck # not relevant (SQL)
- rowserrcheck # not relevant (SQL)
- dupl
- lll
- nestif
- mnd
- err113
- nlreturn
- wsl
- exhaustive
- exhaustruct
- tparallel
- testpackage
- paralleltest
- forcetypeassert
- varnamelen
- prealloc # false-positives
- nonamedreturns
- nilerr
- depguard

linters-settings:
govet:
enable-all: true
disable:
- fieldalignment
gocyclo:
min-complexity: 30 # 30 by default (but we recommend 10-20)
goconst:
min-len: 3
min-occurrences: 3
misspell:
locale: US
funlen:
lines: -1
statements: 80 # default 40
gocognit:
min-complexity: 65 # default 30
gofumpt:
extra-rules: true
godox:
keywords:
- FIXME
gosec:
excludes:
- G115 # integer overflow conversion

issues:
exclude-use-default: false
max-issues-per-linter: 0
max-same-issues: 0
exclude:
- 'ST1000: at least one file in a package should have a package comment'
exclude-rules:
- path: (.+)_test.go
linters:
- funlen
- goconst
- gosec
- maintidx
- path: cmd/revgrep/main.go
linters:
- forbidigo

run:
timeout: 2m
7 changes: 0 additions & 7 deletions .travis.yml

This file was deleted.

12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.PHONY: clean lint lint-fix test

default: lint test

test:
go test -v -cover ./...

lint:
golangci-lint run

lint-fix:
golangci-lint run --fix
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
# Overview

[![Build Status](https://travis-ci.org/bradleyfalzon/revgrep.svg?branch=master)](https://travis-ci.org/bradleyfalzon/revgrep) [![Coverage
Status](https://coveralls.io/repos/github/bradleyfalzon/revgrep/badge.svg?branch=master)](https://coveralls.io/github/bradleyfalzon/revgrep?branch=master) [![GoDoc](https://godoc.org/github.com/bradleyfalzon/revgrep?status.svg)](https://godoc.org/github.com/bradleyfalzon/revgrep)

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

# Install

```bash
go get -u github.com/bradleyfalzon/revgrep/...
go install github.com/golangci/revgrep/cmd/revgrep@latest
```

# Usage
Expand Down
5 changes: 3 additions & 2 deletions cmd/revgrep/main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// Package main a CLI tool used to filter static analysis tools to only lines changed based on a commit reference.
package main

import (
"flag"
"fmt"
"os"

"github.com/bradleyfalzon/revgrep"
"github.com/golangci/revgrep"
)

func main() {
Expand Down Expand Up @@ -38,7 +39,7 @@ func main() {

issues, err := checker.Check(os.Stdin, os.Stderr)
if err != nil {
fmt.Fprintln(os.Stderr, err)
_, _ = fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
if len(issues) > 0 {
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/golangci/revgrep

go 1.21
Empty file added go.sum
Empty file.
Loading