Skip to content

Commit 0812423

Browse files
committed
Unify Rubocop config
1 parent a411917 commit 0812423

File tree

5 files changed

+96
-156
lines changed

5 files changed

+96
-156
lines changed

.prettierignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ spec/dummy/public
1919
*.res.js
2020

2121
# Prettier doesn't understand ERB syntax in YAML files and can damage templates
22-
.rubocop.yml
2322
*.yml
2423
*.yaml
2524
# Intentionally invalid

.rubocop.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Root RuboCop configuration for React on Rails monorepo
2+
# This contains shared settings inherited by react_on_rails/ and react_on_rails_pro/
3+
require:
4+
- rubocop-performance
5+
- rubocop-rspec
6+
7+
AllCops:
8+
NewCops: enable
9+
DisplayCopNames: true
10+
TargetRubyVersion: 3.0
11+
12+
Include:
13+
- '**/Rakefile'
14+
- '**/config.ru'
15+
- 'Gemfile'
16+
- '**/*.rb'
17+
- '**/*.rake'
18+
19+
Exclude:
20+
- '**/*.js'
21+
- '**/node_modules/**/*'
22+
- '**/public/**/*'
23+
- '**/tmp/**/*'
24+
- 'coverage/**/*'
25+
- 'gen-examples/**/*'
26+
- 'node_modules/**/*'
27+
- 'spec/fixtures/**/*'
28+
- 'spec/react_on_rails/dummy-for-generators/**/*'
29+
- 'vendor/**/*'
30+
31+
Naming/FileName:
32+
Exclude:
33+
- '**/Gemfile'
34+
- '**/Rakefile'
35+
36+
Layout/LineLength:
37+
Max: 120
38+
39+
Style/StringLiterals:
40+
EnforcedStyle: double_quotes
41+
42+
Style/Documentation:
43+
Enabled: false
44+
45+
Style/HashEachMethods:
46+
Enabled: true
47+
48+
Style/HashTransformKeys:
49+
Enabled: true
50+
51+
Style/HashTransformValues:
52+
Enabled: true
53+
54+
Metrics/AbcSize:
55+
Max: 28
56+
57+
Metrics/PerceivedComplexity:
58+
Max: 10
59+
60+
Metrics/ParameterLists:
61+
Max: 5
62+
CountKeywordArgs: false
63+
64+
Metrics/MethodLength:
65+
Max: 41
66+
67+
Metrics/ModuleLength:
68+
Max: 180
69+
70+
RSpec/DescribeClass:
71+
Enabled: false
72+
73+
RSpec/ExampleLength:
74+
Enabled: false
75+
76+
RSpec/MessageSpies:
77+
Enabled: false
78+
79+
RSpec/MessageChain:
80+
Enabled: false
81+
82+
RSpec/MultipleExpectations:
83+
Enabled: false
84+
85+
RSpec/MultipleMemoizedHelpers:
86+
Max: 12
87+
88+
Style/FrozenStringLiteralComment:
89+
EnforcedStyle: always

react_on_rails/.rubocop.yml

Lines changed: 2 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,18 @@
1-
# This is the configuration used to check the rubocop source code.
2-
# Check out: https://github.com/bbatsov/rubocop
3-
require:
4-
- rubocop-performance
5-
- rubocop-rspec
1+
# Inherits from root config
2+
inherit_from: ../.rubocop.yml
63

74
AllCops:
8-
NewCops: enable
9-
DisplayCopNames: true
10-
TargetRubyVersion: 3.0.0
115
SuggestExtensions: false
126

13-
Include:
14-
- '**/Rakefile'
15-
- '**/config.ru'
16-
- 'Gemfile'
17-
- '**/*.rb'
18-
- '**/*.rake'
19-
207
Exclude:
21-
- '**/*.js'
22-
- '**/node_modules/**/*'
23-
- '**/public/**/*'
24-
- '**/tmp/**/*'
25-
- 'coverage/**/*'
26-
- 'gen-examples/examples/**/*'
27-
- 'node_modules/**/*'
28-
- '../react_on_rails_pro/**/*' # Exclude pro package (has its own linting)
298
- 'spec/dummy/bin/*'
30-
- 'spec/fixtures/**/*'
31-
- 'spec/react_on_rails/dummy-for-generators/**/*'
32-
- 'tmp/**/*'
33-
- 'vendor/**/*'
349

