-
Notifications
You must be signed in to change notification settings - Fork 123
Open
Labels
code-qualityCode style and quality improvementsCode style and quality improvementspriority: lowLow priority - nice to haveLow priority - nice to have
Milestone
Description
Summary
Several files are currently excluded from RuboCop metrics checks due to their complexity. These could be refactored to meet the standards while maintaining functionality.
Files to Refactor
lib/classifier/extensions/vector.rb
SV_decompmethod (46 lines, high complexity)- Contains nested loops for SVD algorithm
- Consider extracting helper methods
lib/classifier/lsi/content_node.rb
raw_vector_withmethod (28 lines, high complexity)- Multiple conditionals for GSL vs pure Ruby
- Consider strategy pattern or separate implementations
lib/classifier/lsi.rb
build_indexmethod (high ABC size)- Complex matrix operations
- Consider breaking into smaller methods
Goals
RuboCop Compliance
- Reduce method length to ≤25 lines
- Reduce ABC size to ≤30
- Reduce cyclomatic complexity to ≤10
Test Coverage
- Add unit tests for extracted helper methods
- Improve branch coverage for GSL vs native paths
- Target 95%+ line coverage for refactored files
RBS Type Signatures
- Add/update type signatures in
sig/for refactored methods - Ensure new helper methods have proper type annotations
- Validate with
rbs -I sig validate
Other Requirements
- Maintain 100% backward compatibility
- Keep performance characteristics
- Document complex algorithms inline
Approach
- Extract helper methods for repeated logic
- Use early returns to reduce nesting
- Consider strategy pattern for GSL vs native paths
- Add inline documentation for complex algorithms
- Write tests for new helper methods before refactoring
- Update RBS signatures as methods are extracted
Related
Follow-up from #56 (RuboCop integration)
Metadata
Metadata
Assignees
Labels
code-qualityCode style and quality improvementsCode style and quality improvementspriority: lowLow priority - nice to haveLow priority - nice to have