remove unused functions#35
Merged
Merged
Conversation
- Remove getDefaultConfig, mergeWithDefaults (never used) - Remove getFilesByType export (only used internally) - Clean up exports and tests close #32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Remove Unused Functions Following YAGNI Principle
📋 Summary
Removes unused functions and unnecessary exports from the config module, following YAGNI (You Aren't Gonna Need It) principles. This reduces API surface area, eliminates maintenance burden, and improves code clarity.
Closes #32
🎯 Problem
YAGNI Violations
The codebase contains code that violates YAGNI principles:
Unused Utility Functions
getDefaultConfig()- Only returns empty object{}, never actually usedmergeWithDefaults()- Complex deep merge utility that was never calledUnnecessary Public Exports
getFilesByType()- Exported fromcontext.loader.tsbut never imported externallyformatContextForAI()functionBusiness Impact
deepMerge) that serves no practical purpose✨ Solution
Remove Unused Functions
1. Removed
getDefaultConfig()andmergeWithDefaults()Why remove:
getDefaultConfig()only returned{}- no actual defaults existmergeWithDefaults()was never called anywhere in the codebasedeepMerge()utility (47 lines) was solving a problem that doesn't existBefore:
After:
// Removed - never used, all fields are optional2. Made
getFilesByType()InternalWhy change:
formatContextForAI()functionBefore:
After:
3. Cleaned Up Exports
Removed from
index.ts:getDefaultConfigmergeWithDefaultsgetFilesByType4. Removed Related Tests
getDefaultConfig()andmergeWithDefaults()getFilesByType()(now internal)🧪 Testing
Test Coverage
Verification
getDefaultConfig()never importedmergeWithDefaults()never importedgetFilesByType()only used internally🎯 Benefits
1. Reduced API Surface
Smaller public API is easier to understand and maintain. Developers see only what's actually used.
2. Eliminated Cognitive Overhead
Removed 47 lines of complex
deepMerge()logic that served no purpose. Code is simpler to understand.3. Reduced Maintenance Burden
Unused code no longer needs updates when dependencies change or during refactoring.
4. Clearer Intent
Internal functions are clearly marked as internal, preventing accidental external usage.
5. Better Documentation
Auto-generated docs no longer include unused exports, making it easier to find what matters.
📖 Code Examples
Before: Unused Complexity
After: Clean and Simple
Export Cleanup
Before (
index.ts):After (
index.ts):🔗 Related Documentation
📝 Design Decisions
Why Remove
getDefaultConfig()?{}, providing no valueWhy Remove
mergeWithDefaults()?deepMerge()utility (47 lines) for a problem that doesn't existWhy Make
getFilesByType()Internal?formatContextForAI()in same moduleWhy Remove Tests?
✅ Acceptance Criteria
🚀 Impact
Code Quality Metrics
deepMerge()logicRisk Assessment
💡 Lessons Learned
YAGNI Principle
This refactoring demonstrates the importance of YAGNI:
When to Remove Code
When to Keep Code