-
Notifications
You must be signed in to change notification settings - Fork 7
/
.rubocop.yml
216 lines (191 loc) · 4.06 KB
/
.rubocop.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
require:
- rubocop-performance
- rubocop-rails
- rubocop-rspec
AllCops:
NewCops: enable
Exclude:
- 'bin/**/*'
- 'config/application.rb'
- 'config/deploy.rb'
- 'config/deploy/*.rb'
- 'config/routes.rb'
- 'db/migrate/**/*'
- 'db/schema.rb'
- 'db/seeds.rb'
- 'vendor/**/*'
# Align "end" with variable.
#
# # Bad
# variable = if thing
# end
#
# # Good
# variable = if thing
# end
#
Layout/EndAlignment:
EnforcedStyleAlignWith: variable
# Indent parameters with two spaces only.
#
# # Bad
# call_this_long_method(
# with_inner_call(
# my_parameters
# )
# )
#
# # Good
# call_this_long_method(with_inner_call(
# my_parameters
# ))
#
Layout/FirstArgumentIndentation:
EnforcedStyle: consistent
Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation
# Indent array values with two spaces only.
#
# # Bad
# my_array = [ 1,
# 2,
# 3 ]
# # Good
# my_array = [
# 1,
# 2,
# 3
# ]
#
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
# Indent hash keys with two spaces only.
#
# # Bad
# my_hash = { "one" => 1,
# "two" => 2,
# "three" => 3 }
#
# # Good
# my_hash = {
# "one" => 1,
# "two" => 2,
# "three" => 3
# }
#
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
Layout/HashAlignment:
Enabled: false
# Max line length is 100 characters. The RuboCop default is 120; the Ruby Style Guide makes a good
# argument (https://rubystyle.guide/#max-line-length) for keeping this at 80, but to do so is a
# little limiting when there are multiple nested modules. We compromise at 100.
Layout/LineLength:
Max: 100
# Ignore long comments in deploy configs.
Exclude:
- config/deploy.rb
- config/deploy/*.rb
AllowedPatterns:
- '(context|context|it|shared_examples_for)'
# Multi-line method calls are indented by two spaces only.
#
# # Bad
# MyClass.where(thing: true, another: 'yes')
# .order(:created_at)
# .limit(5)
#
# # Good
# MyClass.where(thing: true, another: 'yes')
# .order(:created_at).limit(5)
#
# # Good
# MyClass.where(thing: true, another: 'yes')
# .order(:created_at)
# .limit(5)
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
Layout/MultilineOperationIndentation:
EnforcedStyle: indented
# Multi-line parameters should be indented by two spaces only.
#
# # Bad
# call_something(param_one,
# param_two,
# param_three)
#
# # Good
# call_something(
# param_one, param_two, param_three
# )
#
# # Acceptable, but not as readable
# call_something(param_one
# param_two, param_three)
#
Layout/ParameterAlignment:
EnforcedStyle: with_fixed_indentation
Lint/MissingSuper:
Exclude:
- app/components/**/*.rb
# Prefer alias_method over alias
Style/Alias:
EnforcedStyle: prefer_alias_method
# Only suggest guard clauses when a block is three or more lines long.
Style/GuardClause:
MinBodyLength: 3 # Default is 1.
Style/MethodCallWithArgsParentheses:
Enabled: true
IgnoreMacros: true
AllowedMethods:
- can
- cannot
- describe
- head
- not_to
- puts
- raise
- redirect_to
- render
- render_serializer
- require
- require_dependency
- require_relative
- shared_examples_for
- to
- yield
Exclude:
- Gemfile
- config/puma.rb
Metrics:
Enabled: false
# GQL functions are all uppercase.
Naming/MethodName:
Exclude:
- 'app/models/gql/runtime/functions/*'
Naming/VariableNumber:
Enabled: false
Rails/UnknownEnv:
Environments:
- development
- production
- staging
- test
# Don't require methods to be in separate spec files.
RSpec/FilePath:
Enabled: false
RSpec/ExampleLength:
Enabled: false
RSpec/MultipleExpectations:
Exclude:
- spec/components/**/*_spec.rb
- spec/mailers/**/*_spec.rb
- spec/system/**/*_spec.rb
RSpec/NamedSubject:
Enabled: false
RSpec/DescribeClass:
Exclude:
- 'spec/requests/**/*'
RSpec/RepeatedExampleGroupBody:
Exclude:
- 'spec/models/gql/runtime/functions/*.rb'