Remove unused scope DesignManagement::Design.for_reference

Summary

Removes the unused scope DesignManagement::Design.for_reference from app/models/design_management/design.rb.

This was a pre-fetching scope that eager-loaded the associations needed to build a design reference via to_reference. It had no production callers; the only reference in the entire codebase was a single N+1 guard spec that exercised the scope directly.

Related to #542966 (closed)

Verification

This scope was verified as unused by:

  • keela --type scopes flagged it as unused
  • Grep search found no callers (only word-boundary match for for_reference across app/ lib/ ee/app/ ee/lib/ was the scope definition itself)
  • Not used in scope chaining
  • Not used in merge() calls
  • Not used as default_scope or association scope, and not referenced via symbol/string, GraphQL resolver, finder, or dynamic dispatch (public_send/send)

Cascade Removals

None - this was a standalone removal.

Metrics

Source File Complexity (flog)

Metric Before After Improvement
File flog total 203.3 200.9 -2.4 (1.2%)
Scope flog score 2.4 N/A -2.4 removed

Spec File Complexity (flog)

Metric Before After Improvement
Spec file flog total 1571.7 1539.4 -32.3 (2.1%)
Spec block flog score 32.3 N/A -32.3 removed

Combined Flog Summary

File Flog Removed
app/models/design_management/design.rb 2.4
spec/models/design_management/design_spec.rb 32.3
Total 2.4 + 32.3 = 34.7

Test Suite Impact

  • Specs removed: 1 example
  • Spec file: spec/models/design_management/design_spec.rb
  • Time saved per run: 0.055 seconds

Estimated CI Savings

Estimate Pipelines/Month Time Saved Cost Saved/Month Cost Saved/Year
Pessimistic 15,000 0.23 hrs/month $0.41 $4.95
Moderate 30,000 0.46 hrs/month $0.83 $9.90
Optimistic 50,000 0.76 hrs/month $1.38 $16.50

Based on 0.055 seconds saved per pipeline × $0.03/minute (large runners: 3x cost factor on $10/1000 base minutes)

Files Modified

  • app/models/design_management/design.rb (scope removed - 3 lines, including 2-line comment)
  • spec/models/design_management/design_spec.rb (specs removed - 11 lines, 1 example)
  • scripts/lint/keela_baseline.yml (entry removed - 2 lines)
  • Related to #542966 (closed) (Improve unused helper methods workflow)
  • Part of dead code cleanup effort
  • Scope was listed in scripts/lint/keela_baseline.yml

Merge request reports

Loading
Loading