From 6fcb88407ace3156a157206b88117325c4e96fe9 Mon Sep 17 00:00:00 2001 From: Alexey Romanov Date: Mon, 1 Dec 2025 15:15:35 +0000 Subject: [PATCH 01/11] Unify Rubocop config --- .prettierignore | 1 - .rubocop.yml | 90 ++++++++++++++++++++++++++++++ react_on_rails/.rubocop.yml | 76 +------------------------ react_on_rails_pro/.prettierignore | 3 + react_on_rails_pro/.rubocop.yml | 83 +-------------------------- 5 files changed, 97 insertions(+), 156 deletions(-) create mode 100644 .rubocop.yml diff --git a/.prettierignore b/.prettierignore index 22212fcf60..3e9b4890da 100644 --- a/.prettierignore +++ b/.prettierignore @@ -19,7 +19,6 @@ spec/dummy/public *.res.js # Prettier doesn't understand ERB syntax in YAML files and can damage templates -.rubocop.yml *.yml *.yaml # Intentionally invalid diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000000..ff487888ec --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,90 @@ +# Root RuboCop configuration for React on Rails monorepo +# This contains shared settings inherited by react_on_rails/ and react_on_rails_pro/ +require: + - rubocop-performance + - rubocop-rspec + +AllCops: + NewCops: enable + DisplayCopNames: true + SuggestExtensions: false + TargetRubyVersion: 3.0 + + Include: + - '**/Rakefile' + - '**/config.ru' + - 'Gemfile' + - '**/*.rb' + - '**/*.rake' + + Exclude: + - '**/*.js' + - '**/node_modules/**/*' + - '**/public/**/*' + - '**/tmp/**/*' + - 'coverage/**/*' + - 'gen-examples/**/*' + - 'node_modules/**/*' + - 'spec/fixtures/**/*' + - 'spec/react_on_rails/dummy-for-generators/**/*' + - 'vendor/**/*' + +Naming/FileName: + Exclude: + - '**/Gemfile' + - '**/Rakefile' + +Layout/LineLength: + Max: 120 + +Style/StringLiterals: + EnforcedStyle: double_quotes + +Style/Documentation: + Enabled: false + +Style/HashEachMethods: + Enabled: true + +Style/HashTransformKeys: + Enabled: true + +Style/HashTransformValues: + Enabled: true + +Metrics/AbcSize: + Max: 28 + +Metrics/PerceivedComplexity: + Max: 10 + +Metrics/ParameterLists: + Max: 5 + CountKeywordArgs: false + +Metrics/MethodLength: + Max: 41 + +Metrics/ModuleLength: + Max: 180 + +RSpec/DescribeClass: + Enabled: false + +RSpec/ExampleLength: + Enabled: false + +RSpec/MessageSpies: + Enabled: false + +RSpec/MessageChain: + Enabled: false + +RSpec/MultipleExpectations: + Enabled: false + +RSpec/MultipleMemoizedHelpers: + Max: 12 + +Style/FrozenStringLiteralComment: + EnforcedStyle: always diff --git a/react_on_rails/.rubocop.yml b/react_on_rails/.rubocop.yml index 0ac427181e..c25f620266 100644 --- a/react_on_rails/.rubocop.yml +++ b/react_on_rails/.rubocop.yml @@ -1,36 +1,11 @@ -# This is the configuration used to check the rubocop source code. -# Check out: https://github.com/bbatsov/rubocop -require: - - rubocop-performance - - rubocop-rspec +# Inherits from root config +inherit_from: ../.rubocop.yml AllCops: - NewCops: enable - DisplayCopNames: true - TargetRubyVersion: 3.0.0 SuggestExtensions: false - Include: - - '**/Rakefile' - - '**/config.ru' - - 'Gemfile' - - '**/*.rb' - - '**/*.rake' - Exclude: - - '**/*.js' - - '**/node_modules/**/*' - - '**/public/**/*' - - '**/tmp/**/*' - - 'coverage/**/*' - - 'gen-examples/examples/**/*' - - 'node_modules/**/*' - - '../react_on_rails_pro/**/*' # Exclude pro package (has its own linting) - 'spec/dummy/bin/*' - - 'spec/fixtures/**/*' - - 'spec/react_on_rails/dummy-for-generators/**/*' - - 'tmp/**/*' - - 'vendor/**/*' Naming/FileName: Exclude: @@ -38,24 +13,6 @@ Naming/FileName: - '**/Rakefile' - '**/Steepfile' -Layout/LineLength: - Max: 120 - -Style/StringLiterals: - EnforcedStyle: double_quotes - -Style/Documentation: - Enabled: false - -Style/HashEachMethods: - Enabled: true - -Style/HashTransformKeys: - Enabled: true - -Style/HashTransformValues: - Enabled: true - Lint/AssignmentInCondition: Exclude: - 'spec/dummy/bin/spring' @@ -66,33 +23,23 @@ Lint/SuppressedException: - 'spec/dummy/bin/rake' Metrics/AbcSize: - Max: 28 Exclude: - 'lib/generators/react_on_rails/install_generator.rb' # Generator setup methods require comprehensive error handling Metrics/CyclomaticComplexity: Max: 7 -Metrics/PerceivedComplexity: - Max: 10 - Metrics/ClassLength: Max: 150 Exclude: - 'lib/generators/react_on_rails/base_generator.rb' # Generator complexity justified - 'lib/react_on_rails/dev/server_manager.rb' # Dev tool with comprehensive help system -Metrics/ParameterLists: - Max: 5 - CountKeywordArgs: false - Metrics/MethodLength: - Max: 41 Exclude: - 'lib/generators/react_on_rails/install_generator.rb' # Generator setup methods require comprehensive error handling Metrics/ModuleLength: - Max: 180 Exclude: - 'spec/react_on_rails/engine_spec.rb' # Comprehensive engine tests require many examples @@ -107,15 +54,6 @@ RSpec/AnyInstance: - 'spec/react_on_rails/binstubs/dev_static_spec.rb' - 'spec/react_on_rails/dev/**/*_spec.rb' # Dev module tests require system mocking -RSpec/DescribeClass: - Enabled: false - -RSpec/ExampleLength: - Enabled: false - -RSpec/MessageSpies: - Enabled: false - RSpec/NestedGroups: Max: 4 @@ -127,19 +65,10 @@ RSpec/BeforeAfterAll: - 'spec/react_on_rails/binstubs/dev_static_spec.rb' - 'spec/react_on_rails/dev/**/*_spec.rb' # Dev module tests require global setup -RSpec/MessageChain: - Enabled: false - -RSpec/MultipleExpectations: - Enabled: false - RSpec/MultipleDescribes: Exclude: - 'spec/dummy/spec/system/integration_spec.rb' -RSpec/MultipleMemoizedHelpers: - Max: 12 - Style/GlobalVars: Exclude: - 'spec/dummy/config/environments/development.rb' @@ -156,4 +85,3 @@ RSpec/InstanceVariable: RSpec/StubbedMock: Exclude: - 'spec/react_on_rails/dev/**/*_spec.rb' # Dev module tests use mixed stub/mock patterns - diff --git a/react_on_rails_pro/.prettierignore b/react_on_rails_pro/.prettierignore index 7ceb1ad738..47322297f2 100644 --- a/react_on_rails_pro/.prettierignore +++ b/react_on_rails_pro/.prettierignore @@ -9,3 +9,6 @@ spec/dummy/.yalc/ # File Generated by ROR FS-based Registry **/generated + +# Prettier doesn't understand ERB in RuboCop config +.rubocop.yml diff --git a/react_on_rails_pro/.rubocop.yml b/react_on_rails_pro/.rubocop.yml index e6266070b2..e5050a93ca 100644 --- a/react_on_rails_pro/.rubocop.yml +++ b/react_on_rails_pro/.rubocop.yml @@ -1,90 +1,23 @@ -# This is the configuration used to check the rubocop source code. -# Check out: https://github.com/bbatsov/rubocop -require: - - rubocop-performance - - rubocop-rspec +# Inherits from root config +inherit_from: ../.rubocop.yml AllCops: - NewCops: enable - DisplayCopNames: true - TargetRubyVersion: 3.0 - - Include: - - '**/Rakefile' - - '**/config.ru' - - 'Gemfile' - - '**/*.rb' - - '**/*.rake' - Exclude: <% `git status --ignored --porcelain`.lines.grep(/^!! /).each do |path| %> - <%= path.sub(/^!! /, '') %> <% end %> - - '**/node_modules/**/*' - 'db/schema.rb' - 'db/seeds.rb' - - 'spec/fixtures/**/*' - 'spec/dummy/db/schema.rb' - 'spec/dummy/bin/**/*' - - 'node_modules/**/*' - - 'coverage/**/*' - 'bin/**/*' - - 'vendor/**/*' - -Naming/FileName: - Exclude: - - '**/Gemfile' - - '**/Rakefile' - -Layout/LineLength: - Max: 120 - -Style/StringLiterals: - EnforcedStyle: double_quotes - -Style/Documentation: - Enabled: false - -Style/HashEachMethods: - Enabled: true - -Style/HashTransformKeys: - Enabled: true - -Style/HashTransformValues: - Enabled: true - -Metrics/AbcSize: - Max: 28 Metrics/CyclomaticComplexity: Max: 8 -Metrics/PerceivedComplexity: - Max: 10 - Metrics/ClassLength: Max: 140 -Metrics/ParameterLists: - Max: 5 - CountKeywordArgs: false - -Metrics/MethodLength: - Max: 41 - -Metrics/ModuleLength: - Max: 180 - -RSpec/DescribeClass: - Enabled: false - -RSpec/ExampleLength: - Enabled: false - -RSpec/MessageSpies: - Enabled: false - RSpec/NestedGroups: Max: 5 @@ -93,19 +26,10 @@ RSpec/BeforeAfterAll: - 'spec/react_on_rails/generators/dev_tests_generator_spec.rb' - 'spec/react_on_rails/generators/install_generator_spec.rb' -RSpec/MessageChain: - Enabled: false - -RSpec/MultipleExpectations: - Enabled: false - RSpec/MultipleDescribes: Exclude: - 'spec/dummy/spec/system/integration_spec.rb' -RSpec/MultipleMemoizedHelpers: - Max: 12 - RSpec: Language: Expectations: @@ -115,6 +39,3 @@ RSpec: Style/GlobalVars: Exclude: - 'spec/dummy/config/environments/development.rb' - -Style/FrozenStringLiteralComment: - EnforcedStyle: always From 086b910b0d72e575604427eb0c8748f87eb56edd Mon Sep 17 00:00:00 2001 From: Alexey Romanov Date: Mon, 1 Dec 2025 18:30:12 +0000 Subject: [PATCH 02/11] Unify config further --- .rubocop.yml | 9 +++++++++ react_on_rails/.rubocop.yml | 7 ------- react_on_rails_pro/.rubocop.yml | 9 --------- 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index ff487888ec..6262ea3166 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -55,6 +55,12 @@ Style/HashTransformValues: Metrics/AbcSize: Max: 28 +Metrics/ClassLength: + Max: 150 + +Metrics/CyclomaticComplexity: + Max: 8 + Metrics/PerceivedComplexity: Max: 10 @@ -86,5 +92,8 @@ RSpec/MultipleExpectations: RSpec/MultipleMemoizedHelpers: Max: 12 +RSpec/NestedGroups: + Max: 5 + Style/FrozenStringLiteralComment: EnforcedStyle: always diff --git a/react_on_rails/.rubocop.yml b/react_on_rails/.rubocop.yml index c25f620266..ffed51fe80 100644 --- a/react_on_rails/.rubocop.yml +++ b/react_on_rails/.rubocop.yml @@ -26,11 +26,7 @@ Metrics/AbcSize: Exclude: - 'lib/generators/react_on_rails/install_generator.rb' # Generator setup methods require comprehensive error handling -Metrics/CyclomaticComplexity: - Max: 7 - Metrics/ClassLength: - Max: 150 Exclude: - 'lib/generators/react_on_rails/base_generator.rb' # Generator complexity justified - 'lib/react_on_rails/dev/server_manager.rb' # Dev tool with comprehensive help system @@ -54,9 +50,6 @@ RSpec/AnyInstance: - 'spec/react_on_rails/binstubs/dev_static_spec.rb' - 'spec/react_on_rails/dev/**/*_spec.rb' # Dev module tests require system mocking -RSpec/NestedGroups: - Max: 4 - RSpec/BeforeAfterAll: Exclude: - 'spec/react_on_rails/generators/dev_tests_generator_spec.rb' diff --git a/react_on_rails_pro/.rubocop.yml b/react_on_rails_pro/.rubocop.yml index e5050a93ca..258907f06f 100644 --- a/react_on_rails_pro/.rubocop.yml +++ b/react_on_rails_pro/.rubocop.yml @@ -12,15 +12,6 @@ AllCops: - 'spec/dummy/bin/**/*' - 'bin/**/*' -Metrics/CyclomaticComplexity: - Max: 8 - -Metrics/ClassLength: - Max: 140 - -RSpec/NestedGroups: - Max: 5 - RSpec/BeforeAfterAll: Exclude: - 'spec/react_on_rails/generators/dev_tests_generator_spec.rb' From 8cc00c35b5935d0f2779a6da411a8f01920499e8 Mon Sep 17 00:00:00 2001 From: Alexey Romanov Date: Mon, 1 Dec 2025 17:10:46 +0000 Subject: [PATCH 03/11] Explicitly enable new cops in pro --- react_on_rails_pro/.rubocop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/react_on_rails_pro/.rubocop.yml b/react_on_rails_pro/.rubocop.yml index 258907f06f..9a02a6158d 100644 --- a/react_on_rails_pro/.rubocop.yml +++ b/react_on_rails_pro/.rubocop.yml @@ -2,6 +2,7 @@ inherit_from: ../.rubocop.yml AllCops: + EnableNewCops: true Exclude: <% `git status --ignored --porcelain`.lines.grep(/^!! /).each do |path| %> - <%= path.sub(/^!! /, '') %> From 5ff29fb5f97c6f3a3980dfc8a4d2af53a8f2d59c Mon Sep 17 00:00:00 2001 From: Alexey Romanov Date: Mon, 1 Dec 2025 18:26:09 +0000 Subject: [PATCH 04/11] Add rubocop-rails-omakase (no idea why CI wants it) --- react_on_rails/Gemfile.development_dependencies | 1 + react_on_rails/Gemfile.lock | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/react_on_rails/Gemfile.development_dependencies b/react_on_rails/Gemfile.development_dependencies index e883cdb93a..890b2aaa90 100644 --- a/react_on_rails/Gemfile.development_dependencies +++ b/react_on_rails/Gemfile.development_dependencies @@ -37,6 +37,7 @@ group :development, :test do 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 gem "rubocop-rspec", "~>2.26", require: false gem "spring", "~> 4.0" gem "lefthook", require: false diff --git a/react_on_rails/Gemfile.lock b/react_on_rails/Gemfile.lock index f4eaf53d4d..da8207353b 100644 --- a/react_on_rails/Gemfile.lock +++ b/react_on_rails/Gemfile.lock @@ -320,9 +320,22 @@ GEM rubocop (~> 1.41) rubocop-factory_bot (2.25.1) rubocop (~> 1.41) + rubocop-minitest (0.36.0) + rubocop (>= 1.61, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) rubocop-performance (1.20.2) rubocop (>= 1.48.1, < 2.0) rubocop-ast (>= 1.30.0, < 2.0) + rubocop-rails (2.29.1) + activesupport (>= 4.2.0) + rack (>= 1.1) + rubocop (>= 1.52.0, < 2.0) + rubocop-ast (>= 1.31.1, < 2.0) + rubocop-rails-omakase (1.0.0) + rubocop + rubocop-minitest + rubocop-performance + rubocop-rails rubocop-rspec (2.29.2) rubocop (~> 1.40) rubocop-capybara (~> 2.17) @@ -464,6 +477,7 @@ DEPENDENCIES rspec_junit_formatter rubocop (= 1.61.0) rubocop-performance (~> 1.20.0) + rubocop-rails-omakase (~> 1.0.0) rubocop-rspec (~> 2.26) sass-rails (~> 6.0) sdoc From 1fafb9c82502823274e93607c1aad4260cc30ad2 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 22:17:57 +0000 Subject: [PATCH 05/11] Remove invalid EnableNewCops config key from Pro RuboCop config 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 --- react_on_rails_pro/.rubocop.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/react_on_rails_pro/.rubocop.yml b/react_on_rails_pro/.rubocop.yml index 9a02a6158d..258907f06f 100644 --- a/react_on_rails_pro/.rubocop.yml +++ b/react_on_rails_pro/.rubocop.yml @@ -2,7 +2,6 @@ inherit_from: ../.rubocop.yml AllCops: - EnableNewCops: true Exclude: <% `git status --ignored --porcelain`.lines.grep(/^!! /).each do |path| %> - <%= path.sub(/^!! /, '') %> From 3701703818552c1c4d7341e8fb42444ddbf822aa Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 22:23:33 +0000 Subject: [PATCH 06/11] Add trailing blank line to root .rubocop.yml Co-authored-by: Ihab Adham --- .rubocop.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.rubocop.yml b/.rubocop.yml index 6262ea3166..819ff49265 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -97,3 +97,4 @@ RSpec/NestedGroups: Style/FrozenStringLiteralComment: EnforcedStyle: always + From e48275dcea61fe7d83aaa4fc011cc8bc360d5f7f Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 23:07:43 +0000 Subject: [PATCH 07/11] Fix vendor exclusion pattern to match vendor at any depth 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 --- .rubocop.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rubocop.yml b/.rubocop.yml index 819ff49265..b5eb59a25d 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -27,7 +27,7 @@ AllCops: - 'node_modules/**/*' - 'spec/fixtures/**/*' - 'spec/react_on_rails/dummy-for-generators/**/*' - - 'vendor/**/*' + - '**/vendor/**/*' Naming/FileName: Exclude: From d92a0909b521c6a984e2b9beeb02ab01803fbece Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 23:08:04 +0000 Subject: [PATCH 08/11] Add inherit_mode merge for Exclude arrays in child configs 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 --- react_on_rails/.rubocop.yml | 5 +++++ react_on_rails_pro/.rubocop.yml | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/react_on_rails/.rubocop.yml b/react_on_rails/.rubocop.yml index ffed51fe80..b0d688cba3 100644 --- a/react_on_rails/.rubocop.yml +++ b/react_on_rails/.rubocop.yml @@ -1,6 +1,11 @@ # Inherits from root config inherit_from: ../.rubocop.yml +# Merge Exclude arrays with parent instead of replacing them +inherit_mode: + merge: + - Exclude + AllCops: SuggestExtensions: false diff --git a/react_on_rails_pro/.rubocop.yml b/react_on_rails_pro/.rubocop.yml index 258907f06f..37482b5596 100644 --- a/react_on_rails_pro/.rubocop.yml +++ b/react_on_rails_pro/.rubocop.yml @@ -1,6 +1,11 @@ # Inherits from root config inherit_from: ../.rubocop.yml +# Merge Exclude arrays with parent instead of replacing them +inherit_mode: + merge: + - Exclude + AllCops: Exclude: <% `git status --ignored --porcelain`.lines.grep(/^!! /).each do |path| %> From 8b69a5a5384840f8411433eb1b608c0ba16a0e05 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Thu, 4 Dec 2025 23:55:52 +0000 Subject: [PATCH 09/11] Remove redundant RuboCop disable directives for Metrics/CyclomaticComplexity 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 --- .../react_on_rails/templates/base/base/bin/switch-bundler | 2 -- react_on_rails/lib/react_on_rails/doctor.rb | 4 ---- .../server_rendering_pool/ruby_embedded_java_script.rb | 1 - react_on_rails/lib/react_on_rails/system_checker.rb | 4 +--- react_on_rails/lib/react_on_rails/utils.rb | 1 - react_on_rails/lib/react_on_rails/version_checker.rb | 1 - 6 files changed, 1 insertion(+), 12 deletions(-) diff --git a/react_on_rails/lib/generators/react_on_rails/templates/base/base/bin/switch-bundler b/react_on_rails/lib/generators/react_on_rails/templates/base/base/bin/switch-bundler index 1ead3e3d07..62910b98fa 100755 --- a/react_on_rails/lib/generators/react_on_rails/templates/base/base/bin/switch-bundler +++ b/react_on_rails/lib/generators/react_on_rails/templates/base/base/bin/switch-bundler @@ -61,7 +61,6 @@ class BundlerSwitcher puts "✅ Updated assets_bundler to '#{@target_bundler}'" end - # rubocop:disable Metrics/CyclomaticComplexity def update_dependencies puts "📦 Updating package.json dependencies..." @@ -88,7 +87,6 @@ class BundlerSwitcher end # rubocop:enable Metrics/CyclomaticComplexity - # rubocop:disable Metrics/CyclomaticComplexity def install_dependencies puts "📥 Installing #{@target_bundler} dependencies..." diff --git a/react_on_rails/lib/react_on_rails/doctor.rb b/react_on_rails/lib/react_on_rails/doctor.rb index b79a8b3414..23018e18f6 100644 --- a/react_on_rails/lib/react_on_rails/doctor.rb +++ b/react_on_rails/lib/react_on_rails/doctor.rb @@ -468,7 +468,6 @@ def check_version_wildcards check_npm_wildcards end - # rubocop:disable Metrics/CyclomaticComplexity def check_gem_wildcards gemfile_path = ENV["BUNDLE_GEMFILE"] || "Gemfile" return unless File.exist?(gemfile_path) @@ -492,7 +491,6 @@ def check_gem_wildcards end # rubocop:enable Metrics/CyclomaticComplexity - # rubocop:disable Metrics/CyclomaticComplexity def check_npm_wildcards return unless File.exist?("package.json") @@ -538,7 +536,6 @@ def check_key_configuration_files check_server_rendering_engine end - # rubocop:disable Metrics/CyclomaticComplexity def check_layout_files layout_files = Dir.glob("app/views/layouts/**/*.erb") return if layout_files.empty? @@ -603,7 +600,6 @@ def check_server_rendering_engine end # rubocop:enable Metrics/CyclomaticComplexity - # rubocop:disable Metrics/CyclomaticComplexity def check_shakapacker_configuration_details return unless File.exist?("config/shakapacker.yml") diff --git a/react_on_rails/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb b/react_on_rails/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb index 8c4fd1863c..2d005eb627 100644 --- a/react_on_rails/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +++ b/react_on_rails/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb @@ -50,7 +50,6 @@ def reset_pool_if_server_bundle_was_modified # Note, js_code does not have to be based on React. # js_code MUST RETURN json stringify Object # Calling code will probably call 'html_safe' on return value before rendering to the view. - # rubocop:disable Metrics/CyclomaticComplexity def exec_server_render_js(js_code, render_options, js_evaluator = nil) js_evaluator ||= self if render_options.trace diff --git a/react_on_rails/lib/react_on_rails/system_checker.rb b/react_on_rails/lib/react_on_rails/system_checker.rb index 7298127024..518fd692c4 100644 --- a/react_on_rails/lib/react_on_rails/system_checker.rb +++ b/react_on_rails/lib/react_on_rails/system_checker.rb @@ -203,7 +203,7 @@ def check_react_on_rails_npm_package add_warning("⚠️ Could not parse package.json") end - def check_package_version_sync # rubocop:disable Metrics/CyclomaticComplexity + def check_package_version_sync return unless File.exist?("package.json") begin @@ -540,7 +540,6 @@ def check_version_patterns(npm_version, gem_version) MSG end - # rubocop:disable Metrics/CyclomaticComplexity def check_gemfile_version_patterns gemfile_path = ENV["BUNDLE_GEMFILE"] || "Gemfile" return unless File.exist?(gemfile_path) @@ -573,7 +572,6 @@ def check_gemfile_version_patterns end # rubocop:enable Metrics/CyclomaticComplexity - # rubocop:disable Metrics/CyclomaticComplexity def report_dependency_versions(package_json) all_deps = package_json["dependencies"]&.merge(package_json["devDependencies"] || {}) || {} diff --git a/react_on_rails/lib/react_on_rails/utils.rb b/react_on_rails/lib/react_on_rails/utils.rb index 264feaae49..7ef8b22eb1 100644 --- a/react_on_rails/lib/react_on_rails/utils.rb +++ b/react_on_rails/lib/react_on_rails/utils.rb @@ -467,7 +467,6 @@ def self.package_manager_remove_command(package_name) # # @example Absolute paths outside Rails.root (edge case) # normalize_to_relative_path("/other/path/bundles") # => "/other/path/bundles" - # rubocop:disable Metrics/CyclomaticComplexity def self.normalize_to_relative_path(path) return nil if path.nil? diff --git a/react_on_rails/lib/react_on_rails/version_checker.rb b/react_on_rails/lib/react_on_rails/version_checker.rb index 6e74fe37ab..87b94c4d8a 100644 --- a/react_on_rails/lib/react_on_rails/version_checker.rb +++ b/react_on_rails/lib/react_on_rails/version_checker.rb @@ -338,7 +338,6 @@ def parts private # Resolve version from lockfiles if available, otherwise use package.json version - # rubocop:disable Metrics/CyclomaticComplexity def resolve_version(package_json_version, package_name) # If package.json specifies a local path or URL, don't try to resolve from lockfiles # Lockfiles may contain placeholder versions like "0.0.0" for local links From 41143de5a6f764738de372f765b1fa5fcd0bbbe0 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Fri, 5 Dec 2025 00:02:26 +0000 Subject: [PATCH 10/11] Remove redundant RuboCop enable directives for Metrics/CyclomaticComplexity These enable directives are now unnecessary since their corresponding disable directives were removed in the previous commit. Co-authored-by: Ihab Adham --- .../react_on_rails/templates/base/base/bin/switch-bundler | 2 -- react_on_rails/lib/react_on_rails/doctor.rb | 4 ---- .../server_rendering_pool/ruby_embedded_java_script.rb | 1 - react_on_rails/lib/react_on_rails/system_checker.rb | 2 -- react_on_rails/lib/react_on_rails/utils.rb | 1 - react_on_rails/lib/react_on_rails/version_checker.rb | 1 - 6 files changed, 11 deletions(-) diff --git a/react_on_rails/lib/generators/react_on_rails/templates/base/base/bin/switch-bundler b/react_on_rails/lib/generators/react_on_rails/templates/base/base/bin/switch-bundler index 62910b98fa..21406f5a33 100755 --- a/react_on_rails/lib/generators/react_on_rails/templates/base/base/bin/switch-bundler +++ b/react_on_rails/lib/generators/react_on_rails/templates/base/base/bin/switch-bundler @@ -85,7 +85,6 @@ class BundlerSwitcher puts "✅ Removed #{@target_bundler == 'rspack' ? 'webpack' : 'rspack'} dependencies" File.write(package_json_path, JSON.pretty_generate(package_json)) end - # rubocop:enable Metrics/CyclomaticComplexity def install_dependencies puts "📥 Installing #{@target_bundler} dependencies..." @@ -121,7 +120,6 @@ class BundlerSwitcher puts "✅ Installed #{@target_bundler} dependencies" end - # rubocop:enable Metrics/CyclomaticComplexity def detect_package_manager return "yarn" if File.exist?("yarn.lock") diff --git a/react_on_rails/lib/react_on_rails/doctor.rb b/react_on_rails/lib/react_on_rails/doctor.rb index 23018e18f6..c88533aeae 100644 --- a/react_on_rails/lib/react_on_rails/doctor.rb +++ b/react_on_rails/lib/react_on_rails/doctor.rb @@ -489,7 +489,6 @@ def check_gem_wildcards # Ignore errors reading Gemfile end end - # rubocop:enable Metrics/CyclomaticComplexity def check_npm_wildcards return unless File.exist?("package.json") @@ -512,7 +511,6 @@ def check_npm_wildcards # Ignore other errors end end - # rubocop:enable Metrics/CyclomaticComplexity def check_key_configuration_files files_to_check = { @@ -562,7 +560,6 @@ def check_layout_files end end end - # rubocop:enable Metrics/CyclomaticComplexity # rubocop:disable Metrics/CyclomaticComplexity def check_server_rendering_engine @@ -628,7 +625,6 @@ def check_shakapacker_configuration_details checker.add_warning(" ⚠️ Could not run 'rake shakapacker:info': #{e.message}") end end - # rubocop:enable Metrics/CyclomaticComplexity def check_react_on_rails_configuration_details check_react_on_rails_initializer diff --git a/react_on_rails/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb b/react_on_rails/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb index 2d005eb627..d3d1e9e2de 100644 --- a/react_on_rails/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb +++ b/react_on_rails/lib/react_on_rails/server_rendering_pool/ruby_embedded_java_script.rb @@ -86,7 +86,6 @@ def exec_server_render_js(js_code, render_options, js_evaluator = nil) # We need to parse each chunk and replay the console messages. result.transform { |chunk| parse_result_and_replay_console_messages(chunk, render_options) } end - # rubocop:enable Metrics/CyclomaticComplexity def trace_js_code_used(msg, js_code, file_name = "tmp/server-generated.js", force: false) return unless ReactOnRails.configuration.trace || force diff --git a/react_on_rails/lib/react_on_rails/system_checker.rb b/react_on_rails/lib/react_on_rails/system_checker.rb index 518fd692c4..bffe04172d 100644 --- a/react_on_rails/lib/react_on_rails/system_checker.rb +++ b/react_on_rails/lib/react_on_rails/system_checker.rb @@ -570,7 +570,6 @@ def check_gemfile_version_patterns # Ignore errors reading Gemfile end end - # rubocop:enable Metrics/CyclomaticComplexity def report_dependency_versions(package_json) all_deps = package_json["dependencies"]&.merge(package_json["devDependencies"] || {}) || {} @@ -588,7 +587,6 @@ def report_dependency_versions(package_json) add_success("✅ React DOM #{react_dom_version}") end end - # rubocop:enable Metrics/CyclomaticComplexity def report_shakapacker_version return unless File.exist?("Gemfile.lock") diff --git a/react_on_rails/lib/react_on_rails/utils.rb b/react_on_rails/lib/react_on_rails/utils.rb index 7ef8b22eb1..4e39a19863 100644 --- a/react_on_rails/lib/react_on_rails/utils.rb +++ b/react_on_rails/lib/react_on_rails/utils.rb @@ -494,7 +494,6 @@ def self.normalize_to_relative_path(path) path_str end end - # rubocop:enable Metrics/CyclomaticComplexity def self.default_troubleshooting_section <<~DEFAULT diff --git a/react_on_rails/lib/react_on_rails/version_checker.rb b/react_on_rails/lib/react_on_rails/version_checker.rb index 87b94c4d8a..82321c00dd 100644 --- a/react_on_rails/lib/react_on_rails/version_checker.rb +++ b/react_on_rails/lib/react_on_rails/version_checker.rb @@ -358,7 +358,6 @@ def resolve_version(package_json_version, package_name) # Fall back to package.json version package_json_version end - # rubocop:enable Metrics/CyclomaticComplexity # Check if a version string represents a local path or URL def local_path_or_url_version?(version) From 957ce1d68c7872d912f6ef4ff933e357f3e6edf0 Mon Sep 17 00:00:00 2001 From: "claude[bot]" <41898282+claude[bot]@users.noreply.github.com> Date: Fri, 5 Dec 2025 00:13:01 +0000 Subject: [PATCH 11/11] Revert "Add rubocop-rails-omakase (no idea why CI wants it)" This reverts commit 5ff29fb5f97c6f3a3980dfc8a4d2af53a8f2d59c. The gem was added experimentally but is not needed. CI passes without it. Co-authored-by: Ihab Adham --- react_on_rails/Gemfile.development_dependencies | 1 - react_on_rails/Gemfile.lock | 6 ------ 2 files changed, 7 deletions(-) diff --git a/react_on_rails/Gemfile.development_dependencies b/react_on_rails/Gemfile.development_dependencies index 890b2aaa90..e883cdb93a 100644 --- a/react_on_rails/Gemfile.development_dependencies +++ b/react_on_rails/Gemfile.development_dependencies @@ -37,7 +37,6 @@ group :development, :test do 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 gem "rubocop-rspec", "~>2.26", require: false gem "spring", "~> 4.0" gem "lefthook", require: false diff --git a/react_on_rails/Gemfile.lock b/react_on_rails/Gemfile.lock index da8207353b..cb2e3496db 100644 --- a/react_on_rails/Gemfile.lock +++ b/react_on_rails/Gemfile.lock @@ -331,11 +331,6 @@ GEM rack (>= 1.1) rubocop (>= 1.52.0, < 2.0) rubocop-ast (>= 1.31.1, < 2.0) - rubocop-rails-omakase (1.0.0) - rubocop - rubocop-minitest - rubocop-performance - rubocop-rails rubocop-rspec (2.29.2) rubocop (~> 1.40) rubocop-capybara (~> 2.17) @@ -477,7 +472,6 @@ DEPENDENCIES rspec_junit_formatter rubocop (= 1.61.0) rubocop-performance (~> 1.20.0) - rubocop-rails-omakase (~> 1.0.0) rubocop-rspec (~> 2.26) sass-rails (~> 6.0) sdoc