Skip to content

Commit e74c8b1

Browse files
committed
refactor: remove sarif dependency and simplify version
1 parent 7d31ac3 commit e74c8b1

8 files changed

Lines changed: 7 additions & 149 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ concurrency:
3434
env:
3535
GO_VERSION: "1.26.3"
3636
GOPROXY: "https://proxy.golang.org,direct"
37-
GONOSUMCHECK: "github.com/GrayCodeAI/hawk/sarif"
38-
GONOSUMDB: "github.com/GrayCodeAI/hawk/sarif"
3937

4038
jobs:
4139
# -------------------------------------------------------------------------

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,6 @@ exclude = ["/admin/*", "/api/*"]
105105

106106
- Terminal (colored, human-readable)
107107
- JSON
108-
- SARIF (static analysis interchange)
109108
- JUnit XML (CI integration)
110109
- HTML report
111110
- Markdown
@@ -119,7 +118,7 @@ exclude = ["/admin/*", "/api/*"]
119118
with:
120119
url: https://staging.example.com
121120
fail-on: high
122-
format: sarif
121+
format: junit
123122
```
124123
125124
### CLI

ci_output.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import (
77
)
88

99
// CIOutput formats findings for CI/CD pipeline consumption.
10-
// Supports: GitHub Actions annotations, GitLab CI, SARIF, plain text.
10+
// Supports: GitHub Actions annotations, GitLab CI, plain text, JSON.
1111
type CIOutput struct {
12-
Format string // "github", "gitlab", "sarif", "text", "json"
12+
Format string // "github", "gitlab", "text", "json"
1313
}
1414

1515
// FormatFindings converts findings to CI-friendly output.

cmd/inspect-ci/main.go

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"time"
1414

1515
"github.com/GrayCodeAI/inspect"
16-
reportpkg "github.com/GrayCodeAI/inspect/internal/report"
1716
)
1817

1918
func main() {
@@ -33,7 +32,7 @@ func main() {
3332
flag.IntVar(&depth, "depth", 5, "Maximum crawl depth")
3433
flag.StringVar(&failOn, "fail-on", "high", "Minimum severity to fail")
3534
flag.IntVar(&concurrency, "concurrency", 10, "Concurrent workers")
36-
flag.StringVar(&format, "format", "terminal", "Output format: terminal, json, junit, sarif")
35+
flag.StringVar(&format, "format", "terminal", "Output format: terminal, json, junit")
3736
flag.StringVar(&timeout, "timeout", "5m", "Scan timeout")
3837
flag.StringVar(&outputFile, "output-file", "", "Write report to file")
3938
flag.Parse()
@@ -72,14 +71,8 @@ func main() {
7271
case "json":
7372
data, _ := json.MarshalIndent(report, "", " ")
7473
output = string(data)
75-
case "sarif":
76-
rd := toReportData(report)
77-
sarif, sErr := reportpkg.FormatSARIF(rd)
78-
if sErr != nil {
79-
fmt.Fprintf(os.Stderr, "error: sarif format: %v\n", sErr)
80-
os.Exit(1)
81-
}
82-
output = sarif
74+
case "junit":
75+
output = inspect.GenerateJUnit(report.Findings)
8376
default:
8477
output = formatTerminal(report)
8578
}
@@ -113,30 +106,6 @@ func main() {
113106
}
114107
}
115108

116-
func toReportData(r *inspect.Report) reportpkg.ReportData {
117-
var rd reportpkg.ReportData
118-
rd.Target = r.Target
119-
rd.CrawledURLs = r.CrawledURLs
120-
rd.Duration = r.Duration
121-
rd.Stats.BySeverity = make(map[string]int)
122-
for sev, count := range r.Stats.BySeverity {
123-
rd.Stats.BySeverity[sev.String()] = count
124-
}
125-
rd.Stats.ByCheck = r.Stats.ByCheck
126-
for _, f := range r.Findings {
127-
rd.Findings = append(rd.Findings, reportpkg.Finding{
128-
Check: f.Check,
129-
Severity: reportpkg.Severity(f.Severity),
130-
URL: f.URL,
131-
Element: f.Element,
132-
Message: f.Message,
133-
Fix: f.Fix,
134-
Evidence: f.Evidence,
135-
})
136-
}
137-
return rd
138-
}
139-
140109
func formatTerminal(r *inspect.Report) string {
141110
var b strings.Builder
142111
b.WriteString(fmt.Sprintf("Inspect: %s — %d pages, %d findings\n",

go.mod

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

go.sum

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

internal/report/sarif.go

Lines changed: 0 additions & 97 deletions
This file was deleted.

version.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@
22
//
33
// The Version variable is sourced at compile time from the VERSION file at
44
// the repo root — the single source of truth used by release tooling
5-
// (release-please, goreleaser), CI, and SARIF/JUnit/JSON output drivers.
5+
// (release-please, goreleaser), and CI.
66
package inspect
77

88
import (
99
_ "embed"
1010
"strings"
11-
12-
"github.com/GrayCodeAI/inspect/internal/report"
1311
)
1412

1513
//go:embed VERSION
@@ -18,9 +16,3 @@ var versionFile string
1816
// Version of the inspect library. Do not edit this variable directly — bump
1917
// the VERSION file at the repo root instead.
2018
var Version = strings.TrimSpace(versionFile)
21-
22-
func init() {
23-
// Propagate canonical version into the internal/report package so the
24-
// SARIF tool driver field reflects the real version.
25-
report.SetToolVersion(Version)
26-
}

0 commit comments

Comments
 (0)