-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path.rubocop.yml
263 lines (220 loc) · 4.98 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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
inherit_from:
- .rubocop_todo.yml
- .rubocop_enabled.yml
- .rubocop_disabled.yml
require:
- rubocop-rails
# - .rubocop_todo.yml
AllCops:
Include:
- '**/*.rb'
- '**/*.jbuilder'
- '**/*.rake'
- '**/config.ru'
- '**/Gemfile'
- '**/Rakefile'
Exclude:
- 'bin/**/*'
- 'node_modules/**/*'
- 'vendor/**/*'
DisplayCopNames: true
TargetRubyVersion: 2.6
TargetRailsVersion: 6.0
#===============
# Layout
#===============
Layout/AlignHash:
EnforcedLastArgumentHashStyle: ignore_implicit
# Prefer this:
#
# Foo.new(wibble: [
# something,
# something_else
# ])
#
# to this:
#
# Foo.new(wibble: [
# something,
# something_else
# ])
Layout/IndentFirstArrayElement:
EnforcedStyle: consistent
# Prefer this:
#
# Foo.new(wibble: {
# a: something,
# b: something_else
# })
#
# to this:
#
# Foo.new(wibble: {
# a: something,
# b: something_else
# })
Layout/IndentFirstHashElement:
EnforcedStyle: consistent
Layout/MultilineAssignmentLayout:
SupportedTypes:
- case
- class
- if
- kwbegin
- module
# This is the default VIM indentation.
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
# This is the default VIM indentation.
Layout/MultilineOperationIndentation:
EnforcedStyle: indented
# No need to provide for ASCII art in assignments (the default is to allow
# #= and #=> to have multiple spaces).
Layout/SpaceAroundOperators:
AllowForAlignment: false
Layout/TrailingBlankLines:
EnforcedStyle: final_blank_line
#===============
# Naming
#===============
Naming/FileName:
Exclude:
- 'gems/**/*'
- lib/jasmine-rails-webpacker.rb
#===============
# Style
#===============
# JSON matchers involve a lot of chaining, which looks much better with {...}
# as oppposed to do/end.
Style/BlockDelimiters:
Exclude:
- spec/views/**/*
# Better to be explicit with multiple hashes lying around.
Style/BracesAroundHashParameters:
EnforcedStyle: context_dependent
# Compactness is next to godliness.
Style/ClassAndModuleChildren:
EnforcedStyle: compact
Style/CollectionMethods:
# ...ect
PreferredMethods:
map: 'collect'
map!: 'collect!'
reduce: 'inject'
reduce!: 'inject!'
find: 'detect'
keep_if: 'select!'
delete_if: 'reject!'
# Use backticks on single-line commands, and %x on multi-line commands.
Style/CommandLiteral:
EnforcedStyle: mixed
AllowInnerBackticks: false
# Let's be honest, if you're putting 'HACK' comments into your code then you
# need more than static style analysis.
Style/CommentAnnotation:
Keywords:
- TODO
# Sometimes we have to coerce types to actual boolean types in JBuilder views,
# in order to get the right JSON type.
Style/DoubleNegation:
Exclude:
- '**/*.jbuilder'
# This cop crashes on JBuilder templates.
Style/FrozenStringLiteralComment:
Exclude:
- '**/*.jbuilder'
# Prefer stabby lambdas. Because they're stabby.
Style/Lambda:
EnforcedStyle: literal
# json.(... is idiomatic for JBuilder
Style/LambdaCall:
Exclude:
- '**/**.json.jbuilder'
# Don't require else clauses for if statements; sometimes a nil return value is
# just what the doctor ordered.
Style/MissingElse:
EnforcedStyle: case
# JSON matchers involve a lot of chaining
Style/MultilineBlockChain:
Exclude:
- spec/views/**/*
# No explicit nil checks.
Style/NonNilCheck:
IncludeSemanticChanges: true
# We don't pass backtraces, so this should be fine.
Style/RaiseArgs:
EnforcedStyle: compact
# Use slashes on single-line regexes, and %r on multi-line regexes.
Style/RegexpLiteral:
EnforcedStyle: mixed
AllowInnerSlashes: false
Style/RescueStandardError:
EnforcedStyle: implicit
# e.g. subject { render; rendered }
Style/Semicolon:
Exclude:
- spec/**/*
Style/StringLiterals:
Exclude:
# auto-generated
- bin/**/*
# Rspec snippets are everywhere.
- spec/**/*
# Ignore auto-generated files, and the like.
Style/SymbolArray:
Exclude:
- Gemfile
- lib/tasks/*.rake
Style/TrivialAccessors:
# Allows trivial writers that don't end in an equal sign. e.g.
#
# def on_exception(action)
# @on_exception=action
# end
# on_exception :restart
#
# Commonly used in DSLs
AllowDSLWriters: true
# Allow methods like this:
#
# def foo?
# @foo
# end
AllowPredicates: true
#===============
# Lint
#===============
Lint/HandleExceptions:
Exclude:
- spec/**/*
Lint/Void:
Exclude:
- spec/**/*
#===============
# Metrics
#===============
Metrics/AbcSize:
Exclude:
- db/migrate/*
Metrics/BlockLength:
Exclude:
- app/views/**/*
- config/**/*
- spec/**/*
Metrics/ClassLength:
Exclude:
- db/migrate/*
Metrics/MethodLength:
Exclude:
- db/migrate/*
Metrics/ParameterLists:
CountKeywordArgs: false
#===============
# Rails
#===============
Rails/DynamicFindBy:
Whitelist:
# This is a Rails finder method
- find_by_sql
# We add this for proper finding in controllers
- find_by_param!