-
Notifications
You must be signed in to change notification settings - Fork 35
/
.rubocop_dnsimple.yml
390 lines (325 loc) · 10.1 KB
/
.rubocop_dnsimple.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
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
---
# Defaults https://github.com/bbatsov/rubocop/blob/master/config/default.yml
#
# References:
# * https://github.com/bbatsov/ruby-style-guide
# * https://rubocop.readthedocs.io/
AllCops:
Exclude:
# Exclude .gemspec files because they are generally auto-generated
- '*.gemspec'
NewCops: enable
# In most cases, Gems are sorted alphabetically.
# However, in some few cases the order is relevant due to dependencies.
Bundler/OrderedGems:
Enabled: false
# This cop requires odd code indentations (as of rubocop 0.57.0)
# https://github.com/rubocop-hq/rubocop/issues/5956
Layout/AccessModifierIndentation:
Enabled: false
# It causes weird aligments, especially for specs.
Layout/BlockEndNewline:
Enabled: false
# Generally, the keyword style uses a lot of space. This is particularly true
# when you use case/if statements, in combination with a long-name variable.
#
# invoice_error_message = case error
# when 1 == 1
# do_something
# else
# do_else
# end
#
Layout/EndAlignment:
EnforcedStyleAlignWith: variable
# [codesmell]
Layout/LineLength:
Enabled: false
Exclude:
- 'spec/**/*_spec.rb'
- 'test/**/*_test.rb'
Max: 100
# [codesmell]
Lint/SuppressedException:
Enabled: false
# [codesmell]
Metrics/AbcSize:
Enabled: false
Exclude:
- 'spec/**/*_spec.rb'
- 'test/**/*_test.rb'
# [codesmell]
Metrics/BlockLength:
Enabled: false
# [codesmell]
Metrics/CyclomaticComplexity:
Enabled: false
Exclude:
- 'spec/**/*_spec.rb'
- 'test/**/*_test.rb'
# [codesmell]
Metrics/ClassLength:
Enabled: false
Exclude:
- 'spec/**/*_spec.rb'
- 'test/**/*_test.rb'
# [codesmell]
Metrics/MethodLength:
Enabled: false
Exclude:
- 'spec/**/*_spec.rb'
- 'test/**/*_test.rb'
Max: 10
# [codesmell]
Metrics/ModuleLength:
Enabled: false
Exclude:
- 'spec/**/*_spec.rb'
- 'test/**/*_test.rb'
# [codesmell]
Metrics/ParameterLists:
Enabled: false
Max: 5
# [codesmell]
Metrics/PerceivedComplexity:
Enabled: false
# We tend to use @_name to represent a variable that is memoized,
# but it should not be accessed directly and kept as private.
Naming/MemoizedInstanceVariableName:
Enabled: false
# We use it from time to time, as it's not always possible (or maintainable)
# to use simple ? methods.
# Moreover, it's actually more efficient to not-use predicates:
# https://github.com/bbatsov/rubocop/issues/3633
Naming/PredicateName:
Enabled: false
# The team agreed decided to use exception
Naming/RescuedExceptionsVariableName:
PreferredName: 'exception'
# This cop triggers several false positives that make sense in our domain model.
# For instance, ip is considered an uncommunicative parameter name:
#
# ipv4_to_arpa_name(ip)
#
Naming/MethodParameterName:
Enabled: false
# This cop returns false positive violations (as of rubocop 0.57.0)
# https://github.com/rubocop-hq/rubocop/issues/5953
Style/AccessModifierDeclarations:
Enabled: false
# Do not use "and" or "or" in conditionals, but for readability we can use it
# to chain executions. Just beware of operator order.
Style/AndOr:
EnforcedStyle: conditionals
# No specific reason, except that %q() is easier to grep than %()
Style/BarePercentLiterals:
EnforcedStyle: percent_q
# braces_for_chaining seems a good fit of what we've been doing so far.
Style/BlockDelimiters:
EnforcedStyle: braces_for_chaining
AllowedMethods:
- expect
# Warn on empty else.
Style/EmptyElse:
EnforcedStyle: empty
# There is no specific preference for empty methods.
# One-line methods are not exceptionally nice in Ruby.
# Just ignore this cop for now.
Style/EmptyMethod:
Enabled: false
# We don't care about the format style.
# In most cases we use %, but not at the point we want to enforce it
# as a convention in the entire code.
Style/FormatString:
Enabled: false
# Annotated tokens (like %<foo>s) are a good thing,
# but in most cases we don't need them.
# %s is a simpler and straightforward version that works in almost all cases.
# So don't complain.
Style/FormatStringToken:
Enabled: false
# Prefer the latest Hash syntax
Style/HashSyntax:
Exclude:
# Rakefiles generally have definitions like
# :default => :test
# that looks nicer with the old rocket syntax.
- 'Rakefile'
# Enforces usage of Hash#each_key and Hash#each_value (vs. Hash#keys.each
# and Hash#values.each).
Style/HashEachMethods:
Enabled: true
# Enforce the use of Hash#TransformKeys introduced in Ruby 2.5 to transform
# Hash keys.
Style/HashTransformKeys:
Enabled: true
# Enforce the use of Hash#TransformValues introduced in Ruby 2.5 to transform
# Hash values.
Style/HashTransformValues:
Enabled: true
# We want to be able to decide when to use one-line if/unless modifiers.
Style/IfUnlessModifier:
Enabled: false
# [codesmell]
# It's not always that bad.
Style/IfInsideElse:
Enabled: false
# module_function doesn't respect the visibility of the methods,
# and doesn't work well when the module contains both public/private methods.
Style/ModuleFunction:
Enabled: false
Style/MultilineBlockChain:
Exclude:
# RSpec uses multi-line blocks for certain features
- 'spec/**/*_spec.rb'
# unless is not always cool.
Style/NegatedIf:
Enabled: false
# Magic numbers are not welcomed
Style/NumericLiterals:
Exclude:
# however tests can use numeric literals for method calls,
# without the need to define a variable just for that.
- 'spec/**/*_spec.rb'
- 'test/**/*_test.rb'
# For years, %w() has been the de-facto standard.
# A lot of libraries are using (). Switching to [] would be a nightmare.
Style/PercentLiteralDelimiters:
Enabled: false
# Enable but only for multiple returns value.
#
# return foo, bar
#
# reads much better than
#
# [foo, bar]
#
Style/RedundantReturn:
AllowMultipleReturnValues: true
# Do we care?
Style/RegexpLiteral:
Enabled: false
# There are cases were the inline rescue is ok. We can either downgrade
# the severity, or rely on the developer judgement on a case-by-case basis.
Style/RescueModifier:
Enabled: false
# This is quite annoying, especially in cases where we don't control it
# (e.g. schema.rb).
Style/SymbolArray:
Enabled: false
# We don't have a preference.
Style/SpecialGlobalVars:
Enabled: false
EnforcedStyle: use_perl_names
# We generally use double quotes, sometimes single quotes.
# Should we enforce it at code level?
Style/StringLiterals:
Enabled: false
EnforcedStyle: double_quotes
# As before.
Style/StringLiteralsInInterpolation:
Enabled: false
EnforcedStyle: double_quotes
# It's nice to be consistent. The trailing comma also allows easy reordering,
# and doesn't cause a diff in Git when you add a line to the bottom.
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: consistent_comma
# It's nice to be consistent. The trailing comma also allows easy reordering,
# and doesn't cause a diff in Git when you add a line to the bottom.
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: consistent_comma
Style/TrivialAccessors:
# IgnoreClassMethods because I want to be able to define class-level accessors
# that sets an instance variable on the metaclass, such as:
#
# def self.default=(value)
# @default = value
# end
#
IgnoreClassMethods: true
Style/WordArray:
EnforcedStyle: percent
MinSize: 3
# Forces the order of comparison arguments.
#
# According to this cop, the following statement is bad:
#
# "https" == uri.scheme
#
# Whereas the following is considered good:
#
# uri.scheme == "https"
Style/YodaCondition:
Enabled: false
# For the same reason of EndAlignment, aligning with the case may have
# a bad impact on a case after a very long variable.
#
# invoice_error_message = case error
# when 1 == 1
# do_something
# else
# do_else
# end
#
Layout/CaseIndentation:
EnforcedStyle: end
# I was a big fan of leading, but trailing seems to be more commonly adopted.
# At least at the time being.
Layout/DotPosition:
EnforcedStyle: leading
# Double empty lines are useful to separate conceptually different methods
# in the same class or module.
Layout/EmptyLines:
Enabled: false
# This is buggy. It detects as a style violation a few `class`
# and `module` definitions
Layout/EmptyLinesAroundArguments:
Enabled: false
Layout/EmptyLinesAroundBlockBody:
Exclude:
# RSpec is all made of blocks. Disable this config in RSpec
# to be consistent with EmptyLinesAroundClassBody
# and EmptyLinesAroundModuleBody
- 'spec/**/*_spec.rb'
- 'test/**/*_test.rb'
# In most cases, a space is nice. Sometimes, it's not.
# Just be consistent with the rest of the surrounding code.
Layout/EmptyLinesAroundClassBody:
Enabled: false
# We're ok with it. We use it quite often for method-level rescue statements.
Layout/EmptyLinesAroundExceptionHandlingKeywords:
Enabled: false
# In most cases, a space is nice. Sometimes, it's not.
# Just be consistent with the rest of the surrounding code.
Layout/EmptyLinesAroundModuleBody:
Enabled: false
# This is quite buggy, as it doesn't recognize double lines.
Layout/EmptyLineBetweenDefs:
Enabled: false
# Multi-line differs from standard indentation, they are indented twice.
Layout/FirstArgumentIndentation:
IndentationWidth: 4
# Array indentation should be consistent with method/variable definition.
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
# Hash indentation should be consistent with method/variable definition.
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
# Multi-line differs from standard indentation, they are indented twice.
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
IndentationWidth: 4
# Multi-line differs from standard indentation, they are indented twice.
Layout/MultilineOperationIndentation:
EnforcedStyle: indented
IndentationWidth: 4
# Sorry, but using trailing spaces helps readability.
#
# %w( foo bar )
#
# looks better than:
#
# %w(foo bar)
#
Layout/SpaceInsidePercentLiteralDelimiters:
Enabled: false