• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

opendefensecloud / solution-arsenal / 29322075672
81%

Build:
DEFAULT BRANCH: main
Ran 14 Jul 2026 09:51AM UTC
Jobs 1
Files 65
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

14 Jul 2026 09:32AM UTC coverage: 81.115% (-0.1%) from 81.228%
29322075672

push

github

web-flow
fix(discovery): use strings.Cut to strip digest algorithm prefix (#694)

## What
Swap the manual `strings.Index` + slice in `SanitizeDigestLabel` for
`strings.Cut`.

## Why
Small cleanup while getting familiar with the codebase -> `strings.Cut`
is the standard library's purpose-built helper for exactly this
split-on-separator pattern, so there's no need to hand-roll it with an
index lookup

## Testing
No behavior change. Ran the existing `SanitizeDigestLabel` specs in
`helpers_test.go` (prefix stripping, sha512 prefix, empty input,
truncation, realistic sha256 digest), all 6 pass unchanged

I lso ran the wider `pkg/discovery/...` suite

```
Will run 6 of 28 specs
------------------------------
SanitizeDigestLabel should strip the algorithm prefix
/pkg/discovery/helpers_test.go:52
• [0.000 seconds]
------------------------------
SanitizeDigestLabel should strip sha512 prefix
/pkg/discovery/helpers_test.go:56
• [0.000 seconds]
------------------------------
SanitizeDigestLabel should return empty string for empty input
/pkg/discovery/helpers_test.go:60
• [0.000 seconds]
------------------------------
SanitizeDigestLabel should truncate to 63 characters
/pkg/discovery/helpers_test.go:64
• [0.000 seconds]
------------------------------
SanitizeDigestLabel should return hex as-is when no prefix and under 63 chars
/pkg/discovery/helpers_test.go:70
• [0.000 seconds]
------------------------------
SanitizeDigestLabel should handle a realistic sha256 digest
/pkg/discovery/helpers_test.go:74
• [0.000 seconds]
------------------------------

Ran 6 of 28 Specs in 0.001 seconds
SUCCESS! -- 6 Passed | 0 Failed | 0 Pending | 22 Skipped
```

## Checklist
- [ ] Tests added/updated (Not needed, the existing unit tests in place
already cover this, and behavior doesn't change 😄
- [x] No breaking changes (or upgrade path documented above)
- [x] Readable commit history (squashed and cleaned up as desired)
- [x] AI code review considered and comments resolved

2 of 2 new or added lines in 1 file covered. (100.0%)

6 existing lines in 2 files now uncovered.

4334 of 5343 relevant lines covered (81.12%)

56.59 hits per line

Coverage Regressions

Lines Coverage ∆ File
4
74.0
-0.38% pkg/controller/target_controller.go
2
89.09
-1.82% pkg/discovery/runner.go
Jobs
ID Job ID Ran Files Coverage
1 29322075672.1 14 Jul 2026 09:51AM UTC 65
81.12
GitHub Action Run
Source Files on build 29322075672
  • Tree
  • List 65
  • Changed 3
  • Source Changed 1
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #29322075672
  • 1bf1856e on github
  • Prev Build on main (#29319442348)
  • Next Build on main (#29422471579)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc