[dead-code] chore: remove dead functions — 3 functions removed#45277
Conversation
Remove unreachable StatVar methods Sum, Variance, and StdDev from pkg/stats/statvar.go. These functions had no callers outside of test files that exclusively tested them. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
🧠 Matt Pocock Skills Reviewer has completed the skills-based review. ✅ |
|
✅ Design Decision Gate 🏗️ completed the design decision gate check. No ADR enforcement needed: PR #45277 does not have the 'implementation' label and has 0 new lines of code in business logic directories (threshold: 100). |
|
✅ Test Quality Sentinel completed test quality analysis. No test files were added or modified in this PR. This is a dead code removal PR (3 functions + 3 tests deleted). Test Quality Sentinel skipped. |
|
|
There was a problem hiding this comment.
Pull request overview
Removes three purportedly unused statistical methods and their specification tests.
Changes:
- Removes
Sum,Variance, andStdDev. - Removes their public API tests.
Show a summary per file
| File | Description |
|---|---|
pkg/stats/statvar.go |
Removes three documented public methods. |
pkg/stats/spec_test.go |
Removes corresponding specification tests. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Medium
| // Sum returns the arithmetic sum of all observations, or 0 if none. | ||
| func (s *StatVar) Sum() float64 { return s.sum } | ||
|
|
||
| // Mean returns the arithmetic mean of all observations, or 0 if none. |
| return math.Sqrt(s.Variance()) | ||
| } | ||
|
|
||
| // SampleVariance returns the sample variance with Bessel's correction (divides |
There was a problem hiding this comment.
LGTM. Clean removal of three unused StatVar methods and their spec tests. Build and vet checks pass per the PR description.
🧵 Reviewed using Impeccable skills by Impeccable Skills Reviewer · 8.71 AIC · ⌖ 4.88 AIC · ⊞ 4.8K
There was a problem hiding this comment.
Skills-Based Review 🧠
Applied /codebase-design — clean removal of unused public API surface.
📋 Summary
No callers of Sum, Variance, or StdDev remain in the codebase. The removal is correct, the tests are removed in lockstep, and the verification checklist is complete.
Positive Highlights
- ✅ Dead code removed without collateral changes
- ✅ Tests deleted alongside the implementations
- ✅
SampleVariance/SampleStdDevequivalents remain, so the statistically correct variants are still available - ✅ Build, vet, fmt, and targeted tests all pass per the PR description
🧠 Reviewed using Matt Pocock's skills by Matt Pocock Skills Reviewer · 10.9 AIC · ⌖ 4.32 AIC · ⊞ 6.6K
Comment /matt to run again
🧪 Test Quality Sentinel Report✅ Test Quality Score: N/A — Dead Code Removal
Analysis Result:
Verdict✅ No test quality concerns. This is a straightforward dead code removal PR with no new test coverage to evaluate. Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
|
🎉 This pull request is included in a new release. Release: |
Summary
Removes three dead exported methods from
pkg/stats.StatVarand their corresponding spec tests. No logic changes; pure clean-up.Changes
pkg/stats/statvar.goSum(),Variance(),StdDev()methodspkg/stats/spec_test.goTestSpec_PublicAPI_Sum,TestSpec_PublicAPI_Variance,TestSpec_PublicAPI_StdDevDetails
Removed functions
Sum() float64— returned arithmetic sum of all observations.Variance() float64— returned population variance (N denominator:m2 / count).StdDev() float64— returned population standard deviation (sqrt(Variance())).The Bessel-corrected sample variants (
SampleVariance,SampleStdDev) are retained.API Impact
Breaking: any caller of
StatVar.Sum,StatVar.Variance, orStatVar.StdDevwill no longer compile. Per the commit message these methods were unused within the repository.Commits
eea319872chore: remove dead functions — 3 functions removed