3510
Naming/FileName:
3611
Exclude:
3712
- '**/Gemfile*'
3813
- '**/Rakefile'
3914
- '**/Steepfile'
4015

41-
Layout/LineLength:
42-
Max: 120
43-
44-
Style/StringLiterals:
45-
EnforcedStyle: double_quotes
46-
47-
Style/Documentation:
48-
Enabled: false
49-
50-
Style/HashEachMethods:
51-
Enabled: true
52-
53-
Style/HashTransformKeys:
54-
Enabled: true
55-
56-
Style/HashTransformValues:
57-
Enabled: true
58-
5916
Lint/AssignmentInCondition:
6017
Exclude:
6118
- 'spec/dummy/bin/spring'
@@ -66,33 +23,23 @@ Lint/SuppressedException:
6623
- 'spec/dummy/bin/rake'
6724

6825
Metrics/AbcSize:
69-
Max: 28
7026
Exclude:
7127
- 'lib/generators/react_on_rails/install_generator.rb' # Generator setup methods require comprehensive error handling
7228

7329
Metrics/CyclomaticComplexity:
7430
Max: 7
7531

76-
Metrics/PerceivedComplexity:
77-
Max: 10
78-
7932
Metrics/ClassLength:
8033
Max: 150
8134
Exclude:
8235
- 'lib/generators/react_on_rails/base_generator.rb' # Generator complexity justified
8336
- 'lib/react_on_rails/dev/server_manager.rb' # Dev tool with comprehensive help system
8437

85-
Metrics/ParameterLists:
86-
Max: 5
87-
CountKeywordArgs: false
88-
8938
Metrics/MethodLength:
90-
Max: 41
9139
Exclude:
9240
- 'lib/generators/react_on_rails/install_generator.rb' # Generator setup methods require comprehensive error handling
9341

9442
Metrics/ModuleLength:
95-
Max: 180
9643
Exclude:
9744
- 'spec/react_on_rails/engine_spec.rb' # Comprehensive engine tests require many examples
9845

@@ -107,15 +54,6 @@ RSpec/AnyInstance:
10754
- 'spec/react_on_rails/binstubs/dev_static_spec.rb'
10855
- 'spec/react_on_rails/dev/**/*_spec.rb' # Dev module tests require system mocking
10956

110-
RSpec/DescribeClass:
111-
Enabled: false
112-
113-
RSpec/ExampleLength:
114-
Enabled: false
115-
116-
RSpec/MessageSpies:
117-
Enabled: false
118-
11957
RSpec/NestedGroups:
12058
Max: 4
12159

@@ -127,19 +65,10 @@ RSpec/BeforeAfterAll:
12765
- 'spec/react_on_rails/binstubs/dev_static_spec.rb'
12866
- 'spec/react_on_rails/dev/**/*_spec.rb' # Dev module tests require global setup
12967

130-
RSpec/MessageChain:
131-
Enabled: false
132-
133-
RSpec/MultipleExpectations:
134-
Enabled: false
135-
13668
RSpec/MultipleDescribes:
13769
Exclude:
13870
- 'spec/dummy/spec/system/integration_spec.rb'
13971

140-
RSpec/MultipleMemoizedHelpers:
141-
Max: 12
142-
14372
Style/GlobalVars:
14473
Exclude:
14574
- 'spec/dummy/config/environments/development.rb'
@@ -156,4 +85,3 @@ RSpec/InstanceVariable:
15685
RSpec/StubbedMock:
15786
Exclude:
15887
- 'spec/react_on_rails/dev/**/*_spec.rb' # Dev module tests use mixed stub/mock patterns
159-

