Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
99 changes: 99 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# 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/**/*'
Copy link
Contributor

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.


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/ClassLength:
Max: 150

Metrics/CyclomaticComplexity:
Max: 8

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

RSpec/NestedGroups:
Max: 5

Style/FrozenStringLiteralComment:
EnforcedStyle: always
83 changes: 2 additions & 81 deletions react_on_rails/.rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,61 +1,18 @@
# 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:
- '**/Gemfile*'
- '**/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'
Expand All @@ -66,33 +23,19 @@ 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

Expand All @@ -107,18 +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/DescribeClass:
Enabled: false

RSpec/ExampleLength:
Enabled: false

RSpec/MessageSpies:
Enabled: false

RSpec/NestedGroups:
Max: 4

RSpec/BeforeAfterAll:
Exclude:
- 'spec/react_on_rails/generators/dev_tests_generator_spec.rb'
Expand All @@ -127,19 +58,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'
Expand All @@ -156,4 +78,3 @@ RSpec/InstanceVariable:
RSpec/StubbedMock:
Exclude:
- 'spec/react_on_rails/dev/**/*_spec.rb' # Dev module tests use mixed stub/mock patterns

1 change: 1 addition & 0 deletions react_on_rails/Gemfile.development_dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions react_on_rails/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions react_on_rails_pro/.prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading
Loading