Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds RuboCop with rubocop-minitest for consistent code style and automated linting in CI. The changes include adding RuboCop gems, configuring style rules, auto-correcting 151 style offenses across test and library files, and adding a lint job to the CI workflow.
Key changes:
- Added RuboCop configuration excluding legacy files and complex algorithms from metrics checks
- Auto-corrected style offenses including string literals, assertion styles, and code formatting
- Added
respond_to_missing?method to Bayes class to complementmethod_missing
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Gemfile | Added rubocop and rubocop-minitest gems to development group |
| .rubocop.yml | Created RuboCop configuration with project-specific rules and exclusions |
| .github/workflows/ruby.yml | Added lint job to CI workflow running RuboCop on Ruby 3.3 |
| lib/classifier/bayes.rb | Added respond_to_missing? method and optimized classify method |
| lib/classifier/lsi.rb | Updated block parameter syntax and fixed operator precedence in array slicing |
| lib/classifier/extensions/word_hash.rb | Fixed escaped character in string literal |
| lib/classifier/extensions/vector.rb | Updated block parameter syntax and fixed operator precedence |
| test/test_helper.rb | Changed $: to $LOAD_PATH and updated string concatenation |
| test/lsi/lsi_test.rb | Replaced assert/refute with predicate assertions and assert_operator |
| test/extensions/word_hash_test.rb | Changed double quotes to single quotes and reordered assert arguments |
| test/bayes/bayesian_test.rb | Updated assertion styles and added blank lines for readability |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
a8eaa42 to
2f9e2ab
Compare
Add RuboCop with rubocop-minitest for consistent code style: - Configure .rubocop.yml with project-specific rules - Exclude legacy bin/ and install.rb files - Allow complexity in mathematical algorithms (SVD, LSI) - Auto-correct 151 style offenses - Add respond_to_missing? to Bayes class - Add lint job to CI workflow Style improvements applied: - Consistent single quotes for strings - Proper spacing and indentation - Modern Ruby idioms (anonymous block forwarding) - Minitest assertion best practices Fixes #56
2f9e2ab to
ab15de8
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.
Summary
Add RuboCop with rubocop-minitest for consistent code style and automated linting in CI.
Changes
rubocopandrubocop-minitestgems.rubocop.ymlwith project-specific configurationrespond_to_missing?to Bayes class (fixes RuboCop warning)Configuration Highlights
bin/andinstall.rbfilesFiles Excluded from Metrics
Some files contain complex mathematical algorithms that exceed standard metrics. These are tracked in #60 for future refactoring:
lib/classifier/extensions/vector.rb(SVD algorithm)lib/classifier/lsi/content_node.rb(vector operations)lib/classifier/lsi.rb(index building)CI
New
lintjob runs RuboCop on every push/PR.Fixes #56