react_on_rails_pro/.prettierignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ spec/dummy/.yalc/
99

1010
# File Generated by ROR FS-based Registry
1111
**/generated
12+
13+
# Prettier doesn't understand ERB in RuboCop config
14+
.rubocop.yml

react_on_rails_pro/.rubocop.yml

Lines changed: 2 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,90 +1,23 @@
1-
# This is the configuration used to check the rubocop source code.
2-
# Check out: https://github.com/bbatsov/rubocop
3-
require:
4-
- rubocop-performance
5-
- rubocop-rspec
1+
# Inherits from root config
2+
inherit_from: ../.rubocop.yml
63

74
AllCops:
8-
NewCops: enable
9-
DisplayCopNames: true
10-
TargetRubyVersion: 3.0
11-
12-
Include:
13-
- '**/Rakefile'
14-
- '**/config.ru'
15-
- 'Gemfile'
16-
- '**/*.rb'
17-
- '**/*.rake'
18-
195
Exclude:
206
<% `git status --ignored --porcelain`.lines.grep(/^!! /).each do |path| %>
217
- <%= path.sub(/^!! /, '') %>
228
<% end %>
23-
- '**/node_modules/**/*'
249
- 'db/schema.rb'
2510
- 'db/seeds.rb'
26-
- 'spec/fixtures/**/*'
2711
- 'spec/dummy/db/schema.rb'
2812
- 'spec/dummy/bin/**/*'
29-
- 'node_modules/**/*'
30-
- 'coverage/**/*'
3113
- 'bin/**/*'
32-
- 'vendor/**/*'
33-
34-
Naming/FileName:
35-
Exclude:
36-
- '**/Gemfile'
37-
- '**/Rakefile'
38-
39-
Layout/LineLength:
40-
Max: 120
41-
42-
Style/StringLiterals:
43-
EnforcedStyle: double_quotes
44-
45-
Style/Documentation:
46-
Enabled: false
47-
48-
Style/HashEachMethods:
49-
Enabled: true
50-
51-
Style/HashTransformKeys:
52-
Enabled: true
53-
54-
Style/HashTransformValues:
55-
Enabled: true
56-
57-
Metrics/AbcSize:
58-
Max: 28
5914

6015
Metrics/CyclomaticComplexity:
6116
Max: 8
6217

63-
Metrics/PerceivedComplexity:
64-
Max: 10
65-
6618
Metrics/ClassLength:
6719
Max: 140
6820

69-
Metrics/ParameterLists:
70-
Max: 5
71-
CountKeywordArgs: false
72-
73-
Metrics/MethodLength:
74-
Max: 41
75-
76-
Metrics/ModuleLength:
77-
Max: 180
78-
79-
RSpec/DescribeClass:
80-
Enabled: false
81-
82-
RSpec/ExampleLength:
83-
Enabled: false
84-
85-
RSpec/MessageSpies:
86-
Enabled: false
87-
8821
RSpec/NestedGroups:
8922
Max: 5
9023

@@ -93,19 +26,10 @@ RSpec/BeforeAfterAll:
9326
- 'spec/react_on_rails/generators/dev_tests_generator_spec.rb'
9427
- 'spec/react_on_rails/generators/install_generator_spec.rb'
9528

96-
RSpec/MessageChain:
97-
Enabled: false
98-
99-
RSpec/MultipleExpectations:
100-
Enabled: false
101-
10229
RSpec/MultipleDescribes:
10330
Exclude:
10431
- 'spec/dummy/spec/system/integration_spec.rb'
10532

106-
RSpec/MultipleMemoizedHelpers:
107-
Max: 12
108-
10933
RSpec:
11034
Language:
11135
Expectations:
@@ -115,6 +39,3 @@ RSpec:
11539
Style/GlobalVars:
11640
Exclude:
11741
- 'spec/dummy/config/environments/development.rb'
118-
119-
Style/FrozenStringLiteralComment:
120-
EnforcedStyle: always

0 commit comments

Comments
 (0)