-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy path.rubocop_dnsimple.yml
333 lines (276 loc) · 8.64 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
# 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
Style/AccessorGrouping:
Enabled: true
EnforcedStyle: separated
# 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
# Pick one option for consistency.
Style/BlockDelimiters:
EnforcedStyle: braces_for_chaining
AllowedMethods:
- expect
# Warn on empty else.
Style/EmptyElse:
EnforcedStyle: empty
# Pick one option for consistency.
Style/EmptyMethod:
EnforcedStyle: expanded
# 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'
# 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'
# Enable but only for multiple returns value.
#
# return foo, bar
#
# reads much better than
#
# [foo, bar]
#
Style/RedundantReturn:
AllowMultipleReturnValues: true
# 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
# Pick one option for consistency.
Style/StringLiteralsInInterpolation:
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
# 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
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'
# Pick one option for consistency. beginning+ending is the most used approach.
Layout/EmptyLinesAroundClassBody:
EnforcedStyle: empty_lines_except_namespace
# We're ok with it. We use it quite often for method-level rescue statements.
Layout/EmptyLinesAroundExceptionHandlingKeywords:
Enabled: false
# Pick one option for consistency. beginning+ending is the most used approach.
Layout/EmptyLinesAroundModuleBody:
EnforcedStyle: empty_lines_except_namespace
# 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