Skip to content

Commit f570449

Browse files
authored
chore: sync lint config and review code updates
1 parent 026e511 commit f570449

20 files changed

Lines changed: 112 additions & 74 deletions

.DS_Store

-6 KB
Binary file not shown.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@
88
.claude/
99
.codegraph/
1010
coverage.out
11+
12+
# macOS
13+
.DS_Store

.golangci.yml

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,53 @@ version: "2"
33
linters:
44
default: none
55
enable:
6+
- errcheck
67
- govet
78
- ineffassign
8-
- nilerr
9+
- staticcheck
10+
- unused
911
- misspell
12+
- gocritic
13+
- unconvert
14+
- whitespace
15+
- bodyclose
16+
- noctx
17+
- nilerr
18+
settings:
19+
errcheck:
20+
check-type-assertions: true
21+
check-blank: false
22+
gocritic:
23+
enabled-tags:
24+
- diagnostic
25+
- performance
26+
disabled-checks:
27+
- hugeParam
28+
- rangeValCopy
29+
- appendAssign
30+
# appendCombine hurts readability when each appended item is a
31+
# documented struct literal (see registerBuiltinChecks).
32+
- appendCombine
33+
staticcheck:
34+
# QF1001 (De Morgan's law) is disabled: !(a || b) reads more clearly
35+
# than the rewritten !a && !b in this codebase.
36+
checks: ["all", "-SA1019", "-ST1003", "-QF1001"]
37+
exclusions:
38+
presets:
39+
- comments
40+
- std-error-handling
41+
rules:
42+
- path: _test\.go
43+
linters:
44+
- errcheck
45+
- gocritic
46+
- noctx
47+
- bodyclose
48+
# git.go shells out to short-lived local `git` commands; threading a
49+
# context through these helpers adds no practical cancellation value.
50+
- path: internal/context/git\.go
51+
linters:
52+
- noctx
1053

1154
issues:
1255
max-issues-per-linter: 0

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
3232
linguist hints (collapse `go.sum` in PR diffs).
3333
- `.editorconfig` — UTF-8, LF, final newline, trim trailing whitespace,
3434
tabs for Go, 2-space indent for YAML/JSON/TOML.
35-
- `.github/dependabot.yml` — weekly `gomod` and `github-actions`
36-
updates.
3735
- `.github/PULL_REQUEST_TEMPLATE.md` — Summary / Changes / Review-
3836
quality impact (eval-set numbers) / Testing / Checklist.
3937
- `.github/ISSUE_TEMPLATE/bug_report.yml` — structured bug report

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<strong>AI-powered code review for diffs</strong>
55
</p>
66
<p align="center">
7-
<a href="https://golang.org/"><img src="https://img.shields.io/badge/Go-1.23+-00ADD8?style=flat-square&logo=go&logoColor=white" alt="Go"></a>
7+
<a href="https://golang.org/"><img src="https://img.shields.io/badge/Go-1.26+-00ADD8?style=flat-square&logo=go&logoColor=white" alt="Go"></a>
88
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue?style=flat-square" alt="License"></a>
99
<a href="https://github.com/GrayCodeAI/sight/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/GrayCodeAI/sight/ci.yml?style=flat-square&label=tests" alt="CI"></a>
1010
</p>
@@ -61,7 +61,7 @@ type Provider interface {
6161
go get github.com/GrayCodeAI/sight@latest
6262
```
6363

64-
Requires Go 1.23+.
64+
Requires Go 1.26+.
6565

6666
## Contributing
6767

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ We follow [coordinated vulnerability disclosure](https://en.wikipedia.org/wiki/C
4444

4545
## Security practices in this repo
4646

47-
- **Dependency monitoring:** automated via Dependabot (see
48-
`.github/dependabot.yml`).
47+
- **Dependency monitoring:** vulnerable dependencies are detected by
48+
`govulncheck`, which runs on every CI build (see "Vulnerability scanning").
4949
- **Static analysis:** `golangci-lint` / `ruff` / `mypy` enforced in CI.
5050
- **Vulnerability scanning:** `govulncheck` (Go) / `pip-audit` (Python) run
5151
on every CI build.

autofix_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func TestExtractRelevantDiff_LineWindowExtraction(t *testing.T) {
160160
b.WriteString("diff --git a/big.go b/big.go\n--- a/big.go\n+++ b/big.go\n")
161161
b.WriteString("@@ -1,20 +1,20 @@\n")
162162
for i := 1; i <= 20; i++ {
163-
b.WriteString(fmt.Sprintf(" line %d context\n", i))
163+
fmt.Fprintf(&b, " line %d context\n", i)
164164
}
165165
b.WriteString("+added line\n")
166166

@@ -189,7 +189,7 @@ func TestExtractRelevantDiff_Truncation(t *testing.T) {
189189
b.WriteString("diff --git a/big.go b/big.go\n--- a/big.go\n+++ b/big.go\n")
190190
b.WriteString("@@ -1,50 +1,50 @@\n")
191191
for i := 1; i <= 50; i++ {
192-
b.WriteString(fmt.Sprintf(" this is a long context line number %d with extra padding text to make it longer\n", i))
192+
fmt.Fprintf(&b, " this is a long context line number %d with extra padding text to make it longer\n", i)
193193
}
194194

195195
result := extractRelevantDiff(b.String(), "big.go", 25)

checks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ func parseFrontmatter(check *CustomCheck, fm string) {
182182
}
183183
}
184184
case "enabled":
185-
check.Enabled = strings.ToLower(value) != "false"
185+
check.Enabled = !strings.EqualFold(value, "false")
186186
}
187187
}
188188
}

dedup.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -192,11 +192,7 @@ func buildReason(rep Finding, dupes []Finding, config DedupConfig) string {
192192
parts = append(parts, "same file")
193193
}
194194

195-
if len(dupes) == 1 {
196-
parts = append(parts, "similar concern/message text")
197-
} else {
198-
parts = append(parts, "similar concern/message text")
199-
}
195+
parts = append(parts, "similar concern/message text")
200196

201197
if rep.File != "" && len(dupes) > 0 && dupes[0].File == rep.File {
202198
parts = append(parts, "within line distance threshold")

describe.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,12 @@ func buildDescribePrompt(files []diff.File, maxTokens int) string {
7979

8080
for _, f := range files {
8181
prefix := ""
82-
if f.Added {
82+
switch {
83+
case f.Added:
8384
prefix = " (new)"
84-
} else if f.Deleted {
85+
case f.Deleted:
8586
prefix = " (deleted)"
86-
} else if f.Renamed {
87+
case f.Renamed:
8788
prefix = " (renamed from " + f.OldPath + ")"
8889
}
8990
b.WriteString("- " + f.Path + prefix + "\n")

0 commit comments

Comments
 (0)