Skip to content

Commit dee54a4

Browse files
committed
feat: add new issues.new-from-merge-base option
1 parent 980a911 commit dee54a4

File tree

6 files changed

+16
-4
lines changed

6 files changed

+16
-4
lines changed

.golangci.next.reference.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4043,6 +4043,10 @@ issues:
40434043
# Default: false
40444044
new: true
40454045

4046+
# Show only new issues created after the best common ancestor (merge-base against HEAD).
4047+
# Default: ""
4048+
new-from-merge-base: main
4049+
40464050
# Show only new issues created after git revision `REV`.
40474051
# Default: ""
40484052
new-from-rev: HEAD

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ require (
4848
github.com/golangci/gofmt v0.0.0-20250106114630-d62b90e6713d
4949
github.com/golangci/misspell v0.6.0
5050
github.com/golangci/plugin-module-register v0.1.1
51-
github.com/golangci/revgrep v0.7.0
51+
github.com/golangci/revgrep v0.8.0
5252
github.com/golangci/unconvert v0.0.0-20240309020433-c5143eacb3ed
5353
github.com/gordonklaus/ineffassign v0.1.0
5454
github.com/gostaticanalysis/forcetypeassert v0.1.0

go.sum

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jsonschema/golangci.next.jsonschema.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4081,6 +4081,10 @@
40814081
"type": "boolean",
40824082
"default": false
40834083
},
4084+
"new-from-merge-base": {
4085+
"description": "Show only new issues created after the best common ancestor (merge-base against HEAD).",
4086+
"type": "string"
4087+
},
40844088
"new-from-rev": {
40854089
"description": "Show only new issues created after this git revision.",
40864090
"type": "string"

pkg/config/issues.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ type Issues struct {
118118
UniqByLine bool `mapstructure:"uniq-by-line"`
119119

120120
DiffFromRevision string `mapstructure:"new-from-rev"`
121+
DiffFromMergeBase string `mapstructure:"new-from-merge-base"`
121122
DiffPatchFilePath string `mapstructure:"new-from-patch"`
122123
WholeFiles bool `mapstructure:"whole-files"`
123124
Diff bool `mapstructure:"new"`

pkg/result/processors/diff.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var _ Processor = (*Diff)(nil)
2727
type Diff struct {
2828
onlyNew bool
2929
fromRev string
30+
fromMergeBase string
3031
patchFilePath string
3132
wholeFiles bool
3233
patch string
@@ -36,6 +37,7 @@ func NewDiff(cfg *config.Issues) *Diff {
3637
return &Diff{
3738
onlyNew: cfg.Diff,
3839
fromRev: cfg.DiffFromRevision,
40+
fromMergeBase: cfg.DiffFromMergeBase,
3941
patchFilePath: cfg.DiffPatchFilePath,
4042
wholeFiles: cfg.WholeFiles,
4143
patch: os.Getenv(envGolangciDiffProcessorPatch),
@@ -47,7 +49,7 @@ func (*Diff) Name() string {
4749
}
4850

4951
func (p *Diff) Process(issues []result.Issue) ([]result.Issue, error) {
50-
if !p.onlyNew && p.fromRev == "" && p.patchFilePath == "" && p.patch == "" {
52+
if !p.onlyNew && p.fromRev == "" && p.fromMergeBase == "" && p.patchFilePath == "" && p.patch == "" {
5153
return issues, nil
5254
}
5355

@@ -68,6 +70,7 @@ func (p *Diff) Process(issues []result.Issue) ([]result.Issue, error) {
6870
checker := revgrep.Checker{
6971
Patch: patchReader,
7072
RevisionFrom: p.fromRev,
73+
MergeBase: p.fromMergeBase,
7174
WholeFiles: p.wholeFiles,
7275
}
7376

0 commit comments

Comments
 (0)