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