Repository navigation
feat(rules): add Ruby review rules - #1940
Conversation
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). |
|
Verified locally on
No issues from my side. AI disclosure: verification drafted with DeepSeek Harness ( |
|
Thanks for going through the Gemfile, Rakefile and gemspec cases too, @Walternater. |
wu21-web
left a comment
There was a problem hiding this comment.
Changes look good, but I think we can exclude some specs? I have some experience working with Homebrew, not much, but that are tests path that might follow a common pattern?
Merge when addressed.
|
Thanks @wu21-web. RSpec files are already skipped before rule lookup: What isn't excluded today is Minitest ( |
|
OK sure. I didn't see it in the diff, sorry! 🟡 Queued to merge. There are 4 pull requests ahead of this submission. |
|
@lizhengfeng101 thanks for taking the Ruby review rules. Ruby files, gemspecs, Gemfile and Rakefile now get their own precision-first rule doc. |
@mvanhorn Thanks for your contribution! This will be included in the next release, expected in the next few days. We'll also be releasing a more powerful open-code-review skill that has been in beta testing for a month. Going forward, maintainers will be able to get a report that explains cross-file behavioral changes with traceable evidence, while still keeping the line-by-line review comments. It is not just another summary of the comments, but an optional, independent investigation. It can surface changes that were missed by the standard review. By default, calling it won't trigger this investigation (it's opt-in). |
Good to hear, let us put this in the Announcements. |
Description
.rb(and.rake/.gemspec) are already on the extension allowlist, so Ruby files are reviewed, butsystem_rules.jsonhad no Ruby mapping. Those paths fell through todefault.md.This adds
internal/config/rules/rule_docs/ruby.mdand maps:**/*.{rb,rake}→ruby.md**/*.gemspec→ruby.md**/{Gemfile,Rakefile}→ruby.md**/*.erbis unchanged and still resolves toerb.md.The Ruby rule is a precision-first language doc in the same shape as the other built-in language rules. It defers formatting and naming to RuboCop / standardrb, then covers defect classes that actually change behaviour: nil/
false/Hash#[]vsfetch, frozen-string and argument mutation, broadrescue/ensure+return/ unboundedretry, ActiveRecord N+1 / raw SQL / mass assignment / callbacks /update_column,send/eval/Marshal.load/YAML.load/html_safe/system, and class-level mutable state plusreturnin a Proc versus a lambda. It does not change shared review prompts.Type of Change
How Has This Been Tested?
make testpasses locallymake test: 26 packagesok, 2735--- PASS:lines, 0--- FAIL:lines (LC_ALL=C go test -v -race -count=1).go test ./internal/config/...: 5 packagesok(allowlist, rules, template, testconnection, toolsconfig).make check: license-check, english-check,gofmt -s -w .,go vet— passed.gofmt -l .produced no paths.go vet ./internal/config/...clean.make buildproduced./dist/opencodereview.Resolve rows added for
app/models/user.rb,lib/tasks/cleanup.rake,mygem.gemspec,Gemfile,Rakefile,lib/Rakefile, andapp/views/users/show.html.erb. Load-bearing check: the three Rubypath_rule_mapentries were removed andTestResolve_DefaultRulesfailed on all six Ruby paths (they resolved to default.mdCorrectness);app/views/users/show.html.erbstill passed onerb.md. Restoring the map madeTestResolve_DefaultRules,TestSystemRulesIntegrity, andTestReviewRulesGuide*pass again.Manual: binaries from upstream
main(d77d70b) and this branch in a scratch repo.--previewlists files; it does not print the per-file rule body. Rule bodies were inspected withocr rules check.Not run: a live review that calls a model,
make coverage, or a full Rails application beyond the four scratch paths.Checklist
go fmt,go vet)AI disclosure: written with AI assistance (Cursor, grok-4.6); the need, scope and review are mine.
Related Issues
No existing issue tracks Ruby-specific review rules.
Demo