Loading
Remove unused scope EE::Project.with_security_reports_stored
Summary
Removes the unused scope EE::Project.with_security_reports_stored from ee/app/models/ee/project.rb.
Removing it also leaves Vulnerabilities::Finding.scoped_project with no callers, so that scope is removed in the same MR as a cascade (see below).
Related to #542966 (closed)
Verification
This scope was verified as unused by:
-
keela --type scopesflagged it as unused - Grep search found no callers (only its own definition)
- Not used in scope chaining
- Not used in
merge()calls - Not used as
default_scopeor an association scope, and no symbol (:with_security_reports_stored) /senddispatch
Cascade Removals
Removing with_security_reports_stored caused this scope to become unused:
Vulnerabilities::Finding.scoped_project(ee/app/models/vulnerabilities/finding.rb) - its only caller was theEXISTS (?)subquery insidewith_security_reports_stored. The keela pre-push hook flagged it as newly unused, verified via grep (no production callers, no spec callers; the:scoped_projectmatches elsewhere are unrelatedlet(:scoped_project)test locals).
Metrics
Source File Complexity (flog)
| Metric | Before | After | Improvement |
|---|---|---|---|
ee/app/models/ee/project.rb flog total |
1795.0 | 1788.1 | -6.9 (0.4%) |
with_security_reports_stored scope flog |
6.9 | N/A | -6.9 removed |
ee/app/models/vulnerabilities/finding.rb flog total |
719.5 | 716.8 | -2.7 (0.4%) |
scoped_project scope flog (cascade) |
2.7 | N/A | -2.7 removed |
Spec File Complexity (flog)
| Metric | Before | After | Improvement |
|---|---|---|---|
| Spec file flog total | N/A | N/A | 0 (neither scope had spec coverage) |
| Spec block flog score | N/A | N/A | -0 removed |
Combined Flog Summary
| File | Flog Removed |
|---|---|
ee/app/models/ee/project.rb |
6.9 |
ee/app/models/vulnerabilities/finding.rb |
2.7 |
| Total | 9.6 |
Test Suite Impact
- Specs removed: 0 examples (neither scope had dedicated spec coverage)
- Spec file: none
- Time saved per run: 0.00 seconds
Estimated CI Savings
| Estimate | Pipelines/Month | Time Saved | Cost Saved/Month | Cost Saved/Year |
|---|---|---|---|---|
| Pessimistic | 15,000 | 0.00 hrs/month | $0.00 | $0.00 |
| Moderate | 30,000 | 0.00 hrs/month | $0.00 | $0.00 |
| Optimistic | 50,000 | 0.00 hrs/month | $0.00 | $0.00 |
Based on 0.00 seconds saved per pipeline × $0.03/minute (large runners: 3x cost factor on $10/1000 base minutes). Neither scope had spec coverage, so the value of this change is dead-code cleanup, not test-time reduction.
Files Modified
ee/app/models/ee/project.rb(scope removed - 1 line)ee/app/models/vulnerabilities/finding.rb(cascade scope removed - 1 line)scripts/lint/keela_baseline.yml(entry removed - 1 line)
Related
- Related to #542966 (closed) (Improve unused helper methods workflow)
- Part of dead code cleanup effort
- Scope was listed in
scripts/lint/keela_baseline.yml