validates_zipcode 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +39 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +28 -907
- data/Appraisals +4 -12
- data/CHANGELOG.md +4 -2
- data/Gemfile +5 -0
- data/README.md +2 -2
- data/gemfiles/rails_8.0.gemfile +11 -0
- data/gemfiles/rails_8.1.gemfile +11 -0
- data/gemfiles/rails_edge.gemfile +4 -0
- data/lib/validates_zipcode/cldr_regex_collection.rb +33 -33
- data/lib/validates_zipcode/formatter.rb +1 -1
- data/lib/validates_zipcode/version.rb +1 -1
- data/lib/validates_zipcode.rb +4 -4
- data/spec/format_zipcode_spec.rb +1 -1
- data/spec/spec_helper.rb +31 -31
- data/spec/validates_zipcode_spec.rb +10 -3
- data/validates_zipcode.gemspec +6 -10
- metadata +14 -105
- data/.travis.yml +0 -44
- data/gemfiles/rails_4.2.gemfile +0 -7
- data/gemfiles/rails_4.2.gemfile.lock +0 -84
- data/gemfiles/rails_5.2.gemfile +0 -7
- data/gemfiles/rails_5.2.gemfile.lock +0 -82
- data/gemfiles/rails_6.1.gemfile +0 -7
- data/gemfiles/rails_6.1.gemfile.lock +0 -85
- data/gemfiles/rails_7.0.gemfile +0 -7
- data/gemfiles/rails_7.0.gemfile.lock +0 -85
- data/gemfiles/rails_edge.gemfile.lock +0 -89
data/.rubocop.yml
CHANGED
|
@@ -1,947 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
inherit_mode:
|
|
2
|
+
merge:
|
|
3
|
+
- Exclude
|
|
3
4
|
|
|
4
|
-
inherit_from:
|
|
5
|
-
# - enabled.yml
|
|
6
|
-
# - disabled.yml
|
|
7
|
-
|
|
8
|
-
require:
|
|
9
|
-
- rubocop-rails
|
|
10
|
-
|
|
11
|
-
# Common configuration.
|
|
12
5
|
AllCops:
|
|
13
|
-
TargetRubyVersion:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
# Include common Ruby source files.
|
|
18
|
-
Include:
|
|
19
|
-
- '**/*.gemspec'
|
|
20
|
-
- '**/*.gemfile'
|
|
21
|
-
- '**/*.podspec'
|
|
22
|
-
- '**/*.jbuilder'
|
|
23
|
-
- '**/*.rake'
|
|
24
|
-
- '**/*.opal'
|
|
25
|
-
- '**/config.ru'
|
|
26
|
-
- '**/Gemfile'
|
|
27
|
-
- '**/Rakefile'
|
|
28
|
-
- '**/Capfile'
|
|
29
|
-
- '**/Guardfile'
|
|
30
|
-
- '**/Podfile'
|
|
31
|
-
- '**/Thorfile'
|
|
32
|
-
- '**/Vagrantfile'
|
|
33
|
-
- '**/Berksfile'
|
|
34
|
-
- '**/Cheffile'
|
|
35
|
-
- '**/Vagabondfile'
|
|
36
|
-
- rubocop-rspec
|
|
6
|
+
TargetRubyVersion: 3.3
|
|
7
|
+
NewCops: enable
|
|
8
|
+
SuggestExtensions: false
|
|
37
9
|
Exclude:
|
|
38
|
-
- '
|
|
39
|
-
- db/schema.rb
|
|
40
|
-
# Cop names are not displayed in offense messages by default. Change behavior
|
|
41
|
-
# by overriding DisplayCopNames, or by giving the -D/--display-cop-names
|
|
42
|
-
# option.
|
|
43
|
-
DisplayCopNames: false
|
|
44
|
-
# Style guide URLs are not displayed in offense messages by default. Change
|
|
45
|
-
# behavior by overriding DisplayStyleGuide, or by giving the
|
|
46
|
-
# -S/--display-style-guide option.
|
|
47
|
-
DisplayStyleGuide: false
|
|
48
|
-
# Additional cops that do not reference a style guide rule may be enabled by
|
|
49
|
-
# default. Change behavior by overriding StyleGuideCopsOnly, or by giving
|
|
50
|
-
# the --only-guide-cops option.
|
|
51
|
-
StyleGuideCopsOnly: false
|
|
10
|
+
- 'gemfiles/**/*'
|
|
52
11
|
|
|
53
|
-
|
|
12
|
+
Layout/EmptyLineAfterMagicComment:
|
|
54
13
|
Enabled: false
|
|
55
14
|
|
|
56
|
-
|
|
57
|
-
Layout/AccessModifierIndentation:
|
|
58
|
-
EnforcedStyle: indent
|
|
59
|
-
SupportedStyles:
|
|
60
|
-
- outdent
|
|
61
|
-
- indent
|
|
62
|
-
|
|
63
|
-
# Align the elements of a hash literal if they span more than one line.
|
|
64
|
-
Layout/HashAlignment:
|
|
65
|
-
# Alignment of entries using hash rocket as separator. Valid values are:
|
|
66
|
-
#
|
|
67
|
-
# key - left alignment of keys
|
|
68
|
-
# 'a' => 2
|
|
69
|
-
# 'bb' => 3
|
|
70
|
-
# separator - alignment of hash rockets, keys are right aligned
|
|
71
|
-
# 'a' => 2
|
|
72
|
-
# 'bb' => 3
|
|
73
|
-
# table - left alignment of keys, hash rockets, and values
|
|
74
|
-
# 'a' => 2
|
|
75
|
-
# 'bb' => 3
|
|
76
|
-
EnforcedHashRocketStyle: key
|
|
77
|
-
# Alignment of entries using colon as separator. Valid values are:
|
|
78
|
-
#
|
|
79
|
-
# key - left alignment of keys
|
|
80
|
-
# a: 0
|
|
81
|
-
# bb: 1
|
|
82
|
-
# separator - alignment of colons, keys are right aligned
|
|
83
|
-
# a: 0
|
|
84
|
-
# bb: 1
|
|
85
|
-
# table - left alignment of keys and values
|
|
86
|
-
# a: 0
|
|
87
|
-
# bb: 1
|
|
88
|
-
EnforcedColonStyle: key
|
|
89
|
-
# Select whether hashes that are the last argument in a method call should be
|
|
90
|
-
# inspected? Valid values are:
|
|
91
|
-
#
|
|
92
|
-
# always_inspect - Inspect both implicit and explicit hashes.
|
|
93
|
-
# Registers an offense for:
|
|
94
|
-
# function(a: 1,
|
|
95
|
-
# b: 2)
|
|
96
|
-
# Registers an offense for:
|
|
97
|
-
# function({a: 1,
|
|
98
|
-
# b: 2})
|
|
99
|
-
# always_ignore - Ignore both implicit and explicit hashes.
|
|
100
|
-
# Accepts:
|
|
101
|
-
# function(a: 1,
|
|
102
|
-
# b: 2)
|
|
103
|
-
# Accepts:
|
|
104
|
-
# function({a: 1,
|
|
105
|
-
# b: 2})
|
|
106
|
-
# ignore_implicit - Ignore only implicit hashes.
|
|
107
|
-
# Accepts:
|
|
108
|
-
# function(a: 1,
|
|
109
|
-
# b: 2)
|
|
110
|
-
# Registers an offense for:
|
|
111
|
-
# function({a: 1,
|
|
112
|
-
# b: 2})
|
|
113
|
-
# ignore_explicit - Ignore only explicit hashes.
|
|
114
|
-
# Accepts:
|
|
115
|
-
# function({a: 1,
|
|
116
|
-
# b: 2})
|
|
117
|
-
# Registers an offense for:
|
|
118
|
-
# function(a: 1,
|
|
119
|
-
# b: 2)
|
|
120
|
-
EnforcedLastArgumentHashStyle: always_inspect
|
|
121
|
-
SupportedLastArgumentHashStyles:
|
|
122
|
-
- always_inspect
|
|
123
|
-
- always_ignore
|
|
124
|
-
- ignore_implicit
|
|
125
|
-
- ignore_explicit
|
|
126
|
-
|
|
127
|
-
# disabled since it can give conflicting advice, specially in inheritance
|
|
128
|
-
# or composition cases,
|
|
129
|
-
Style/Alias:
|
|
15
|
+
Layout/LineLength:
|
|
130
16
|
Enabled: false
|
|
131
17
|
|
|
132
18
|
Layout/ParameterAlignment:
|
|
133
|
-
# Alignment of parameters in multi-line method calls.
|
|
134
|
-
#
|
|
135
|
-
# The `with_first_parameter` style aligns the following lines along the same
|
|
136
|
-
# column as the first parameter.
|
|
137
|
-
#
|
|
138
|
-
# method_call(a,
|
|
139
|
-
# b)
|
|
140
|
-
#
|
|
141
|
-
# The `with_fixed_indentation` style aligns the following lines with one
|
|
142
|
-
# level of indentation relative to the start of the line with the method call.
|
|
143
|
-
#
|
|
144
|
-
# method_call(a,
|
|
145
|
-
# b)
|
|
146
19
|
EnforcedStyle: with_fixed_indentation
|
|
147
|
-
SupportedStyles:
|
|
148
|
-
- with_first_parameter
|
|
149
|
-
- with_fixed_indentation
|
|
150
|
-
|
|
151
|
-
Style/AndOr:
|
|
152
|
-
# Whether `and` and `or` are banned only in conditionals (conditionals)
|
|
153
|
-
# or completely (always).
|
|
154
|
-
EnforcedStyle: always
|
|
155
|
-
SupportedStyles:
|
|
156
|
-
- always
|
|
157
|
-
- conditionals
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
# Checks if usage of %() or %Q() matches configuration.
|
|
161
|
-
Style/BarePercentLiterals:
|
|
162
|
-
EnforcedStyle: bare_percent
|
|
163
|
-
SupportedStyles:
|
|
164
|
-
- percent_q
|
|
165
|
-
- bare_percent
|
|
166
|
-
|
|
167
|
-
Style/BlockDelimiters:
|
|
168
|
-
EnforcedStyle: line_count_based
|
|
169
|
-
SupportedStyles:
|
|
170
|
-
# The `line_count_based` style enforces braces around single line blocks and
|
|
171
|
-
# do..end around multi-line blocks.
|
|
172
|
-
- line_count_based
|
|
173
|
-
# The `semantic` style enforces braces around functional blocks, where the
|
|
174
|
-
# primary purpose of the block is to return a value and do..end for
|
|
175
|
-
# procedural blocks, where the primary purpose of the block is its
|
|
176
|
-
# side-effects.
|
|
177
|
-
#
|
|
178
|
-
# This looks at the usage of a block's method to determine its type (e.g. is
|
|
179
|
-
# the result of a `map` assigned to a variable or passed to another
|
|
180
|
-
# method) but exceptions are permitted in the `ProceduralMethods`,
|
|
181
|
-
# `FunctionalMethods` and `IgnoredMethods` sections below.
|
|
182
|
-
- semantic
|
|
183
|
-
ProceduralMethods:
|
|
184
|
-
# Methods that are known to be procedural in nature but look functional from
|
|
185
|
-
# their usage, e.g.
|
|
186
|
-
#
|
|
187
|
-
# time = Benchmark.realtime do
|
|
188
|
-
# foo.bar
|
|
189
|
-
# end
|
|
190
|
-
#
|
|
191
|
-
# Here, the return value of the block is discarded but the return value of
|
|
192
|
-
# `Benchmark.realtime` is used.
|
|
193
|
-
- benchmark
|
|
194
|
-
- bm
|
|
195
|
-
- bmbm
|
|
196
|
-
- create
|
|
197
|
-
- each_with_object
|
|
198
|
-
- measure
|
|
199
|
-
- new
|
|
200
|
-
- realtime
|
|
201
|
-
- tap
|
|
202
|
-
- with_object
|
|
203
|
-
FunctionalMethods:
|
|
204
|
-
# Methods that are known to be functional in nature but look procedural from
|
|
205
|
-
# their usage, e.g.
|
|
206
|
-
#
|
|
207
|
-
# let(:foo) { Foo.new }
|
|
208
|
-
#
|
|
209
|
-
# Here, the return value of `Foo.new` is used to define a `foo` helper but
|
|
210
|
-
# doesn't appear to be used from the return value of `let`.
|
|
211
|
-
- let
|
|
212
|
-
- let!
|
|
213
|
-
- subject
|
|
214
|
-
- watch
|
|
215
|
-
IgnoredMethods:
|
|
216
|
-
# Methods that can be either procedural or functional and cannot be
|
|
217
|
-
# categorised from their usage alone, e.g.
|
|
218
|
-
#
|
|
219
|
-
# foo = lambda do |x|
|
|
220
|
-
# puts "Hello, #{x}"
|
|
221
|
-
# end
|
|
222
|
-
#
|
|
223
|
-
# foo = lambda do |x|
|
|
224
|
-
# x * 100
|
|
225
|
-
# end
|
|
226
|
-
#
|
|
227
|
-
# Here, it is impossible to tell from the return value of `lambda` whether
|
|
228
|
-
# the inner block's return value is significant.
|
|
229
|
-
- lambda
|
|
230
|
-
- proc
|
|
231
|
-
- it
|
|
232
|
-
|
|
233
|
-
# Indentation of `when`.
|
|
234
|
-
Layout/CaseIndentation:
|
|
235
|
-
SupportedStyles:
|
|
236
|
-
- case
|
|
237
|
-
- end
|
|
238
|
-
IndentOneStep: false
|
|
239
|
-
|
|
240
|
-
Style/ClassAndModuleChildren:
|
|
241
|
-
Enabled: false
|
|
242
|
-
# Checks the style of children definitions at classes and modules.
|
|
243
|
-
#
|
|
244
|
-
# Basically there are two different styles:
|
|
245
|
-
#
|
|
246
|
-
# `nested` - have each child on a separate line
|
|
247
|
-
# class Foo
|
|
248
|
-
# class Bar
|
|
249
|
-
# end
|
|
250
|
-
# end
|
|
251
|
-
#
|
|
252
|
-
# `compact` - combine definitions as much as possible
|
|
253
|
-
# class Foo::Bar
|
|
254
|
-
# end
|
|
255
|
-
#
|
|
256
|
-
# The compact style is only forced, for classes / modules with one child.
|
|
257
|
-
EnforcedStyle: compact
|
|
258
|
-
SupportedStyles:
|
|
259
|
-
- nested
|
|
260
|
-
- compact
|
|
261
|
-
|
|
262
|
-
Style/ClassCheck:
|
|
263
|
-
EnforcedStyle: is_a?
|
|
264
|
-
SupportedStyles:
|
|
265
|
-
- is_a?
|
|
266
|
-
- kind_of?
|
|
267
|
-
|
|
268
|
-
# Align with the style guide.
|
|
269
|
-
Style/CollectionMethods:
|
|
270
|
-
# Mapping from undesired method to desired_method
|
|
271
|
-
# e.g. to use `detect` over `find`:
|
|
272
|
-
#
|
|
273
|
-
# CollectionMethods:
|
|
274
|
-
# PreferredMethods:
|
|
275
|
-
# find: detect
|
|
276
|
-
PreferredMethods:
|
|
277
|
-
collect: 'map'
|
|
278
|
-
collect!: 'map!'
|
|
279
|
-
inject: 'reduce'
|
|
280
|
-
detect: 'find'
|
|
281
|
-
find_all: 'select'
|
|
282
|
-
|
|
283
|
-
# Use ` or %x around command literals.
|
|
284
|
-
Style/CommandLiteral:
|
|
285
|
-
EnforcedStyle: backticks
|
|
286
|
-
# backticks: Always use backticks.
|
|
287
|
-
# percent_x: Always use %x.
|
|
288
|
-
# mixed: Use backticks on single-line commands, and %x on multi-line commands.
|
|
289
|
-
SupportedStyles:
|
|
290
|
-
- backticks
|
|
291
|
-
- percent_x
|
|
292
|
-
- mixed
|
|
293
|
-
# If false, the cop will always recommend using %x if one or more backticks
|
|
294
|
-
# are found in the command string.
|
|
295
|
-
AllowInnerBackticks: false
|
|
296
|
-
|
|
297
|
-
# Checks formatting of special comments
|
|
298
|
-
Style/CommentAnnotation:
|
|
299
|
-
Keywords:
|
|
300
|
-
- TODO
|
|
301
|
-
- FIXME
|
|
302
|
-
- OPTIMIZE
|
|
303
|
-
- HACK
|
|
304
|
-
- REVIEW
|
|
305
|
-
|
|
306
|
-
Style/AsciiComments:
|
|
307
|
-
Enabled: false
|
|
308
|
-
|
|
309
|
-
# Checks that you have put a copyright in a comment before any code.
|
|
310
|
-
#
|
|
311
|
-
# You can override the default Notice in your .rubocop.yml file.
|
|
312
|
-
#
|
|
313
|
-
# In order to use autocorrect, you must supply a value for the
|
|
314
|
-
# AutocorrectNotice key that matches the regexp Notice. A blank
|
|
315
|
-
# AutocorrectNotice will cause an error during autocorrect.
|
|
316
|
-
#
|
|
317
|
-
# Autocorrect will add a copyright notice in a comment at the top
|
|
318
|
-
# of the file immediately after any shebang or encoding comments.
|
|
319
|
-
#
|
|
320
|
-
# Example rubocop.yml:
|
|
321
|
-
#
|
|
322
|
-
# Style/Copyright:
|
|
323
|
-
# Enabled: true
|
|
324
|
-
# Notice: 'Copyright (\(c\) )?2015 Yahoo! Inc'
|
|
325
|
-
# AutocorrectNotice: '# Copyright (c) 2015 Yahoo! Inc.'
|
|
326
|
-
#
|
|
327
|
-
Style/Copyright:
|
|
328
|
-
Notice: '^Copyright (\(c\) )?2[0-9]{3} .+'
|
|
329
|
-
AutocorrectNotice: ''
|
|
330
|
-
|
|
331
|
-
# Multi-line method chaining should be done with leading dots.
|
|
332
|
-
Layout/DotPosition:
|
|
333
|
-
EnforcedStyle: leading
|
|
334
|
-
SupportedStyles:
|
|
335
|
-
- leading
|
|
336
|
-
- trailing
|
|
337
|
-
|
|
338
|
-
Style/DoubleNegation:
|
|
339
|
-
Enabled: false
|
|
340
|
-
|
|
341
|
-
# Warn on empty else statements
|
|
342
|
-
# empty - warn only on empty else
|
|
343
|
-
# nil - warn on else with nil in it
|
|
344
|
-
# both - warn on empty else and else with nil in it
|
|
345
|
-
Style/EmptyElse:
|
|
346
|
-
EnforcedStyle: both
|
|
347
|
-
SupportedStyles:
|
|
348
|
-
- empty
|
|
349
|
-
- nil
|
|
350
|
-
- both
|
|
351
|
-
|
|
352
|
-
# Use empty lines between defs.
|
|
353
|
-
Layout/EmptyLineBetweenDefs:
|
|
354
|
-
# If true, this parameter means that single line method definitions don't
|
|
355
|
-
# need an empty line between them.
|
|
356
|
-
AllowAdjacentOneLineDefs: false
|
|
357
|
-
|
|
358
|
-
Layout/EmptyLineAfterMagicComment:
|
|
359
|
-
Enabled: false
|
|
360
|
-
|
|
361
|
-
Layout/EmptyLinesAroundBlockBody:
|
|
362
|
-
EnforcedStyle: no_empty_lines
|
|
363
|
-
SupportedStyles:
|
|
364
|
-
- empty_lines
|
|
365
|
-
- no_empty_lines
|
|
366
|
-
|
|
367
|
-
Layout/EmptyLinesAroundClassBody:
|
|
368
|
-
EnforcedStyle: no_empty_lines
|
|
369
|
-
SupportedStyles:
|
|
370
|
-
- empty_lines
|
|
371
|
-
- no_empty_lines
|
|
372
|
-
|
|
373
|
-
Layout/EmptyLinesAroundModuleBody:
|
|
374
|
-
EnforcedStyle: no_empty_lines
|
|
375
|
-
SupportedStyles:
|
|
376
|
-
- empty_lines
|
|
377
|
-
- no_empty_lines
|
|
378
|
-
|
|
379
|
-
Naming/FileName:
|
|
380
|
-
# File names listed in AllCops:Include are excluded by default. Add extra
|
|
381
|
-
# excludes here.
|
|
382
|
-
Exclude: []
|
|
383
|
-
|
|
384
|
-
Layout/FirstParameterIndentation:
|
|
385
|
-
EnforcedStyle: consistent
|
|
386
|
-
SupportedStyles:
|
|
387
|
-
# The first parameter should always be indented one step more than the
|
|
388
|
-
# preceding line.
|
|
389
|
-
- consistent
|
|
390
|
-
- align_parentheses
|
|
391
|
-
|
|
392
|
-
Style/EmptyMethod:
|
|
393
|
-
EnforcedStyle: expanded
|
|
394
|
-
SupportedStyles:
|
|
395
|
-
- compact
|
|
396
|
-
- expanded
|
|
397
|
-
|
|
398
|
-
# Checks use of for or each in multiline loops.
|
|
399
|
-
Style/For:
|
|
400
|
-
EnforcedStyle: each
|
|
401
|
-
SupportedStyles:
|
|
402
|
-
- for
|
|
403
|
-
- each
|
|
404
|
-
|
|
405
|
-
# Enforce the method used for string formatting.
|
|
406
|
-
Style/FormatString:
|
|
407
|
-
EnforcedStyle: format
|
|
408
|
-
SupportedStyles:
|
|
409
|
-
- format
|
|
410
|
-
- sprintf
|
|
411
|
-
- percent
|
|
412
|
-
|
|
413
|
-
# Enforce using either `%<token>s` or `%{token}`
|
|
414
|
-
Style/FormatStringToken:
|
|
415
|
-
EnforcedStyle: annotated
|
|
416
|
-
SupportedStyles:
|
|
417
|
-
# Prefer tokens which contain a sprintf like type annotation like
|
|
418
|
-
# `%<name>s`, `%<age>d`, `%<score>f`
|
|
419
|
-
- annotated
|
|
420
|
-
# Prefer simple looking "template" style tokens like `%{name}`, `%{age}`
|
|
421
|
-
- template
|
|
422
|
-
|
|
423
|
-
Style/FrozenStringLiteralComment:
|
|
424
|
-
EnforcedStyle: always
|
|
425
|
-
SupportedStyles:
|
|
426
|
-
- always_true
|
|
427
|
-
# `always` will always add the frozen string literal comment to a file
|
|
428
|
-
# regardless of the Ruby version or if `freeze` or `<<` are called on a
|
|
429
|
-
# string literal. If you run code against multiple versions of Ruby, it is
|
|
430
|
-
# possible that this will create errors in Ruby 2.3.0+.
|
|
431
|
-
- always
|
|
432
|
-
# `never` will enforce that the frozen string literal comment does not
|
|
433
|
-
# exist in a file.
|
|
434
|
-
- never
|
|
435
|
-
|
|
436
|
-
# Built-in global variables are allowed by default.
|
|
437
|
-
Style/GlobalVars:
|
|
438
|
-
AllowedVariables: []
|
|
439
|
-
|
|
440
|
-
Style/HashSyntax:
|
|
441
|
-
EnforcedStyle: ruby19
|
|
442
|
-
SupportedStyles:
|
|
443
|
-
- ruby19
|
|
444
|
-
- ruby19_no_mixed_keys
|
|
445
|
-
- hash_rockets
|
|
446
|
-
# Force hashes that have a symbol value to use hash rockets
|
|
447
|
-
UseHashRocketsWithSymbolValues: false
|
|
448
|
-
|
|
449
|
-
Layout/IndentationConsistency:
|
|
450
|
-
# The difference between `rails` and `normal` is that the `rails` style
|
|
451
|
-
# prescribes that in classes and modules the `protected` and `private`
|
|
452
|
-
# modifier keywords shall be indented the same as public methods and that
|
|
453
|
-
# protected and private members shall be indented one step more than the
|
|
454
|
-
# modifiers. Other than that, both styles mean that entities on the same
|
|
455
|
-
# logical depth shall have the same indentation.
|
|
456
|
-
EnforcedStyle: normal
|
|
457
|
-
SupportedStyles:
|
|
458
|
-
- normal
|
|
459
|
-
- rails
|
|
460
|
-
|
|
461
|
-
Layout/IndentationWidth:
|
|
462
|
-
# Number of spaces for each indentation level.
|
|
463
|
-
Width: 2
|
|
464
|
-
|
|
465
|
-
# Checks the indentation of the first key in a hash literal.
|
|
466
|
-
Layout/FirstHashElementIndentation:
|
|
467
|
-
# The value `special_inside_parentheses` means that hash literals with braces
|
|
468
|
-
# that have their opening brace on the same line as a surrounding opening
|
|
469
|
-
# round parenthesis, shall have their first key indented relative to the
|
|
470
|
-
# first position inside the parenthesis.
|
|
471
|
-
# The value `consistent` means that the indentation of the first key shall
|
|
472
|
-
# always be relative to the first position of the line where the opening
|
|
473
|
-
# brace is.
|
|
474
|
-
EnforcedStyle: special_inside_parentheses
|
|
475
|
-
SupportedStyles:
|
|
476
|
-
- special_inside_parentheses
|
|
477
|
-
- consistent
|
|
478
|
-
|
|
479
|
-
Style/Lambda:
|
|
480
|
-
EnforcedStyle: literal
|
|
481
|
-
|
|
482
|
-
Style/LambdaCall:
|
|
483
|
-
EnforcedStyle: call
|
|
484
|
-
SupportedStyles:
|
|
485
|
-
- call
|
|
486
|
-
- braces
|
|
487
|
-
|
|
488
|
-
Style/Next:
|
|
489
|
-
# With `always` all conditions at the end of an iteration needs to be
|
|
490
|
-
# replaced by next - with `skip_modifier_ifs` the modifier if like this one
|
|
491
|
-
# are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
|
|
492
|
-
EnforcedStyle: skip_modifier_ifs
|
|
493
|
-
# `MinBodyLength` defines the number of lines of the a body of an if / unless
|
|
494
|
-
# needs to have to trigger this cop
|
|
495
|
-
MinBodyLength: 3
|
|
496
|
-
SupportedStyles:
|
|
497
|
-
- skip_modifier_ifs
|
|
498
|
-
- always
|
|
499
|
-
|
|
500
|
-
Style/NonNilCheck:
|
|
501
|
-
# With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
|
|
502
|
-
# `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
|
|
503
|
-
# **usually** OK, but might change behavior.
|
|
504
|
-
#
|
|
505
|
-
# With `IncludeSemanticChanges` set to `false`, this cop does not report
|
|
506
|
-
# offenses for `!x.nil?` and does no changes that might change behavior.
|
|
507
|
-
IncludeSemanticChanges: false
|
|
508
|
-
|
|
509
|
-
Style/MethodDefParentheses:
|
|
510
|
-
EnforcedStyle: require_parentheses
|
|
511
|
-
SupportedStyles:
|
|
512
|
-
- require_parentheses
|
|
513
|
-
- require_no_parentheses
|
|
514
|
-
|
|
515
|
-
Naming/MethodName:
|
|
516
|
-
EnforcedStyle: snake_case
|
|
517
|
-
SupportedStyles:
|
|
518
|
-
- snake_case
|
|
519
|
-
- camelCase
|
|
520
|
-
|
|
521
|
-
Layout/MultilineOperationIndentation:
|
|
522
|
-
EnforcedStyle: aligned
|
|
523
|
-
SupportedStyles:
|
|
524
|
-
- aligned
|
|
525
|
-
- indented
|
|
526
|
-
|
|
527
|
-
Style/NumericLiterals:
|
|
528
|
-
MinDigits: 5
|
|
529
|
-
|
|
530
|
-
# Allow safe assignment in conditions.
|
|
531
|
-
Style/ParenthesesAroundCondition:
|
|
532
|
-
AllowSafeAssignment: true
|
|
533
|
-
|
|
534
|
-
Style/PercentLiteralDelimiters:
|
|
535
|
-
PreferredDelimiters:
|
|
536
|
-
'%': ()
|
|
537
|
-
'%i': '[]'
|
|
538
|
-
'%q': ()
|
|
539
|
-
'%Q': ()
|
|
540
|
-
'%r': '{}'
|
|
541
|
-
'%s': ()
|
|
542
|
-
'%w': '[]'
|
|
543
|
-
'%W': ()
|
|
544
|
-
'%x': ()
|
|
545
|
-
|
|
546
|
-
Style/PercentQLiterals:
|
|
547
|
-
EnforcedStyle: lower_case_q
|
|
548
|
-
SupportedStyles:
|
|
549
|
-
- lower_case_q # Use %q when possible, %Q when necessary
|
|
550
|
-
- upper_case_q # Always use %Q
|
|
551
|
-
|
|
552
|
-
Naming/PredicateName:
|
|
553
|
-
# Predicate name prefices.
|
|
554
|
-
NamePrefix:
|
|
555
|
-
- is_
|
|
556
|
-
- has_
|
|
557
|
-
- have_
|
|
558
|
-
# Predicate name prefices that should be removed.
|
|
559
|
-
ForbiddenPrefixes:
|
|
560
|
-
- is_
|
|
561
|
-
- has_
|
|
562
|
-
- have_
|
|
563
|
-
|
|
564
|
-
Style/RaiseArgs:
|
|
565
|
-
Severity: warning
|
|
566
|
-
EnforcedStyle: exploded
|
|
567
|
-
SupportedStyles:
|
|
568
|
-
- compact # raise Exception.new(msg)
|
|
569
|
-
- exploded # raise Exception, msg
|
|
570
|
-
|
|
571
|
-
Style/RedundantReturn:
|
|
572
|
-
# When true allows code like `return x, y`.
|
|
573
|
-
AllowMultipleReturnValues: false
|
|
574
|
-
|
|
575
|
-
# Use / or %r around regular expressions.
|
|
576
|
-
Style/RegexpLiteral:
|
|
577
|
-
EnforcedStyle: slashes
|
|
578
|
-
# slashes: Always use slashes.
|
|
579
|
-
# percent_r: Always use %r.
|
|
580
|
-
# mixed: Use slashes on single-line regexes, and %r on multi-line regexes.
|
|
581
|
-
SupportedStyles:
|
|
582
|
-
- slashes
|
|
583
|
-
- percent_r
|
|
584
|
-
- mixed
|
|
585
|
-
# If false, the cop will always recommend using %r if one or more slashes
|
|
586
|
-
# are found in the regexp string.
|
|
587
|
-
AllowInnerSlashes: false
|
|
588
|
-
|
|
589
|
-
Style/SafeNavigation:
|
|
590
|
-
Enabled: false
|
|
591
|
-
# Safe navigation may cause a statement to start returning `nil` in addition
|
|
592
|
-
# to whatever it used to return.
|
|
593
|
-
ConvertCodeThatCanStartToReturnNil: false
|
|
594
|
-
|
|
595
|
-
Style/Semicolon:
|
|
596
|
-
# Allow ; to separate several expressions on the same line.
|
|
597
|
-
AllowAsExpressionSeparator: false
|
|
598
|
-
|
|
599
|
-
Style/SignalException:
|
|
600
|
-
EnforcedStyle: only_raise
|
|
601
|
-
SupportedStyles:
|
|
602
|
-
- only_raise
|
|
603
|
-
- only_fail
|
|
604
|
-
- semantic
|
|
605
|
-
|
|
606
|
-
Style/SingleLineBlockParams:
|
|
607
|
-
Methods:
|
|
608
|
-
- reduce:
|
|
609
|
-
- a
|
|
610
|
-
- e
|
|
611
|
-
- inject:
|
|
612
|
-
- a
|
|
613
|
-
- e
|
|
614
|
-
|
|
615
|
-
Style/SingleLineMethods:
|
|
616
|
-
AllowIfMethodIsEmpty: true
|
|
617
|
-
|
|
618
|
-
Style/StringLiterals:
|
|
619
|
-
EnforcedStyle: single_quotes
|
|
620
|
-
SupportedStyles:
|
|
621
|
-
- single_quotes
|
|
622
|
-
- double_quotes
|
|
623
|
-
|
|
624
|
-
Style/StringLiteralsInInterpolation:
|
|
625
|
-
EnforcedStyle: single_quotes
|
|
626
|
-
SupportedStyles:
|
|
627
|
-
- single_quotes
|
|
628
|
-
- double_quotes
|
|
629
|
-
|
|
630
|
-
Layout/SpaceAroundBlockParameters:
|
|
631
|
-
EnforcedStyleInsidePipes: no_space
|
|
632
|
-
SupportedStylesInsidePipes:
|
|
633
|
-
- space
|
|
634
|
-
- no_space
|
|
635
|
-
|
|
636
|
-
Layout/SpaceAroundEqualsInParameterDefault:
|
|
637
|
-
EnforcedStyle: space
|
|
638
|
-
SupportedStyles:
|
|
639
|
-
- space
|
|
640
|
-
- no_space
|
|
641
|
-
|
|
642
|
-
Layout/SpaceAroundOperators:
|
|
643
|
-
# When true, allows most uses of extra spacing if the intent is to align
|
|
644
|
-
# with an operator on the previous or next line, not counting empty lines
|
|
645
|
-
# or comment lines.
|
|
646
|
-
AllowForAlignment: true
|
|
647
|
-
|
|
648
|
-
Layout/SpaceBeforeBlockBraces:
|
|
649
|
-
EnforcedStyle: space
|
|
650
|
-
SupportedStyles:
|
|
651
|
-
- space
|
|
652
|
-
- no_space
|
|
653
|
-
|
|
654
|
-
Layout/SpaceInsideBlockBraces:
|
|
655
|
-
EnforcedStyle: space
|
|
656
|
-
SupportedStyles:
|
|
657
|
-
- space
|
|
658
|
-
- no_space
|
|
659
|
-
# Valid values are: space, no_space
|
|
660
|
-
EnforcedStyleForEmptyBraces: no_space
|
|
661
|
-
# Space between { and |. Overrides EnforcedStyle if there is a conflict.
|
|
662
|
-
SpaceBeforeBlockParameters: true
|
|
663
|
-
|
|
664
|
-
Layout/SpaceInsideHashLiteralBraces:
|
|
665
|
-
EnforcedStyle: space
|
|
666
|
-
EnforcedStyleForEmptyBraces: no_space
|
|
667
|
-
SupportedStyles:
|
|
668
|
-
- space
|
|
669
|
-
- no_space
|
|
670
|
-
|
|
671
|
-
Style/SymbolProc:
|
|
672
|
-
# A list of method names to be ignored by the check.
|
|
673
|
-
# The names should be fairly unique, otherwise you'll end up ignoring lots of code.
|
|
674
|
-
IgnoredMethods:
|
|
675
|
-
- respond_to
|
|
676
|
-
|
|
677
|
-
Layout/TrailingEmptyLines:
|
|
678
|
-
EnforcedStyle: final_newline
|
|
679
|
-
SupportedStyles:
|
|
680
|
-
- final_newline
|
|
681
|
-
- final_blank_line
|
|
682
|
-
|
|
683
|
-
Style/TrailingCommaInArrayLiteral:
|
|
684
|
-
# If EnforcedStyleForMultiline is comma, the cop requires a comma after the
|
|
685
|
-
# last item of a list, but only for lists where each item is on its own line.
|
|
686
|
-
# If EnforcedStyleForMultiline is consistent_comma, the cop requires a comma
|
|
687
|
-
# after the last item of a list, for all lists.
|
|
688
|
-
EnforcedStyleForMultiline: no_comma
|
|
689
|
-
SupportedStylesForMultiline:
|
|
690
|
-
- comma
|
|
691
|
-
- consistent_comma
|
|
692
|
-
- no_comma
|
|
693
|
-
|
|
694
|
-
Style/TrailingCommaInHashLiteral:
|
|
695
|
-
# If EnforcedStyleForMultiline is comma, the cop requires a comma after the
|
|
696
|
-
# last item of a list, but only for lists where each item is on its own line.
|
|
697
|
-
# If EnforcedStyleForMultiline is consistent_comma, the cop requires a comma
|
|
698
|
-
# after the last item of a list, for all lists.
|
|
699
|
-
EnforcedStyleForMultiline: no_comma
|
|
700
|
-
SupportedStylesForMultiline:
|
|
701
|
-
- comma
|
|
702
|
-
- consistent_comma
|
|
703
|
-
- no_comma
|
|
704
|
-
|
|
705
|
-
Style/TrailingCommaInArguments:
|
|
706
|
-
# If EnforcedStyleForMultiline is comma, the cop requires a comma after the
|
|
707
|
-
# last item of a list, but only for lists where each item is on its own line.
|
|
708
|
-
# If EnforcedStyleForMultiline is consistent_comma, the cop requires a comma
|
|
709
|
-
# after the last item of a list, for all lists.
|
|
710
|
-
EnforcedStyleForMultiline: no_comma
|
|
711
|
-
SupportedStylesForMultiline:
|
|
712
|
-
- comma
|
|
713
|
-
- consistent_comma
|
|
714
|
-
- no_comma
|
|
715
|
-
|
|
716
|
-
# TrivialAccessors requires exact name matches and doesn't allow
|
|
717
|
-
# predicated methods by default.
|
|
718
|
-
Style/TrivialAccessors:
|
|
719
|
-
# When set to false the cop will suggest the use of accessor methods
|
|
720
|
-
# in situations like:
|
|
721
|
-
#
|
|
722
|
-
# def name
|
|
723
|
-
# @other_name
|
|
724
|
-
# end
|
|
725
|
-
#
|
|
726
|
-
# This way you can uncover "hidden" attributes in your code.
|
|
727
|
-
ExactNameMatch: true
|
|
728
|
-
AllowPredicates: false
|
|
729
|
-
# Allows trivial writers that don't end in an equal sign. e.g.
|
|
730
|
-
#
|
|
731
|
-
# def on_exception(action)
|
|
732
|
-
# @on_exception=action
|
|
733
|
-
# end
|
|
734
|
-
# on_exception :restart
|
|
735
|
-
#
|
|
736
|
-
# Commonly used in DSLs
|
|
737
|
-
AllowDSLWriters: false
|
|
738
|
-
IgnoreClassMethods: false
|
|
739
|
-
AllowedMethods:
|
|
740
|
-
- to_ary
|
|
741
|
-
- to_a
|
|
742
|
-
- to_c
|
|
743
|
-
- to_enum
|
|
744
|
-
- to_h
|
|
745
|
-
- to_hash
|
|
746
|
-
- to_i
|
|
747
|
-
- to_int
|
|
748
|
-
- to_io
|
|
749
|
-
- to_open
|
|
750
|
-
- to_path
|
|
751
|
-
- to_proc
|
|
752
|
-
- to_r
|
|
753
|
-
- to_regexp
|
|
754
|
-
- to_str
|
|
755
|
-
- to_s
|
|
756
|
-
- to_sym
|
|
757
|
-
|
|
758
|
-
Naming/VariableName:
|
|
759
|
-
EnforcedStyle: snake_case
|
|
760
|
-
SupportedStyles:
|
|
761
|
-
- snake_case
|
|
762
|
-
- camelCase
|
|
763
|
-
|
|
764
|
-
Style/WordArray:
|
|
765
|
-
MinSize: 0
|
|
766
|
-
# The regular expression WordRegex decides what is considered a word.
|
|
767
|
-
WordRegex: !ruby/regexp '/\A[\p{Word}]+\z/'
|
|
768
|
-
|
|
769
|
-
##################### Metrics ##################################
|
|
770
20
|
|
|
771
21
|
Metrics/AbcSize:
|
|
772
|
-
Severity: warning
|
|
773
|
-
# The ABC size is a calculated magnitude, so this number can be a Fixnum or
|
|
774
|
-
# a Float.
|
|
775
22
|
Max: 25
|
|
776
|
-
Exclude:
|
|
777
|
-
- 'db/**/*.rb'
|
|
778
|
-
|
|
779
|
-
Metrics/BlockNesting:
|
|
780
|
-
Max: 3
|
|
781
23
|
|
|
782
24
|
Metrics/BlockLength:
|
|
783
25
|
Exclude:
|
|
784
|
-
- '
|
|
785
|
-
- '**/*.rake'
|
|
786
|
-
- 'spec/factories/*.rb'
|
|
787
|
-
- 'spec/**/*_spec.rb'
|
|
788
|
-
- 'app/admin/**/*'
|
|
789
|
-
- 'app/indices/**/*.rb'
|
|
26
|
+
- 'spec/**/*'
|
|
790
27
|
|
|
791
|
-
# Second-wave metric. Disabled now to prevent noise.
|
|
792
28
|
Metrics/ClassLength:
|
|
793
29
|
Enabled: false
|
|
794
|
-
CountComments: false # count full line comments?
|
|
795
|
-
Max: 100
|
|
796
|
-
|
|
797
|
-
# Second-wave metric. Disabled now to prevent noise.
|
|
798
|
-
Metrics/ModuleLength:
|
|
799
|
-
Enabled: false
|
|
800
|
-
CountComments: false # count full line comments?
|
|
801
|
-
Max: 100
|
|
802
30
|
|
|
803
|
-
# Avoid complex methods.
|
|
804
31
|
Metrics/CyclomaticComplexity:
|
|
805
32
|
Max: 6
|
|
806
33
|
|
|
807
|
-
# Second-wave metric. Disabled now to prevent noise.
|
|
808
|
-
Layout/LineLength:
|
|
809
|
-
Enabled: false
|
|
810
|
-
Max: 120
|
|
811
|
-
# To make it possible to copy or click on URIs in the code, we allow lines
|
|
812
|
-
# contaning a URI to be longer than Max.
|
|
813
|
-
AllowURI: true
|
|
814
|
-
URISchemes:
|
|
815
|
-
- http
|
|
816
|
-
- https
|
|
817
|
-
|
|
818
|
-
# Second-wave metric. Disabled now to prevent noise.
|
|
819
34
|
Metrics/MethodLength:
|
|
820
35
|
Enabled: false
|
|
821
|
-
Severity: warning
|
|
822
|
-
CountComments: false # count full line comments?
|
|
823
|
-
Max: 20
|
|
824
36
|
|
|
825
|
-
Metrics/
|
|
826
|
-
|
|
827
|
-
CountKeywordArgs: true
|
|
37
|
+
Metrics/ModuleLength:
|
|
38
|
+
Enabled: false
|
|
828
39
|
|
|
829
40
|
Metrics/PerceivedComplexity:
|
|
830
41
|
Max: 7
|
|
831
42
|
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
# Allow safe assignment in conditions.
|
|
835
|
-
Lint/AssignmentInCondition:
|
|
836
|
-
AllowSafeAssignment: true
|
|
837
|
-
|
|
838
|
-
# Align ends correctly.
|
|
839
|
-
Layout/EndAlignment:
|
|
840
|
-
# The value `keyword` means that `end` should be aligned with the matching
|
|
841
|
-
# keyword (if, while, etc.).
|
|
842
|
-
# The value `variable` means that in assignments, `end` should be aligned
|
|
843
|
-
# with the start of the variable on the left hand side of `=`. In all other
|
|
844
|
-
# situations, `end` should still be aligned with the keyword.
|
|
845
|
-
EnforcedStyleAlignWith: keyword
|
|
846
|
-
SupportedStylesAlignWith:
|
|
847
|
-
- keyword
|
|
848
|
-
- variable
|
|
849
|
-
- start_of_line
|
|
850
|
-
AutoCorrect: false
|
|
851
|
-
|
|
852
|
-
Layout/DefEndAlignment:
|
|
853
|
-
# The value `def` means that `end` should be aligned with the def keyword.
|
|
854
|
-
# The value `start_of_line` means that `end` should be aligned with method
|
|
855
|
-
# calls like `private`, `public`, etc, if present in front of the `def`
|
|
856
|
-
# keyword on the same line.
|
|
857
|
-
EnforcedStyleAlignWith: start_of_line
|
|
858
|
-
SupportedStylesAlignWith:
|
|
859
|
-
- start_of_line
|
|
860
|
-
- def
|
|
861
|
-
AutoCorrect: false
|
|
862
|
-
|
|
863
|
-
##################### Rails ##################################
|
|
864
|
-
Rails:
|
|
43
|
+
Style/Alias:
|
|
865
44
|
Enabled: false
|
|
866
45
|
|
|
867
|
-
|
|
868
|
-
EnforcedStyle:
|
|
869
|
-
SupportedStyles:
|
|
870
|
-
- action
|
|
871
|
-
- filter
|
|
872
|
-
Include:
|
|
873
|
-
- app/controllers/**/*.rb
|
|
874
|
-
|
|
875
|
-
Rails/Blank:
|
|
876
|
-
Enabled: true
|
|
877
|
-
# Convert checks for `nil` or `empty?` to `blank?`
|
|
878
|
-
NilOrEmpty: true
|
|
879
|
-
# Convert usages of not `present?` to `blank?`
|
|
880
|
-
NotPresent: true
|
|
881
|
-
# Convert usages of `unless` `present?` to `if` `blank?`
|
|
882
|
-
UnlessPresent: false
|
|
883
|
-
|
|
884
|
-
Rails/Date:
|
|
885
|
-
# The value `always` disallows usage of `Date.today`, `Date.current`,
|
|
886
|
-
# `Date#to_time` etc.
|
|
887
|
-
# The value `acceptable` allows usage of `Date.current`, `Date.yesterday`, etc
|
|
888
|
-
# (but not `Date.today`) which are overriden by ActiveSupport to handle current
|
|
889
|
-
# time zone.
|
|
890
|
-
EnforcedStyle: flexible
|
|
891
|
-
SupportedStyles:
|
|
892
|
-
- strict
|
|
893
|
-
- flexible
|
|
46
|
+
Style/AndOr:
|
|
47
|
+
EnforcedStyle: always
|
|
894
48
|
|
|
895
|
-
|
|
49
|
+
Style/ClassAndModuleChildren:
|
|
896
50
|
Enabled: false
|
|
897
|
-
Include:
|
|
898
|
-
- app/models/**/*.rb
|
|
899
|
-
- app/controllers/**/*.rb
|
|
900
|
-
- app/observers/**/*.rb
|
|
901
|
-
- app/services/**/*.rb
|
|
902
|
-
- app/mailers/**/*.rb
|
|
903
|
-
- app/helpers/**/*.rb
|
|
904
|
-
- app/policies/**/*.rb
|
|
905
|
-
- lib/**/*.rb
|
|
906
51
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
- app/models/**/*.rb
|
|
910
|
-
- app/controllers/**/*.rb
|
|
911
|
-
- app/observers/**/*.rb
|
|
912
|
-
- app/services/**/*.rb
|
|
913
|
-
- app/mailers/**/*.rb
|
|
914
|
-
- app/helpers/**/*.rb
|
|
915
|
-
- app/policies/**/*.rb
|
|
916
|
-
- lib/**/*.rb
|
|
917
|
-
|
|
918
|
-
Rails/HasAndBelongsToMany:
|
|
919
|
-
Include:
|
|
920
|
-
- app/models/**/*.rb
|
|
52
|
+
Style/Documentation:
|
|
53
|
+
Enabled: false
|
|
921
54
|
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
- app/**/*.rb
|
|
925
|
-
- config/**/*.rb
|
|
926
|
-
- db/**/*.rb
|
|
927
|
-
- lib/**/*.rb
|
|
55
|
+
Style/DoubleNegation:
|
|
56
|
+
Enabled: false
|
|
928
57
|
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
- app/models/**/*.rb
|
|
58
|
+
Style/EmptyMethod:
|
|
59
|
+
EnforcedStyle: expanded
|
|
932
60
|
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
- app/models/**/*.rb
|
|
61
|
+
Style/Lambda:
|
|
62
|
+
EnforcedStyle: literal
|
|
936
63
|
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
# The value `acceptable` allows usage of `in_time_zone` instead of `zone`.
|
|
940
|
-
EnforcedStyle: flexible
|
|
941
|
-
SupportedStyles:
|
|
942
|
-
- strict
|
|
943
|
-
- flexible
|
|
64
|
+
Style/SafeNavigation:
|
|
65
|
+
Enabled: false
|
|
944
66
|
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
- app/models/**/*.rb
|
|
67
|
+
Style/WordArray:
|
|
68
|
+
MinSize: 0
|