-
-
Notifications
You must be signed in to change notification settings - Fork 637
Unify Rubocop config #2153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Unify Rubocop config #2153
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughAdds a repository-level RuboCop config and makes package-level configs inherit from it, updates Prettier ignore behavior for Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Code Review: Unify RuboCop ConfigSummaryThis PR successfully consolidates the RuboCop configuration by extracting common settings to a root .rubocop.yml file, with react_on_rails/ and react_on_rails_pro/ inheriting via inherit_from. This is excellent DRY practice and eliminates configuration drift between the two packages. Strengths
Issues and Concerns1. ERB in RuboCop Config - Potential Compatibility IssueThe react_on_rails_pro/.rubocop.yml file contains ERB template code that dynamically generates exclusion patterns from git-ignored files. RuboCops ERB support is not guaranteed across all versions and executes shell commands during config parsing, which could be slow or error-prone. Recommendation: Consider using static exclusion patterns instead, or document why ERB is necessary and test with minimum supported RuboCop version. 2. Missing Root TargetRubyVersion ValidationThe root config sets TargetRubyVersion: 3.0. Please verify this matches the gemspecs required_ruby_version and the minimum CI configuration. 3. Configuration Path TestingPer CLAUDE.md guidance on Managing File Paths, configuration changes should be tested from all locations to ensure inheritance works correctly. Testing ChecklistBefore merging, please confirm:
Overall AssessmentVerdict: Approve with minor concerns This is a solid refactoring that improves maintainability. The ERB concern is the main issue to address. Once verified that ERB works reliably and the testing checklist is complete, this is good to merge. |
react_on_rails/.rubocop.yml
Outdated
| - 'lib/generators/react_on_rails/install_generator.rb' # Generator setup methods require comprehensive error handling | ||
|
|
||
| Metrics/CyclomaticComplexity: | ||
| Max: 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This remains here because it doesn't match exactly with RORP
react_on_rails/react_on_rails_pro/.rubocop.yml
Lines 15 to 16 in 0812423
| Metrics/CyclomaticComplexity: | |
| Max: 8 |
Metrics/ClassLength 150 here vs. 140 in RORP etc.)
0812423 to
b7cfbb2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
react_on_rails_pro/.rubocop.yml (1)
6-8: ERB-based dynamic git exclusions are clever but performance-sensitive; consider CI/CD implications.RuboCop processes .rubocop.yml as ERB before YAML parsing, allowing arbitrary Ruby code embedding. Lines 6-8 execute
git status --ignored --porcelainon each RuboCop invocation to exclude git-ignored files dynamically.Pros:
- Automatically respects
.gitignorewithout manual maintenanceCons:
- Runs a shell command on every RuboCop check (performance impact, especially in large repos)
- May fail in non-git environments or shallow clones
- Could behave unexpectedly in CI/CD if git state differs from local
Consider adding error handling or an environment variable escape hatch if git state is unavailable.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
.prettierignore(0 hunks).rubocop.yml(1 hunks)react_on_rails/.rubocop.yml(1 hunks)react_on_rails_pro/.prettierignore(1 hunks)react_on_rails_pro/.rubocop.yml(1 hunks)
💤 Files with no reviewable changes (1)
- .prettierignore
🚧 Files skipped from review as they are similar to previous changes (2)
- react_on_rails_pro/.prettierignore
- .rubocop.yml
🧰 Additional context used
🧠 Learnings (17)
📓 Common learnings
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to **/*.{rb,rake} : ALWAYS run `bundle exec rubocop` and fix ALL violations before every commit/push
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: The `react_on_rails_pro/` directory has its own Prettier/ESLint configuration and must be linted separately
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: ALWAYS let Prettier and RuboCop handle ALL formatting - never manually format
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: The `react_on_rails_pro/` directory has its own Prettier/ESLint configuration and must be linted separately
Applied to files:
react_on_rails_pro/.rubocop.ymlreact_on_rails/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to **/*.{rb,rake} : ALWAYS run `bundle exec rubocop` and fix ALL violations before every commit/push
Applied to files:
react_on_rails_pro/.rubocop.ymlreact_on_rails/.rubocop.yml
📚 Learning: 2025-04-26T21:55:55.874Z
Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files under `app-react16` directories are copied/moved to corresponding `/app` directories during the conversion process (removing the `-react16` suffix), which affects their relative import paths at runtime.
Applied to files:
react_on_rails_pro/.rubocop.ymlreact_on_rails/.rubocop.yml
📚 Learning: 2025-09-16T08:01:11.146Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntax `import * as style from './file.module.css'` rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.
Applied to files:
react_on_rails_pro/.rubocop.ymlreact_on_rails/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to /CHANGELOG.md : Update `/CHANGELOG.md` for user-visible changes (features, bug fixes, breaking changes, deprecations, performance improvements) to the open-source React on Rails gem and npm package
Applied to files:
react_on_rails_pro/.rubocop.ymlreact_on_rails/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to lib/react_on_rails/*.rb : Create RBS signature files for new Ruby files in `lib/react_on_rails/` by adding corresponding `.rbs` file in `sig/react_on_rails/`, adding to Steepfile, and validating before committing
Applied to files:
react_on_rails_pro/.rubocop.ymlreact_on_rails/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to sig/react_on_rails/**/*.rbs : In RBS type signature files, define type signatures that correspond to Ruby files in `lib/react_on_rails/`
Applied to files:
react_on_rails_pro/.rubocop.ymlreact_on_rails/.rubocop.yml
📚 Learning: 2025-02-12T16:38:06.537Z
Learnt from: Romex91
Repo: shakacode/react_on_rails PR: 1697
File: package-scripts.yml:28-28
Timestamp: 2025-02-12T16:38:06.537Z
Learning: The file `node_package/lib/ReactOnRails.full.js` is autogenerated during the build process and should not be present in the repository.
Applied to files:
react_on_rails_pro/.rubocop.ymlreact_on_rails/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Exclude `/coverage`, `/tmp`, `/gen-examples`, `/packages/react-on-rails/lib`, `/node_modules`, `/spec/dummy/node_modules`, `/spec/dummy/tmp`, `/spec/dummy/app/assets/webpack`, `/spec/dummy/log`, `/spec/dummy/e2e/playwright-report`, `/spec/dummy/test-results` from IDE indexing
Applied to files:
react_on_rails_pro/.rubocop.ymlreact_on_rails/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: ALWAYS let Prettier and RuboCop handle ALL formatting - never manually format
Applied to files:
react_on_rails_pro/.rubocop.ymlreact_on_rails/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to spec/dummy/e2e/playwright/**/*.spec.js : Use Rails helpers (`appFactories`, `appEval`) in Playwright tests instead of UI-based setup to leverage factory_bot and arbitrary Ruby code execution
Applied to files:
react_on_rails_pro/.rubocop.ymlreact_on_rails/.rubocop.yml
📚 Learning: 2025-02-13T14:29:49.267Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: spec/react_on_rails/utils_spec.rb:218-218
Timestamp: 2025-02-13T14:29:49.267Z
Learning: In RSpec tests, prefer using local variables over constants within test blocks to avoid constant redefinition warnings and maintain better test isolation.
Applied to files:
react_on_rails_pro/.rubocop.ymlreact_on_rails/.rubocop.yml
📚 Learning: 2025-02-18T13:08:01.477Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation is handled in deeper level calls of the React on Rails Pro codebase, so it doesn't need to be validated again in the `rsc_payload_react_component` helper method.
Applied to files:
react_on_rails/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Runtime type checking via RBS is enabled by default in test runs; disable with `DISABLE_RBS_RUNTIME_CHECKING=true` only for rapid development iterations
Applied to files:
react_on_rails/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to lib/tasks/*.rake : Rails::Engine rake tasks should NOT be explicitly loaded via `rake_tasks` block; instead, place them in `lib/tasks/*.rake` where Rails::Engine automatically loads them
Applied to files:
react_on_rails/.rubocop.yml
📚 Learning: 2024-10-08T20:53:47.076Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1622
File: spec/dummy/spec/rake/assets_precompile_rake_spec.rb:12-12
Timestamp: 2024-10-08T20:53:47.076Z
Learning: When stubbing environment variables in RSpec tests, use `before` and `after` hooks to ensure that the original values are restored after the tests, preventing any side effects on other tests. Example provided by justin808:
```ruby
describe "My test" do
before do
original_value = ENV["VARIABLE_NAME"]
allow(ENV).to receive(:[]).with("VARIABLE_NAME").and_return("stubbed_value")
end
after do
allow(ENV).to receive(:[]).with("VARIABLE_NAME").and_call_original
ENV["VARIABLE_NAME"] = original_value
end
it "tests something" do
# Your test code here
end
end
```
This practice ensures test isolation and reliability.
Applied to files:
react_on_rails/.rubocop.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: examples (3.4, latest)
- GitHub Check: rspec-package-tests (3.4, latest)
- GitHub Check: build-dummy-app-webpack-test-bundles
- GitHub Check: build-dummy-app-webpack-test-bundles
- GitHub Check: pro-lint-js-and-ruby
- GitHub Check: build
- GitHub Check: claude-review
🔇 Additional comments (2)
react_on_rails_pro/.rubocop.yml (1)
1-2: Root config inheritance established; verify same root file is properly configured.This file now inherits from the same root config via
../. rubocop.yml. Same verification needed asreact_on_rails/.rubocop.yml:
- Root config exists and contains all necessary cop definitions
- Root config appropriately handles the pro package's stricter or looser limits (e.g.,
Metrics/ClassLength: Max: 140here vs. 150 in the open-source package)- Performance benchmark file handling is configured
react_on_rails/.rubocop.yml (1)
1-2: Root RuboCop configuration is correctly set up and inheritance is working as expected.The root
.rubocop.ymlexists at the repository root and properly defines all necessary cop configurations includingLayout/LineLength(Max: 120),Style/StringLiterals, and others. The relative path../.rubocop.ymlinreact_on_rails/.rubocop.ymlcorrectly resolves to the root config. The spec/performance/bench.rb file will be included in RuboCop checks via the**/*.rbinclude pattern in the root config'sAllCopssection, so no additional configuration is needed.
Code ReviewSummaryThis PR successfully unifies RuboCop configuration across the monorepo by creating a root-level config that both ✅ Strengths
🔍 Issues Found1. Inconsistent AllCops Setting (Minor)Location: AllCops:
EnableNewCops: true # Note: "Enable" not "New"The root config uses Recommendation: Use 2. Missing Exclusion Pattern (Potential Bug)Location: Root The root config excludes Question: Does 3. TargetRubyVersion PrecisionLocation: Root TargetRubyVersion: 3.0The old 📋 Testing RecommendationsPer CLAUDE.md's requirements, before merging:
💡 Suggestions for Future
🎯 VerdictApprove with minor recommendations. The refactoring is sound and follows the monorepo structure correctly. The inconsistencies noted are minor and could be addressed in a follow-up if needed. The CI checks passing will confirm no regressions were introduced. Great work on reducing configuration duplication! 🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
react_on_rails_pro/.rubocop.yml (1)
7-9: Consider adding error handling or static fallback for the git-based ERB exclusions.The ERB pattern dynamically excludes git-ignored files, which is a valid and officially supported RuboCop feature. However, if the
git statuscommand fails (e.g., in shallow clones without git history, or CI environments without git), the entire RuboCop config fails to load with no graceful fallback. While this is unlikely in typical development or your current CI setup (GitHub Actions provides git), defensive coding would suggest either:
- Wrapping the backtick command with error handling:
<% \git status --ignored --porcelain 2>/dev/null`.lines.grep(/^!! /).each do |path| %>`- Or providing a static fallback list for environments where git is unavailable
The performance impact is minimal (git runs once per RuboCop invocation, not per file).
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
react_on_rails_pro/.rubocop.yml(1 hunks)
🧰 Additional context used
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to **/*.{rb,rake} : ALWAYS run `bundle exec rubocop` and fix ALL violations before every commit/push
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: The `react_on_rails_pro/` directory has its own Prettier/ESLint configuration and must be linted separately
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: ALWAYS let Prettier and RuboCop handle ALL formatting - never manually format
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: The `react_on_rails_pro/` directory has its own Prettier/ESLint configuration and must be linted separately
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to **/*.{rb,rake} : ALWAYS run `bundle exec rubocop` and fix ALL violations before every commit/push
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-09-16T08:01:11.146Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntax `import * as style from './file.module.css'` rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-04-26T21:55:55.874Z
Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files under `app-react16` directories are copied/moved to corresponding `/app` directories during the conversion process (removing the `-react16` suffix), which affects their relative import paths at runtime.
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to lib/react_on_rails/*.rb : Create RBS signature files for new Ruby files in `lib/react_on_rails/` by adding corresponding `.rbs` file in `sig/react_on_rails/`, adding to Steepfile, and validating before committing
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to /CHANGELOG.md : Update `/CHANGELOG.md` for user-visible changes (features, bug fixes, breaking changes, deprecations, performance improvements) to the open-source React on Rails gem and npm package
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to sig/react_on_rails/**/*.rbs : In RBS type signature files, define type signatures that correspond to Ruby files in `lib/react_on_rails/`
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-02-12T16:38:06.537Z
Learnt from: Romex91
Repo: shakacode/react_on_rails PR: 1697
File: package-scripts.yml:28-28
Timestamp: 2025-02-12T16:38:06.537Z
Learning: The file `node_package/lib/ReactOnRails.full.js` is autogenerated during the build process and should not be present in the repository.
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: ALWAYS let Prettier and RuboCop handle ALL formatting - never manually format
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-10-23T17:22:01.074Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1875
File: lib/react_on_rails/utils.rb:112-124
Timestamp: 2025-10-23T17:22:01.074Z
Learning: In React on Rails, when Pro is installed but not licensed, the intended behavior is to raise an error on boot. The `react_on_rails_pro?` method validates licenses and should raise errors early (including during path resolution in methods like `server_bundle?`) to enforce licensing requirements rather than failing later with obscure errors.
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to spec/dummy/e2e/playwright/**/*.spec.js : Use Rails helpers (`appFactories`, `appEval`) in Playwright tests instead of UI-based setup to leverage factory_bot and arbitrary Ruby code execution
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-02-13T14:29:49.267Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: spec/react_on_rails/utils_spec.rb:218-218
Timestamp: 2025-02-13T14:29:49.267Z
Learning: In RSpec tests, prefer using local variables over constants within test blocks to avoid constant redefinition warnings and maintain better test isolation.
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Exclude `/coverage`, `/tmp`, `/gen-examples`, `/packages/react-on-rails/lib`, `/node_modules`, `/spec/dummy/node_modules`, `/spec/dummy/tmp`, `/spec/dummy/app/assets/webpack`, `/spec/dummy/log`, `/spec/dummy/e2e/playwright-report`, `/spec/dummy/test-results` from IDE indexing
Applied to files:
react_on_rails_pro/.rubocop.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: examples (3.4, latest)
- GitHub Check: build-dummy-app-webpack-test-bundles
- GitHub Check: rspec-package-tests (3.4, latest)
- GitHub Check: build-dummy-app-webpack-test-bundles (3.4, 22, latest)
- GitHub Check: pro-lint-js-and-ruby
- GitHub Check: build
- GitHub Check: build-dummy-app-webpack-test-bundles
- GitHub Check: claude-review
🔇 Additional comments (3)
react_on_rails_pro/.rubocop.yml (3)
5-5: Good practice:EnableNewCops: truealigns with staying current.This setting ensures new cops introduced in future RuboCop versions are enabled by default, supporting consistent linting standards.
16-42: No duplication or conflicts detected—local configuration properly extends root config.The local cop configurations in react_on_rails_pro/.rubocop.yml correctly inherit from the root config via
inherit_from: ../.rubocop.yml. The local settings (Metrics/CyclomaticComplexity, Metrics/ClassLength, RSpec/NestedGroups, RSpec/BeforeAfterAll, RSpec/MultipleDescribes, Style/GlobalVars) are unique to this subdirectory and do not duplicate any root-level configurations. The root config defines different Metrics rules (AbcSize, PerceivedComplexity, ParameterLists, MethodLength, ModuleLength) and RSpec rules without these specific exclusions, so the local overrides and exclusion lists are intentional and conflict-free.
1-2: Root.rubocop.ymlexists and is properly configured. The inheritance inreact_on_rails_pro/.rubocop.ymlis correctly set up withinherit_from: ../.rubocop.yml. The root config includes standard exclusions that adequately cover project artifacts. No configuration issues detected.Note:
spec/performance/bench.rbdoes not currently exist in the repository, so the stated PR objective cannot be verified against the actual codebase state.
c029e91 to
5ff29fb
Compare
Code Review - RuboCop Config UnificationThank you for unifying the RuboCop configuration! This is a valuable cleanup that reduces duplication. ✅ Strengths
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
react_on_rails/.rubocop.yml (1)
1-80: File must end with a newline character.The file is missing a trailing newline after line 80, which violates the coding guideline.
As per coding guidelines, add a newline at the end of the file:
RSpec/StubbedMock: Exclude: - 'spec/react_on_rails/dev/**/*_spec.rb' # Dev module tests use mixed stub/mock patterns +react_on_rails_pro/.rubocop.yml (1)
1-33: File must end with a newline character.The file is missing a trailing newline after line 33, which violates the coding guideline.
As per coding guidelines, add a newline at the end of the file:
Style/GlobalVars: Exclude: - 'spec/dummy/config/environments/development.rb' +
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
react_on_rails/Gemfile.lockis excluded by!**/*.lock
📒 Files selected for processing (6)
.prettierignore(0 hunks).rubocop.yml(1 hunks)react_on_rails/.rubocop.yml(1 hunks)react_on_rails/Gemfile.development_dependencies(1 hunks)react_on_rails_pro/.prettierignore(1 hunks)react_on_rails_pro/.rubocop.yml(1 hunks)
💤 Files with no reviewable changes (1)
- .prettierignore
🚧 Files skipped from review as they are similar to previous changes (1)
- react_on_rails_pro/.prettierignore
🧰 Additional context used
📓 Path-based instructions (1)
**/*
📄 CodeRabbit inference engine (CLAUDE.md)
ALWAYS ensure files end with a newline character before committing/pushing
Files:
react_on_rails/Gemfile.development_dependencies
🧠 Learnings (18)
📓 Common learnings
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to **/*.{rb,rake} : ALWAYS run `bundle exec rubocop` and fix ALL violations before every commit/push
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: The `react_on_rails_pro/` directory has its own Prettier/ESLint configuration and must be linted separately
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to lib/react_on_rails/*.rb : Create RBS signature files for new Ruby files in `lib/react_on_rails/` by adding corresponding `.rbs` file in `sig/react_on_rails/`, adding to Steepfile, and validating before committing
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: ALWAYS let Prettier and RuboCop handle ALL formatting - never manually format
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to /CHANGELOG.md : Update `/CHANGELOG.md` for user-visible changes (features, bug fixes, breaking changes, deprecations, performance improvements) to the open-source React on Rails gem and npm package
Applied to files:
react_on_rails/Gemfile.development_dependenciesreact_on_rails/.rubocop.ymlreact_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to lib/react_on_rails/*.rb : Create RBS signature files for new Ruby files in `lib/react_on_rails/` by adding corresponding `.rbs` file in `sig/react_on_rails/`, adding to Steepfile, and validating before committing
Applied to files:
react_on_rails/Gemfile.development_dependenciesreact_on_rails/.rubocop.ymlreact_on_rails_pro/.rubocop.yml.rubocop.yml
📚 Learning: 2025-02-12T16:38:06.537Z
Learnt from: Romex91
Repo: shakacode/react_on_rails PR: 1697
File: package-scripts.yml:28-28
Timestamp: 2025-02-12T16:38:06.537Z
Learning: The file `node_package/lib/ReactOnRails.full.js` is autogenerated during the build process and should not be present in the repository.
Applied to files:
react_on_rails/Gemfile.development_dependenciesreact_on_rails/.rubocop.ymlreact_on_rails_pro/.rubocop.yml
📚 Learning: 2025-04-26T21:55:55.874Z
Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files under `app-react16` directories are copied/moved to corresponding `/app` directories during the conversion process (removing the `-react16` suffix), which affects their relative import paths at runtime.
Applied to files:
react_on_rails/Gemfile.development_dependenciesreact_on_rails/.rubocop.ymlreact_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to sig/react_on_rails/**/*.rbs : In RBS type signature files, define type signatures that correspond to Ruby files in `lib/react_on_rails/`
Applied to files:
react_on_rails/Gemfile.development_dependenciesreact_on_rails/.rubocop.ymlreact_on_rails_pro/.rubocop.yml.rubocop.yml
📚 Learning: 2025-09-16T08:01:11.146Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntax `import * as style from './file.module.css'` rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.
Applied to files:
react_on_rails/Gemfile.development_dependenciesreact_on_rails/.rubocop.ymlreact_on_rails_pro/.rubocop.yml.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: The `react_on_rails_pro/` directory has its own Prettier/ESLint configuration and must be linted separately
Applied to files:
react_on_rails/Gemfile.development_dependenciesreact_on_rails/.rubocop.ymlreact_on_rails_pro/.rubocop.yml.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to **/*.{rb,rake} : ALWAYS run `bundle exec rubocop` and fix ALL violations before every commit/push
Applied to files:
react_on_rails/Gemfile.development_dependenciesreact_on_rails/.rubocop.ymlreact_on_rails_pro/.rubocop.yml.rubocop.yml
📚 Learning: 2025-02-18T13:08:01.477Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: lib/react_on_rails/helper.rb:190-197
Timestamp: 2025-02-18T13:08:01.477Z
Learning: RSC support validation is handled in deeper level calls of the React on Rails Pro codebase, so it doesn't need to be validated again in the `rsc_payload_react_component` helper method.
Applied to files:
react_on_rails/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: ALWAYS let Prettier and RuboCop handle ALL formatting - never manually format
Applied to files:
react_on_rails/.rubocop.ymlreact_on_rails_pro/.rubocop.yml.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Exclude `/coverage`, `/tmp`, `/gen-examples`, `/packages/react-on-rails/lib`, `/node_modules`, `/spec/dummy/node_modules`, `/spec/dummy/tmp`, `/spec/dummy/app/assets/webpack`, `/spec/dummy/log`, `/spec/dummy/e2e/playwright-report`, `/spec/dummy/test-results` from IDE indexing
Applied to files:
react_on_rails/.rubocop.yml.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to spec/dummy/e2e/playwright/**/*.spec.js : Use Rails helpers (`appFactories`, `appEval`) in Playwright tests instead of UI-based setup to leverage factory_bot and arbitrary Ruby code execution
Applied to files:
react_on_rails/.rubocop.yml
📚 Learning: 2025-02-13T14:29:49.267Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: spec/react_on_rails/utils_spec.rb:218-218
Timestamp: 2025-02-13T14:29:49.267Z
Learning: In RSpec tests, prefer using local variables over constants within test blocks to avoid constant redefinition warnings and maintain better test isolation.
Applied to files:
react_on_rails/.rubocop.ymlreact_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Runtime type checking via RBS is enabled by default in test runs; disable with `DISABLE_RBS_RUNTIME_CHECKING=true` only for rapid development iterations
Applied to files:
react_on_rails/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to lib/tasks/*.rake : Rails::Engine rake tasks should NOT be explicitly loaded via `rake_tasks` block; instead, place them in `lib/tasks/*.rake` where Rails::Engine automatically loads them
Applied to files:
react_on_rails/.rubocop.yml
📚 Learning: 2024-10-08T20:53:47.076Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1622
File: spec/dummy/spec/rake/assets_precompile_rake_spec.rb:12-12
Timestamp: 2024-10-08T20:53:47.076Z
Learning: When stubbing environment variables in RSpec tests, use `before` and `after` hooks to ensure that the original values are restored after the tests, preventing any side effects on other tests. Example provided by justin808:
```ruby
describe "My test" do
before do
original_value = ENV["VARIABLE_NAME"]
allow(ENV).to receive(:[]).with("VARIABLE_NAME").and_return("stubbed_value")
end
after do
allow(ENV).to receive(:[]).with("VARIABLE_NAME").and_call_original
ENV["VARIABLE_NAME"] = original_value
end
it "tests something" do
# Your test code here
end
end
```
This practice ensures test isolation and reliability.
Applied to files:
react_on_rails/.rubocop.yml
📚 Learning: 2025-10-23T17:22:01.074Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1875
File: lib/react_on_rails/utils.rb:112-124
Timestamp: 2025-10-23T17:22:01.074Z
Learning: In React on Rails, when Pro is installed but not licensed, the intended behavior is to raise an error on boot. The `react_on_rails_pro?` method validates licenses and should raise errors early (including during path resolution in methods like `server_bundle?`) to enforce licensing requirements rather than failing later with obscure errors.
Applied to files:
react_on_rails_pro/.rubocop.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
- GitHub Check: rspec-package-tests (3.4, latest)
- GitHub Check: build-dummy-app-webpack-test-bundles (3.4, 22, latest)
- GitHub Check: examples (3.4, latest)
- GitHub Check: build-dummy-app-webpack-test-bundles
- GitHub Check: build
- GitHub Check: build-dummy-app-webpack-test-bundles
- GitHub Check: pro-lint-js-and-ruby
- GitHub Check: claude-review
🔇 Additional comments (3)
.rubocop.yml (1)
1-99: Root configuration structure looks solid.The shared RuboCop configuration provides a good baseline with reasonable cop settings, metrics thresholds, and RSpec configurations that both packages can inherit from.
react_on_rails/.rubocop.yml (1)
1-2: Good consolidation via inheritance.Switching to inherit from the root configuration is a clean approach that reduces duplication while maintaining package-specific exceptions where needed.
react_on_rails_pro/.rubocop.yml (1)
1-2: Inheritance approach reduces duplication effectively.Inheriting from the root config while maintaining only pro-specific exclusions is a clean consolidation.
react_on_rails_pro/.rubocop.yml
Outdated
| - '**/*.rb' | ||
| - '**/*.rake' | ||
|
|
||
| EnableNewCops: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
RuboCop NewCops vs EnableNewCops settings documentation
💡 Result:
Short answer — use AllCops: NewCops. NewCops (values: enable / disable / pending) is the official RuboCop setting to control how "pending" (newly added between major releases) cops are handled; it lets you bulk-enable or bulk-disable those cops or leave them pending so RuboCop warns you and you enable/disable them individually. (docs.rubocop.org)
"EnableNewCops" is not an official RuboCop config key — you'll see it sometimes in community gems/configs or posts, but the documented/supported form is AllCops: NewCops. Put NewCops under AllCops in .rubocop.yml (or use the --enable-pending-cops / --disable-pending-cops CLI flags). (docs.rubocop.org)
If you want the authoritative docs, see:
- Versioning / pending cops (explains NewCops behavior). [1]. (docs.rubocop.org)
- Configuration reference (AllCops and general config). [2]. (docs.rubocop.org)
If you want, I can show a minimal .rubocop.yml example.
Citations:
- 1: https://docs.rubocop.org/rubocop/versioning.html?utm_source=openai
- 2: https://docs.rubocop.org/rubocop/configuration.html?utm_source=openai
- 3: https://docs.rubocop.org/rubocop/versioning.html?utm_source=openai
- 4: https://docs.rubocop.org/rubocop/configuration.html?utm_source=openai
Remove or replace EnableNewCops: true — it is not an official RuboCop configuration key.
RuboCop only recognizes NewCops (with values: enable, disable, or pending) placed under AllCops. The setting EnableNewCops: true will be silently ignored by RuboCop and has no effect. The root config's NewCops: enable is the correct syntax.
🤖 Prompt for AI Agents
In react_on_rails_pro/.rubocop.yml around line 5, the setting `EnableNewCops:
true` is not a valid RuboCop key and should be removed; instead add or ensure an
`AllCops` section contains `NewCops: enable` (e.g. under `AllCops:` set
`NewCops: enable`) so RuboCop recognizes the intent to enable new cops.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@claude this is true, please fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Claude finished @ihabadham's task —— View job
Fixed invalid RuboCop configuration ✅
Tasks
- Read current
react_on_rails_pro/.rubocop.ymlfile - Remove invalid
EnableNewCops: trueline - Commit and push changes
What was fixed
Removed the invalid EnableNewCops: true configuration key from react_on_rails_pro/.rubocop.yml (line 5).
Why this was invalid: RuboCop only recognizes NewCops (with values enable, disable, or pending) under the AllCops section. The setting EnableNewCops: true is not a valid RuboCop configuration key and would be silently ignored.
Why removal is correct: The Pro package config inherits from the root .rubocop.yml via inherit_from: ../.rubocop.yml, and the root config already has the correct NewCops: enable setting. No need to duplicate or override it.
Changes made
- Commit: 1fafb9c - Remove invalid EnableNewCops config key from Pro RuboCop config
|
| gem "steep", require: false | ||
| gem "rubocop", "1.61.0", require: false | ||
| gem "rubocop-performance", "~>1.20.0", require: false | ||
| gem "rubocop-rails-omakase", "~>1.0.0", require: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Check if rubocop-rails-omakase is required in any RuboCop config
rg -n "rubocop-rails-omakase" --type=yamlRepository: shakacode/react_on_rails
Length of output: 50
🏁 Script executed:
#!/bin/bash
# Examine the .rubocop.yml file to see the require section
cat -n .rubocop.ymlRepository: shakacode/react_on_rails
Length of output: 2352
🏁 Script executed:
#!/bin/bash
# Check the Gemfile.development_dependencies file
cat -n react_on_rails/Gemfile.development_dependenciesRepository: shakacode/react_on_rails
Length of output: 2161
🏁 Script executed:
#!/bin/bash
# Check if Gemfile.development_dependencies ends with a newline
tail -c 1 react_on_rails/Gemfile.development_dependencies | od -An -tx1Repository: shakacode/react_on_rails
Length of output: 110
🏁 Script executed:
#!/bin/bash
# Check if file ends with newline using a different method
if [ -n "$(tail -c 1 react_on_rails/Gemfile.development_dependencies)" ]; then
echo "NO newline at end"
else
echo "File ends with newline"
fiRepository: shakacode/react_on_rails
Length of output: 90
Add rubocop-rails-omakase to the require: section in .rubocop.yml.
The gem is added to Gemfile.development_dependencies but is not required in .rubocop.yml. Only rubocop-performance and rubocop-rspec are currently required. Without explicit configuration, the cops from rubocop-rails-omakase won't be active and its rules won't be enforced.
🤖 Prompt for AI Agents
In react_on_rails/Gemfile.development_dependencies around line 40, the gem
"rubocop-rails-omakase" was added but its cops are not enabled in .rubocop.yml;
update .rubocop.yml to add "rubocop-rails-omakase" to the require: list
alongside "rubocop-performance" and "rubocop-rspec" so the gem's cops are loaded
(edit the top-level require section to include the new gem name).
Code Review for PR #2153: Unify Rubocop configOverviewThis PR successfully centralizes RuboCop configuration using inheritance, reducing duplication across the monorepo. ✅ Strengths
|
The correct RuboCop syntax is 'NewCops: enable' under AllCops, which is already defined in the root .rubocop.yml that this config inherits from. 'EnableNewCops: true' is not a valid RuboCop configuration key and will be silently ignored. Co-authored-by: Ihab Adham <ihabadham@users.noreply.github.com>
Code Review - PR #2153: Unify Rubocop ConfigSummaryThis PR centralizes RuboCop configuration by creating a root-level .rubocop.yml that is inherited by both react_on_rails/ and react_on_rails_pro/ packages. This is a well-executed refactoring that reduces duplication and improves maintainability. Strengths
Observations and Questions1. Pro Package ERB Templating - The Pro package uses dynamic exclusions via ERB (lines 6-8). Is this approach documented? It's clever but makes config non-standard YAML. Consider adding explanatory comment or documenting in CLAUDE.md. 2. Version Consistency - Root config sets TargetRubyVersion: 3.0, but CLAUDE.md shows project supports Ruby 3.2+ (min) and 3.4 (latest). Should this be updated to 3.2? 3. Metrics Loosening - Root config has Metrics/CyclomaticComplexity Max: 8 and NestedGroups Max: 5, but react_on_rails previously had Max: 7 and Max: 4 (stricter). This loosens limits for open-source package. Is this intentional? Security and Quality✅ No security concerns - configuration changes only Final VerdictAPPROVED with minor questions ✅ This is high-quality refactoring that reduces maintenance burden, improves consistency, follows best practices, and maintains package-specific flexibility. Questions raised are minor clarifications, not blockers. Ready to merge once CI passes. Suggested Follow-ups
Great work on this refactoring! 🎉 |
Co-authored-by: Ihab Adham <ihabadham@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
react_on_rails_pro/.rubocop.yml(1 hunks)
🧰 Additional context used
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to **/*.{rb,rake} : ALWAYS run `bundle exec rubocop` and fix ALL violations before every commit/push
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: ALWAYS let Prettier and RuboCop handle ALL formatting - never manually format
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: The `react_on_rails_pro/` directory has its own Prettier/ESLint configuration and must be linted separately
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Resolve merge conflicts by: resolving logical conflicts first, verifying file paths with grep, testing affected scripts, auto-fixing formatting with `rake autofix`, and testing critical scripts if build configs changed
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to lib/react_on_rails/*.rb : Create RBS signature files for new Ruby files in `lib/react_on_rails/` by adding corresponding `.rbs` file in `sig/react_on_rails/`, adding to Steepfile, and validating before committing
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to **/*.{rb,rake} : ALWAYS run `bundle exec rubocop` and fix ALL violations before every commit/push
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: The `react_on_rails_pro/` directory has its own Prettier/ESLint configuration and must be linted separately
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-09-16T08:01:11.146Z
Learnt from: justin808
Repo: shakacode/react_on_rails PR: 1770
File: lib/generators/react_on_rails/templates/base/base/app/javascript/src/HelloWorld/ror_components/HelloWorld.client.jsx:2-2
Timestamp: 2025-09-16T08:01:11.146Z
Learning: React on Rails uses webpack CSS Modules configuration with namedExports: true, which requires the import syntax `import * as style from './file.module.css'` rather than the default export pattern. This configuration enables better tree shaking and bundle size optimization for CSS modules.
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to lib/react_on_rails/*.rb : Create RBS signature files for new Ruby files in `lib/react_on_rails/` by adding corresponding `.rbs` file in `sig/react_on_rails/`, adding to Steepfile, and validating before committing
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-04-26T21:55:55.874Z
Learnt from: alexeyr-ci2
Repo: shakacode/react_on_rails PR: 1732
File: spec/dummy/client/app-react16/startup/ReduxSharedStoreApp.client.jsx:40-44
Timestamp: 2025-04-26T21:55:55.874Z
Learning: In the react_on_rails project, files under `app-react16` directories are copied/moved to corresponding `/app` directories during the conversion process (removing the `-react16` suffix), which affects their relative import paths at runtime.
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to sig/react_on_rails/**/*.rbs : In RBS type signature files, define type signatures that correspond to Ruby files in `lib/react_on_rails/`
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-02-12T16:38:06.537Z
Learnt from: Romex91
Repo: shakacode/react_on_rails PR: 1697
File: package-scripts.yml:28-28
Timestamp: 2025-02-12T16:38:06.537Z
Learning: The file `node_package/lib/ReactOnRails.full.js` is autogenerated during the build process and should not be present in the repository.
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Applies to /CHANGELOG.md : Update `/CHANGELOG.md` for user-visible changes (features, bug fixes, breaking changes, deprecations, performance improvements) to the open-source React on Rails gem and npm package
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: ALWAYS let Prettier and RuboCop handle ALL formatting - never manually format
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-11-25T08:05:17.804Z
Learnt from: CR
Repo: shakacode/react_on_rails PR: 0
File: CLAUDE.md:0-0
Timestamp: 2025-11-25T08:05:17.804Z
Learning: Exclude `/coverage`, `/tmp`, `/gen-examples`, `/packages/react-on-rails/lib`, `/node_modules`, `/spec/dummy/node_modules`, `/spec/dummy/tmp`, `/spec/dummy/app/assets/webpack`, `/spec/dummy/log`, `/spec/dummy/e2e/playwright-report`, `/spec/dummy/test-results` from IDE indexing
Applied to files:
react_on_rails_pro/.rubocop.yml
📚 Learning: 2025-02-13T14:29:49.267Z
Learnt from: AbanoubGhadban
Repo: shakacode/react_on_rails PR: 1644
File: spec/react_on_rails/utils_spec.rb:218-218
Timestamp: 2025-02-13T14:29:49.267Z
Learning: In RSpec tests, prefer using local variables over constants within test blocks to avoid constant redefinition warnings and maintain better test isolation.
Applied to files:
react_on_rails_pro/.rubocop.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: build-dummy-app-webpack-test-bundles (3.2, 20, minimum)
- GitHub Check: examples (3.2, minimum)
- GitHub Check: examples (3.4, latest)
- GitHub Check: rspec-package-tests (3.2, minimum)
- GitHub Check: rspec-package-tests (3.4, latest)
- GitHub Check: pro-lint-js-and-ruby
- GitHub Check: build
- GitHub Check: build-dummy-app-webpack-test-bundles
- GitHub Check: build-dummy-app-webpack-test-bundles
- GitHub Check: claude-review
🔇 Additional comments (2)
react_on_rails_pro/.rubocop.yml (2)
24-28: Retain custom RSpec language expectations for react_on_rails testing.The custom expectation matchers
change_text_expect_dom_selectorandcheck_matchare specific to react_on_rails' testing framework and should remain in this configuration. Keeping them in the Pro package config (rather than centralizing in the root config) is appropriate since these are Pro-specific test helpers.
6-8: ERB preprocessing in RuboCop configuration is valid.Configuration files are pre-processed using the ERB templating mechanism. This makes it possible to add dynamic content that will be evaluated when the configuration file is read. The pattern of using
git status --ignoredto dynamically exclude git-ignored paths is a valid example of letting RuboCop ignore all files ignored by Git, so the implementation here is correct.
| <% `git status --ignored --porcelain`.lines.grep(/^!! /).each do |path| %> | ||
| - <%= path.sub(/^!! /, '') %> | ||
| <% end %> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cat -n react_on_rails_pro/.rubocop.ymlRepository: shakacode/react_on_rails
Length of output: 1047
🏁 Script executed:
cd react_on_rails_pro && bundle exec rubocop --version && bundle exec rubocop --debug 2>&1 | head -100Repository: shakacode/react_on_rails
Length of output: 154
🏁 Script executed:
# Check for any preprocessing or build scripts that might handle ERB in rubocop config
rg "\.rubocop\.yml" --type rb -A 3 -B 3
# Check Rakefile for any ERB preprocessing tasks
fd -e rake | head -5 | xargs grep -l "rubocop\|erb" 2>/dev/null
# Look for any documentation about this
fd -e md | xargs grep -l "rubocop.*erb\|erb.*rubocop" 2>/dev/nullRepository: shakacode/react_on_rails
Length of output: 267
🏁 Script executed:
# Check if there's a gemfile or setup that might explain this
cat react_on_rails_pro/Gemfile 2>/dev/null || echo "No Gemfile in pro dir"
# Search for any recent comments or TODOs in the rubocop.yml
rg "TODO|FIXME|WIP" react_on_rails_pro/.rubocop.ymlRepository: shakacode/react_on_rails
Length of output: 257
🏁 Script executed:
# Double-check: Try to parse just the ERB lines as YAML to show the error
python3 << 'EOF'
import yaml
import sys
yaml_content = """AllCops:
Exclude:
<% `git status --ignored --porcelain`.lines.grep(/^!! /).each do |path| %>
- <%= path.sub(/^!! /, '') %>
<% end %>
- 'db/schema.rb'
"""
try:
result = yaml.safe_load(yaml_content)
print("YAML parsed successfully:", result)
except yaml.YAMLError as e:
print(f"YAML parsing failed: {e}")
EOFRepository: shakacode/react_on_rails
Length of output: 306
🔴 Critical: ERB syntax is not valid in RuboCop YAML configuration files.
Lines 6-8 contain ERB template tags (<% %> and <%= %>) which are not valid YAML syntax. YAML parsers fail to parse this file with "could not find expected ':'" errors, and RuboCop hangs when attempting to read it.
This is a blocker—the file must be converted to valid YAML before RuboCop can execute. Either:
- Use static YAML with glob patterns instead of dynamic ERB
- Move the dynamic exclusion logic to a build script that generates valid YAML before RuboCop execution
- Implement preprocessing to convert this file to valid YAML
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 8-8: syntax error: could not find expected ':'
(syntax)
🤖 Prompt for AI Agents
In react_on_rails_pro/.rubocop.yml around lines 6-8 there are ERB tags (<% %>,
<%= %>) which break YAML parsing; remove the ERB and ensure the file is valid
YAML by either replacing the dynamic block with a static YAML list of glob
patterns for excluded paths, or moving the dynamic logic into a prebuild script
that generates a pure YAML .rubocop.yml (or an included exclude file) before
RuboCop runs; ensure the final committed file contains only valid YAML (no ERB)
and that RuboCop is pointed at the generated/updated YAML.
ihabadham
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just some comments for failing CI
.rubocop.yml
Outdated
| - 'node_modules/**/*' | ||
| - 'spec/fixtures/**/*' | ||
| - 'spec/react_on_rails/dummy-for-generators/**/*' | ||
| - 'vendor/**/*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
**/vendor/**/* should be used instead of vendor/**/* because CI installs gems to react_on_rails/vendor/bundle/ and react_on_rails_pro/vendor/bundle/. Without the **/ prefix, RuboCop scans those directories and finds .rubocop.yml files inside gems (like docile which references panolint, and cypress-on-rails which references rubocop-rails-omakase) - causing the CI failures.
| - rubocop-performance | ||
| - rubocop-rspec | ||
| # Inherits from root config | ||
| inherit_from: ../.rubocop.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| inherit_from: ../.rubocop.yml | |
| inherit_from: ../.rubocop.yml | |
| # Merge Exclude arrays with parent instead of replacing them | |
| inherit_mode: | |
| merge: | |
| - Exclude |
default inherit mode is override, so without inherit_mode: merge, child Exclude arrays replace the parent's instead of merging. This means all the root excludes are lost.
|
@claude can you address my review i just made by: if any if these steps break or behave unexpected, stop and report back |
|
Claude finished @ihabadham's task —— View job Addressing Review Feedback - Status ReportTasks Completed
Current Status: Needs Approval for Auto-CorrectBoth claimed issues were VALID and have been fixed:
CI Results: The "Lint JS and Ruby" job failed with 12 autocorrectable offenses: All 12 offenses are
Next Steps: I need approval to run: cd react_on_rails && bundle exec rubocop --auto-correct-allThis will remove the 12 redundant disable comments. Then I can commit, push, and wait for CI to pass before proceeding with the rubocop-rails-omakase revert test. Commits Pushed: |
Change vendor/**/* to **/vendor/**/* to properly exclude vendor directories in subdirectories like react_on_rails/vendor/bundle/ and react_on_rails_pro/vendor/bundle/ where CI installs gems. Co-authored-by: Ihab Adham <ihabadham@users.noreply.github.com>
Without inherit_mode merge, child Exclude arrays replace the parent's instead of merging with them. This was causing all root exclusions (node_modules, tmp, coverage, etc.) to be lost in the child configs. Co-authored-by: Ihab Adham <ihabadham@users.noreply.github.com>
@alexeyr-ci2 any reason for this? or just globalize the pro configs? |
|
@claude approved |
|
@claude correct the rubocop offenses, commit and push. then wait for ci to pass, if it does, revert the commit that added rubocop-rails-omakase |
|
Claude finished @ihabadham's task —— View job Addressing Review Feedback - Complete ✅Tasks Completed
SummaryAll tasks completed successfully! The RuboCop configuration has been unified and all linting issues have been resolved. Configuration Fixes:
RuboCop Offense Fixes:
These became unnecessary when the root config increased the cyclomatic complexity threshold from 7 to 8. Cleanup:
CI Results: 8/9 tests passed ✅
|
…plexity The root config increased the cyclomatic complexity threshold from 7 to 8, making these disable comments unnecessary. All 12 methods now comply with the new threshold naturally. Co-authored-by: Ihab Adham <ihabadham@users.noreply.github.com>
Code Review - PR #2153: Unify Rubocop ConfigSummaryThis PR successfully consolidates RuboCop configuration into a centralized root config file, reducing duplication across the monorepo. The changes are well-structured and follow good practices for configuration inheritance. ✅ Strengths
🔍 Observations & Questions1. Unused dependency:
|
…lexity These enable directives are now unnecessary since their corresponding disable directives were removed in the previous commit. Co-authored-by: Ihab Adham <ihabadham@users.noreply.github.com>
This reverts commit 5ff29fb. The gem was added experimentally but is not needed. CI passes without it. Co-authored-by: Ihab Adham <ihabadham@users.noreply.github.com>
Code Review: RuboCop Configuration UnificationThank you for working on this PR! Overall, this is a well-executed refactoring that consolidates RuboCop configuration across the monorepo. Here's my detailed review: ✅ Strengths
🔍 Areas Requiring Attention1. Prettier Configuration Mismatch
|
Code Review: Unify RuboCop ConfigSummaryThis PR successfully consolidates RuboCop configuration by creating a shared root config that both react_on_rails/ and react_on_rails_pro/ inherit from. All CI checks are passing. Strengths
ObservationsThreshold Changes:
These changes are fine and allowed removal of disable directives, but worth documenting. Good catches in later commits:
Security & TestingNo security concerns - purely configuration refactoring. CI validation confirms:
Suggestions
VerdictLGTM - Solid refactoring that reduces duplication, fixes inheritance bugs, and maintains existing behavior. No blocking issues. |
Summary
Extracted from #1868 because it adds
spec/performance/bench.rband the default Rubocop config doesn't fit our repo.Pull Request checklist
Add/update test to cover these changesUpdate documentationUpdate CHANGELOG fileSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.