refactor: implement self-registration pattern for language support#4
Merged
refactor: implement self-registration pattern for language support#4
Conversation
Refactor language filtering architecture to use self-registration pattern, eliminating hardcoded constants and improving maintainability. Domain layer changes: * CodeLanguage: Add self-registration system with @registry - Each language class declares extension (e.g., extension 'rb') - Auto-registers via ClassMethods.extension hook - Remove hardcoded LANGUAGE_EXTENSION hash - Add wanted_extensions public interface * Streamline wanted?/unwanted? predicates - Single source of truth in ClassMethods - Instance methods delegate to class methods - Remove WANTED_LANGUAGES constant from FileContributions * FilePath improvements - Add wanted? method for domain-level file filtering - Fix extension method with safe navigation for files without extensions - Add guard in language method to return Unknown for missing extensions Infrastructure layer changes: * LocalGitRepo: Remove utility function code smell - Remove hardcoded TEXT_FILES constant - Replace wanted_code_file? with Value::FilePath#wanted? - Infrastructure now queries domain for language support Benefits: - Single source of truth for language definitions - Self-documenting: languages declare their own extensions - Infrastructure automatically stays in sync with domain - Eliminates utility function smell (reek clean) - Domain logic properly encapsulated in domain layer Tests: All passing (35 runs, 132 assertions, 0 failures) Code quality: RuboCop and Reek clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
23b0159 to
7110f7b
Compare
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.
Refactor language filtering architecture to use self-registration pattern, eliminating hardcoded constants and improving maintainability.
Domain layer changes:
CodeLanguage: Add self-registration system with @registry
Streamline wanted?/unwanted? predicates
FilePath improvements
Infrastructure layer changes:
Benefits:
Tests: All passing (35 runs, 132 assertions, 0 failures)
Code quality: RuboCop and Reek clean
🤖 Generated with Claude Code