fix: resolve RuboCop Style/OneClassPerFile violations#154
Conversation
Newer RuboCop versions enforce Style/OneClassPerFile which flags: - Extension files patching multiple stdlib classes (Vector, Matrix) - LSI module structure - Test files with multiple test classes These are legitimate patterns for this codebase. Add exclusions for extension files and test directories. Also fix Style/PredicateWithKind in lsi_test.rb using the preferred all?(Numeric) syntax.
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Greptile SummaryThis PR fixes a failing lint job by adding targeted
Confidence Score: 5/5Two-file change: a config exclusion addition and a single-line test assertion rewrite — both safe to merge. The No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[rubocop run] --> B{File in AllCops Exclude?}
B -- yes --> Z[Skip file]
B -- no --> C{Style/OneClassPerFile}
C --> D{File matches new Exclude?}
D -- yes: lib/classifier/extensions/vector.rb --> Z
D -- yes: lib/classifier/lsi.rb --> Z
D -- yes: test/**/* --> Z
D -- no --> E[Enforce one class per file]
E --> F{Violation found?}
F -- yes --> G[Report offense]
F -- no --> H[Pass]
Reviews (1): Last reviewed commit: "fix: resolve RuboCop Style/OneClassPerFi..." | Re-trigger Greptile |
Summary
Style/OneClassPerFileexclusions for extension files and testsStyle/PredicateWithKindoffense usingall?(Numeric)syntaxFixes the lint job that's been failing on master since March 2026 due to newer RuboCop versions enforcing
Style/OneClassPerFile.The excluded patterns are legitimate:
lib/classifier/extensions/vector.rb- patches stdlibVectorandMatrixclasseslib/classifier/lsi.rb- module structure with nested definitionstest/**/*- test files commonly group related test classesTest plan
bundle exec rubocoppasses locally (47 files, no offenses)