devise-2fa 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +36 -0
  3. data/.hound.yml +2 -0
  4. data/.ruby-style.yml +1248 -0
  5. data/.travis.yml +28 -0
  6. data/Gemfile +25 -0
  7. data/LICENSE +21 -0
  8. data/README.md +130 -0
  9. data/Rakefile +41 -0
  10. data/app/controllers/devise/credentials_controller.rb +100 -0
  11. data/app/controllers/devise/tokens_controller.rb +99 -0
  12. data/app/views/devise/credentials/refresh.html.erb +20 -0
  13. data/app/views/devise/credentials/show.html.erb +23 -0
  14. data/app/views/devise/tokens/_token_secret.html.erb +19 -0
  15. data/app/views/devise/tokens/_trusted_devices.html.erb +10 -0
  16. data/app/views/devise/tokens/recovery.html.erb +21 -0
  17. data/app/views/devise/tokens/recovery_codes.text.erb +3 -0
  18. data/app/views/devise/tokens/show.html.erb +19 -0
  19. data/config/locales/en.yml +57 -0
  20. data/devise-2fa.gemspec +27 -0
  21. data/lib/devise-2fa.rb +74 -0
  22. data/lib/devise-2fa/version.rb +5 -0
  23. data/lib/devise_two_factorable/controllers/helpers.rb +136 -0
  24. data/lib/devise_two_factorable/controllers/url_helpers.rb +30 -0
  25. data/lib/devise_two_factorable/engine.rb +22 -0
  26. data/lib/devise_two_factorable/helpers.rb +136 -0
  27. data/lib/devise_two_factorable/hooks.rb +11 -0
  28. data/lib/devise_two_factorable/hooks/sessions.rb +49 -0
  29. data/lib/devise_two_factorable/mapping.rb +12 -0
  30. data/lib/devise_two_factorable/models/two_factorable.rb +131 -0
  31. data/lib/devise_two_factorable/routes.rb +26 -0
  32. data/lib/devise_two_factorable/two_factorable.rb +131 -0
  33. data/lib/generators/active_record/devise_two_factor_generator.rb +32 -0
  34. data/lib/generators/active_record/templates/migration.rb +27 -0
  35. data/lib/generators/devise_two_factor/devise_two_factor_generator.rb +16 -0
  36. data/lib/generators/devise_two_factor/install_generator.rb +52 -0
  37. data/lib/generators/devise_two_factor/views_generator.rb +19 -0
  38. data/lib/generators/mongoid/devise_two_factor_generator.rb +34 -0
  39. data/test/dummy/README.rdoc +261 -0
  40. data/test/dummy/Rakefile +7 -0
  41. data/test/dummy/app/assets/javascripts/application.js +13 -0
  42. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  43. data/test/dummy/app/controllers/application_controller.rb +4 -0
  44. data/test/dummy/app/controllers/posts_controller.rb +83 -0
  45. data/test/dummy/app/helpers/application_helper.rb +2 -0
  46. data/test/dummy/app/helpers/posts_helper.rb +2 -0
  47. data/test/dummy/app/mailers/.gitkeep +0 -0
  48. data/test/dummy/app/models/post.rb +2 -0
  49. data/test/dummy/app/models/user.rb +20 -0
  50. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  51. data/test/dummy/app/views/posts/_form.html.erb +25 -0
  52. data/test/dummy/app/views/posts/edit.html.erb +6 -0
  53. data/test/dummy/app/views/posts/index.html.erb +25 -0
  54. data/test/dummy/app/views/posts/new.html.erb +5 -0
  55. data/test/dummy/app/views/posts/show.html.erb +15 -0
  56. data/test/dummy/config.ru +4 -0
  57. data/test/dummy/config/application.rb +67 -0
  58. data/test/dummy/config/boot.rb +10 -0
  59. data/test/dummy/config/database.yml +25 -0
  60. data/test/dummy/config/environment.rb +5 -0
  61. data/test/dummy/config/environments/development.rb +37 -0
  62. data/test/dummy/config/environments/production.rb +73 -0
  63. data/test/dummy/config/environments/test.rb +36 -0
  64. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  65. data/test/dummy/config/initializers/devise.rb +251 -0
  66. data/test/dummy/config/initializers/inflections.rb +15 -0
  67. data/test/dummy/config/initializers/mime_types.rb +5 -0
  68. data/test/dummy/config/initializers/secret_token.rb +8 -0
  69. data/test/dummy/config/initializers/session_store.rb +8 -0
  70. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  71. data/test/dummy/config/locales/en.yml +5 -0
  72. data/test/dummy/config/routes.rb +6 -0
  73. data/test/dummy/db/migrate/20130125101430_create_users.rb +9 -0
  74. data/test/dummy/db/migrate/20130131092406_add_devise_to_users.rb +52 -0
  75. data/test/dummy/db/migrate/20130131142320_create_posts.rb +10 -0
  76. data/test/dummy/db/migrate/20130131160351_devise_otp_add_to_users.rb +28 -0
  77. data/test/dummy/lib/assets/.gitkeep +0 -0
  78. data/test/dummy/public/404.html +26 -0
  79. data/test/dummy/public/422.html +26 -0
  80. data/test/dummy/public/500.html +25 -0
  81. data/test/dummy/public/favicon.ico +0 -0
  82. data/test/dummy/script/rails +6 -0
  83. data/test/integration/persistence_test.rb +63 -0
  84. data/test/integration/refresh_test.rb +103 -0
  85. data/test/integration/sign_in_test.rb +85 -0
  86. data/test/integration/token_test.rb +30 -0
  87. data/test/integration_tests_helper.rb +64 -0
  88. data/test/model_tests_helper.rb +20 -0
  89. data/test/models/two_factorable_test.rb +120 -0
  90. data/test/orm/active_record.rb +4 -0
  91. data/test/orm/mongoid.rb +13 -0
  92. data/test/support/mongoid.yml +6 -0
  93. data/test/support/symmetric_encryption.yml +70 -0
  94. data/test/test_helper.rb +18 -0
  95. metadata +269 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 070861bfa115c61da00994b25c74df1fbbe87221
4
+ data.tar.gz: d4dd53c7efb91eccdafe6a4e90347bc9e63bf231
5
+ SHA512:
6
+ metadata.gz: c103bd13f1ad78d1134fb76f310f07a78b9a17d2495ffd12aa9ea2f73116dd611a87f65af4402045aebf113738de80f291fd3224648d46ba20049dc8484604a1
7
+ data.tar.gz: 4cde298ed0ce95614da2c4ce74d82efdca2eb2783f8f0f31ffb805131a405f74f18a6ac4846379606e418f276651483fddb58ea05cde14ea7148448f03f0beb8
@@ -0,0 +1,36 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ ## Specific to RubyMotion:
14
+ .dat*
15
+ .repl_history
16
+ build/
17
+
18
+ ## Documentation cache and generated files:
19
+ /.yardoc/
20
+ /_yardoc/
21
+ /doc/
22
+ /rdoc/
23
+
24
+ ## Environment normalization:
25
+ /.bundle/
26
+ /vendor/bundle
27
+ /lib/bundler/man/
28
+
29
+ # for a library or gem, you might want to ignore these files since the code is
30
+ # intended to run in multiple environments; otherwise, check them in:
31
+ # Gemfile.lock
32
+ # .ruby-version
33
+ # .ruby-gemset
34
+
35
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
36
+ .rvmrc
@@ -0,0 +1,2 @@
1
+ ruby:
2
+ config_file: .ruby-style.yml
@@ -0,0 +1,1248 @@
1
+ AllCops:
2
+ Include:
3
+ - "**/*.gemspec"
4
+ - "**/*.podspec"
5
+ - "**/*.jbuilder"
6
+ - "**/*.rake"
7
+ - "**/*.opal"
8
+ - "**/Gemfile"
9
+ - "**/Rakefile"
10
+ - "**/Capfile"
11
+ - "**/Guardfile"
12
+ - "**/Podfile"
13
+ - "**/Thorfile"
14
+ - "**/Vagrantfile"
15
+ - "**/Berksfile"
16
+ - "**/Cheffile"
17
+ - "**/Vagabondfile"
18
+ Exclude:
19
+ - "vendor/**/*"
20
+ - "bin/**/*"
21
+ - "config/**/*"
22
+ - "db/**/*"
23
+ - "**/config.ru"
24
+ - 'tmp/**/*'
25
+ DisplayCopNames: false
26
+ StyleGuideCopsOnly: false
27
+ TargetRubyVersion: 2.3
28
+ Style/AccessModifierIndentation:
29
+ Description: Check indentation of private/protected visibility modifiers.
30
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected
31
+ Enabled: true
32
+ EnforcedStyle: indent
33
+ SupportedStyles:
34
+ - outdent
35
+ - indent
36
+ Style/AlignHash:
37
+ Description: Align the elements of a hash literal if they span more than one line.
38
+ Enabled: true
39
+ EnforcedHashRocketStyle: key
40
+ EnforcedColonStyle: key
41
+ EnforcedLastArgumentHashStyle: always_inspect
42
+ SupportedLastArgumentHashStyles:
43
+ - always_inspect
44
+ - always_ignore
45
+ - ignore_implicit
46
+ - ignore_explicit
47
+ Style/AlignParameters:
48
+ Description: Align the parameters of a method call if they span more than one line.
49
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-double-indent
50
+ Enabled: true
51
+ EnforcedStyle: with_fixed_indentation
52
+ SupportedStyles:
53
+ - with_first_parameter
54
+ - with_fixed_indentation
55
+ Style/AndOr:
56
+ Description: Use &&/|| instead of and/or.
57
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-and-or-or
58
+ Enabled: true
59
+ EnforcedStyle: always
60
+ SupportedStyles:
61
+ - always
62
+ - conditionals
63
+ Style/BarePercentLiterals:
64
+ Description: Checks if usage of %() or %Q() matches configuration.
65
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-q-shorthand
66
+ Enabled: true
67
+ EnforcedStyle: bare_percent
68
+ SupportedStyles:
69
+ - percent_q
70
+ - bare_percent
71
+ Style/BracesAroundHashParameters:
72
+ Description: Enforce braces style around hash parameters.
73
+ Enabled: true
74
+ EnforcedStyle: no_braces
75
+ SupportedStyles:
76
+ - braces
77
+ - no_braces
78
+ - context_dependent
79
+ Style/CaseIndentation:
80
+ Description: Indentation of when in a case/when/[else/]end.
81
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#indent-when-to-case
82
+ Enabled: true
83
+ IndentWhenRelativeTo: case
84
+ SupportedStyles:
85
+ - case
86
+ - end
87
+ IndentOneStep: false
88
+ Style/ClassAndModuleChildren:
89
+ Description: Checks style of children classes and modules.
90
+ Enabled: false
91
+ EnforcedStyle: nested
92
+ SupportedStyles:
93
+ - nested
94
+ - compact
95
+ Style/ClassCheck:
96
+ Description: Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.
97
+ Enabled: true
98
+ EnforcedStyle: is_a?
99
+ SupportedStyles:
100
+ - is_a?
101
+ - kind_of?
102
+ Style/AutoResourceCleanup:
103
+ Description: 'Suggests the usage of an auto resource cleanup version of a method (if available).'
104
+ Enabled: true
105
+ Style/CollectionMethods:
106
+ Description: Preferred collection methods.
107
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#map-find-select-reduce-size
108
+ Enabled: true
109
+ PreferredMethods:
110
+ collect: map
111
+ collect!: map!
112
+ find: detect
113
+ find_all: select
114
+ reduce: inject
115
+ Style/CommentAnnotation:
116
+ Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK,
117
+ REVIEW).
118
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#annotate-keywords
119
+ Enabled: false
120
+ Keywords:
121
+ - TODO
122
+ - FIXME
123
+ - OPTIMIZE
124
+ - HACK
125
+ - REVIEW
126
+ Style/DotPosition:
127
+ Description: Checks the position of the dot in multi-line method calls.
128
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains
129
+ Enabled: true
130
+ EnforcedStyle: trailing
131
+ SupportedStyles:
132
+ - leading
133
+ - trailing
134
+ Style/EmptyLineBetweenDefs:
135
+ Description: Use empty lines between defs.
136
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods
137
+ Enabled: true
138
+ AllowAdjacentOneLineDefs: false
139
+ Style/EmptyLinesAroundBlockBody:
140
+ Description: Keeps track of empty lines around block bodies.
141
+ Enabled: true
142
+ EnforcedStyle: no_empty_lines
143
+ SupportedStyles:
144
+ - empty_lines
145
+ - no_empty_lines
146
+ Style/EmptyLinesAroundClassBody:
147
+ Description: Keeps track of empty lines around class bodies.
148
+ Enabled: true
149
+ EnforcedStyle: no_empty_lines
150
+ SupportedStyles:
151
+ - empty_lines
152
+ - no_empty_lines
153
+ Style/EmptyLinesAroundModuleBody:
154
+ Description: Keeps track of empty lines around module bodies.
155
+ Enabled: true
156
+ EnforcedStyle: no_empty_lines
157
+ SupportedStyles:
158
+ - empty_lines
159
+ - no_empty_lines
160
+ Style/Encoding:
161
+ Description: Use UTF-8 as the source file encoding.
162
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#utf-8
163
+ Enabled: false
164
+ EnforcedStyle: always
165
+ SupportedStyles:
166
+ - when_needed
167
+ - always
168
+ Style/FileName:
169
+ Description: Use snake_case for source file names.
170
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-files
171
+ Enabled: false
172
+ Exclude: []
173
+ Style/FirstParameterIndentation:
174
+ Description: Checks the indentation of the first parameter in a method call.
175
+ Enabled: true
176
+ EnforcedStyle: special_for_inner_method_call_in_parentheses
177
+ SupportedStyles:
178
+ - consistent
179
+ - special_for_inner_method_call
180
+ - special_for_inner_method_call_in_parentheses
181
+ Style/For:
182
+ Description: Checks use of for or each in multiline loops.
183
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-for-loops
184
+ Enabled: true
185
+ EnforcedStyle: each
186
+ SupportedStyles:
187
+ - for
188
+ - each
189
+ Style/FormatString:
190
+ Description: Enforce the use of Kernel#sprintf, Kernel#format or String#%.
191
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#sprintf
192
+ Enabled: false
193
+ EnforcedStyle: format
194
+ SupportedStyles:
195
+ - format
196
+ - sprintf
197
+ - percent
198
+ Style/GlobalVars:
199
+ Description: Do not introduce global variables.
200
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#instance-vars
201
+ Enabled: false
202
+ AllowedVariables: []
203
+ Style/GuardClause:
204
+ Description: Check for conditionals that can be replaced with guard clauses
205
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
206
+ Enabled: true
207
+ MinBodyLength: 1
208
+ Style/HashSyntax:
209
+ Description: 'Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax { :a =>
210
+ 1, :b => 2 }.'
211
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#hash-literals
212
+ Enabled: true
213
+ EnforcedStyle: ruby19
214
+ SupportedStyles:
215
+ - ruby19
216
+ - hash_rockets
217
+ Style/IfUnlessModifier:
218
+ Description: Favor modifier if/unless usage when you have a single-line body.
219
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier
220
+ Enabled: true
221
+ MaxLineLength: 200
222
+ Style/IndentationWidth:
223
+ Description: Use 2 spaces for indentation.
224
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-indentation
225
+ Enabled: true
226
+ Width: 2
227
+ Style/IndentHash:
228
+ Description: Checks the indentation of the first key in a hash literal.
229
+ Enabled: true
230
+ EnforcedStyle: special_inside_parentheses
231
+ SupportedStyles:
232
+ - special_inside_parentheses
233
+ - consistent
234
+ Style/LambdaCall:
235
+ Description: Use lambda.call(...) instead of lambda.(...).
236
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#proc-call
237
+ Enabled: false
238
+ EnforcedStyle: call
239
+ SupportedStyles:
240
+ - call
241
+ - braces
242
+ Style/Next:
243
+ Description: Use `next` to skip iteration instead of a condition at the end.
244
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals
245
+ Enabled: false
246
+ EnforcedStyle: skip_modifier_ifs
247
+ MinBodyLength: 3
248
+ SupportedStyles:
249
+ - skip_modifier_ifs
250
+ - always
251
+ Style/NonNilCheck:
252
+ Description: Checks for redundant nil checks.
253
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks
254
+ Enabled: true
255
+ IncludeSemanticChanges: false
256
+ Style/MethodDefParentheses:
257
+ Description: Checks if the method definitions have or don't have parentheses.
258
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#method-parens
259
+ Enabled: true
260
+ EnforcedStyle: require_parentheses
261
+ SupportedStyles:
262
+ - require_parentheses
263
+ - require_no_parentheses
264
+ Style/MethodName:
265
+ Description: Use the configured style when naming methods.
266
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars
267
+ Enabled: true
268
+ EnforcedStyle: snake_case
269
+ SupportedStyles:
270
+ - snake_case
271
+ - camelCase
272
+ Style/MultilineOperationIndentation:
273
+ Description: Checks indentation of binary operations that span more than one line.
274
+ Enabled: true
275
+ EnforcedStyle: aligned
276
+ SupportedStyles:
277
+ - aligned
278
+ - indented
279
+ Style/NumericLiterals:
280
+ Description: Add underscores to large numeric literals to improve their readability.
281
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics
282
+ Enabled: true
283
+ MinDigits: 5
284
+ Style/ParenthesesAroundCondition:
285
+ Description: Don't use parentheses around the condition of an if/unless/while.
286
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-parens-if
287
+ Enabled: true
288
+ AllowSafeAssignment: true
289
+ Style/PercentLiteralDelimiters:
290
+ Description: Use `%`-literal delimiters consistently
291
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-literal-braces
292
+ Enabled: false
293
+ PreferredDelimiters:
294
+ "%": "()"
295
+ "%i": "()"
296
+ "%q": "()"
297
+ "%Q": "()"
298
+ "%r": "{}"
299
+ "%s": "()"
300
+ "%w": "()"
301
+ "%W": "()"
302
+ "%x": "()"
303
+ Style/PercentQLiterals:
304
+ Description: Checks if uses of %Q/%q match the configured preference.
305
+ Enabled: true
306
+ EnforcedStyle: lower_case_q
307
+ SupportedStyles:
308
+ - lower_case_q
309
+ - upper_case_q
310
+ Style/PredicateName:
311
+ Description: Check the names of predicate methods.
312
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark
313
+ Enabled: true
314
+ NamePrefix:
315
+ - is_
316
+ - has_
317
+ - have_
318
+ NamePrefixBlacklist:
319
+ - is_
320
+ Style/RaiseArgs:
321
+ Description: Checks the arguments passed to raise/fail.
322
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#exception-class-messages
323
+ Enabled: false
324
+ EnforcedStyle: exploded
325
+ SupportedStyles:
326
+ - compact
327
+ - exploded
328
+ Style/RedundantReturn:
329
+ Description: Don't use return where it's not required.
330
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-explicit-return
331
+ Enabled: true
332
+ AllowMultipleReturnValues: false
333
+ Style/RegexpLiteral:
334
+ Description: Use %r for regular expressions matching more than `MaxSlashes` '/'
335
+ characters. Use %r only for regular expressions matching more than `MaxSlashes`
336
+ '/' character.
337
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-r
338
+ Enabled: true
339
+ EnforcedStyle: slashes
340
+ Style/Semicolon:
341
+ Description: Don't use semicolons to terminate expressions.
342
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-semicolon
343
+ Enabled: true
344
+ AllowAsExpressionSeparator: false
345
+ Style/SignalException:
346
+ Description: Checks for proper usage of fail and raise.
347
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#fail-method
348
+ Enabled: false
349
+ EnforcedStyle: semantic
350
+ SupportedStyles:
351
+ - only_raise
352
+ - only_fail
353
+ - semantic
354
+ Style/SingleLineBlockParams:
355
+ Description: Enforces the names of some block params.
356
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#reduce-blocks
357
+ Enabled: false
358
+ Methods:
359
+ - reduce:
360
+ - a
361
+ - e
362
+ - inject:
363
+ - a
364
+ - e
365
+ Style/SingleLineMethods:
366
+ Description: Avoid single-line methods.
367
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-single-line-methods
368
+ Enabled: false
369
+ AllowIfMethodIsEmpty: true
370
+ Style/StringLiterals:
371
+ Description: Checks if uses of quotes match the configured preference.
372
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#consistent-string-literals
373
+ Enabled: true
374
+ EnforcedStyle: single_quotes
375
+ SupportedStyles:
376
+ - single_quotes
377
+ - double_quotes
378
+ Style/StringLiteralsInInterpolation:
379
+ Description: Checks if uses of quotes inside expressions in interpolated strings
380
+ match the configured preference.
381
+ Enabled: true
382
+ EnforcedStyle: single_quotes
383
+ SupportedStyles:
384
+ - single_quotes
385
+ - double_quotes
386
+ Style/SpaceAroundBlockParameters:
387
+ Description: Checks the spacing inside and after block parameters pipes.
388
+ Enabled: true
389
+ EnforcedStyleInsidePipes: no_space
390
+ SupportedStyles:
391
+ - space
392
+ - no_space
393
+ Style/SpaceAroundEqualsInParameterDefault:
394
+ Description: Checks that the equals signs in parameter default assignments have
395
+ or don't have surrounding space depending on configuration.
396
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-around-equals
397
+ Enabled: true
398
+ EnforcedStyle: space
399
+ SupportedStyles:
400
+ - space
401
+ - no_space
402
+ Style/SpaceBeforeBlockBraces:
403
+ Description: Checks that the left block brace has or doesn't have space before it.
404
+ Enabled: true
405
+ EnforcedStyle: space
406
+ SupportedStyles:
407
+ - space
408
+ - no_space
409
+ Style/SpaceInsideBlockBraces:
410
+ Description: Checks that block braces have or don't have surrounding space. For
411
+ blocks taking parameters, checks that the left brace has or doesn't have trailing
412
+ space.
413
+ Enabled: true
414
+ EnforcedStyle: space
415
+ SupportedStyles:
416
+ - space
417
+ - no_space
418
+ EnforcedStyleForEmptyBraces: no_space
419
+ SpaceBeforeBlockParameters: true
420
+ Style/SpaceInsideHashLiteralBraces:
421
+ Description: Use spaces inside hash literal braces - or don't.
422
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators
423
+ Enabled: true
424
+ EnforcedStyle: space
425
+ EnforcedStyleForEmptyBraces: no_space
426
+ SupportedStyles:
427
+ - space
428
+ - no_space
429
+ Style/SymbolProc:
430
+ Description: Use symbols as procs instead of blocks when possible.
431
+ Enabled: true
432
+ IgnoredMethods:
433
+ - respond_to
434
+ Style/TrailingBlankLines:
435
+ Description: Checks trailing blank lines and final newline.
436
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#newline-eof
437
+ Enabled: true
438
+ EnforcedStyle: final_newline
439
+ SupportedStyles:
440
+ - final_newline
441
+ - final_blank_line
442
+ Style/TrailingCommaInLiteral:
443
+ Description: Checks for trailing comma in parameter lists and literals.
444
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
445
+ Enabled: true
446
+ EnforcedStyleForMultiline: no_comma
447
+ SupportedStyles:
448
+ - comma
449
+ - no_comma
450
+ Style/TrailingCommaInArguments:
451
+ Description: Checks for trailing comma in parameter lists and literals.
452
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas
453
+ Enabled: true
454
+ EnforcedStyleForMultiline: no_comma
455
+ SupportedStyles:
456
+ - comma
457
+ - no_comma
458
+ Style/TrivialAccessors:
459
+ Description: Prefer attr_* methods to trivial readers/writers.
460
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr_family
461
+ Enabled: false
462
+ ExactNameMatch: false
463
+ AllowPredicates: false
464
+ AllowDSLWriters: false
465
+ Whitelist:
466
+ - to_ary
467
+ - to_a
468
+ - to_c
469
+ - to_enum
470
+ - to_h
471
+ - to_hash
472
+ - to_i
473
+ - to_int
474
+ - to_io
475
+ - to_open
476
+ - to_path
477
+ - to_proc
478
+ - to_r
479
+ - to_regexp
480
+ - to_str
481
+ - to_s
482
+ - to_sym
483
+ Style/VariableName:
484
+ Description: Use the configured style when naming variables.
485
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars
486
+ Enabled: true
487
+ EnforcedStyle: snake_case
488
+ SupportedStyles:
489
+ - snake_case
490
+ - camelCase
491
+ Style/WhileUntilModifier:
492
+ Description: Favor modifier while/until usage when you have a single-line body.
493
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier
494
+ Enabled: false
495
+ MaxLineLength: 200
496
+ Style/WordArray:
497
+ Description: Use %w or %W for arrays of words.
498
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-w
499
+ Enabled: true
500
+ MinSize: 0
501
+ WordRegex: !ruby/regexp /\A[\p{Word}]+\z/
502
+ Metrics/AbcSize:
503
+ Description: A calculated magnitude based on number of assignments, branches, and
504
+ conditions.
505
+ Enabled: false
506
+ Max: 25
507
+ Metrics/BlockNesting:
508
+ Description: Avoid excessive block nesting
509
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count
510
+ Enabled: true
511
+ Max: 3
512
+ Metrics/ClassLength:
513
+ Description: Avoid classes longer than 100 lines of code.
514
+ Enabled: false
515
+ CountComments: false
516
+ Max: 100
517
+ Metrics/CyclomaticComplexity:
518
+ Description: A complexity metric that is strongly correlated to the number of test
519
+ cases needed to validate a method.
520
+ Enabled: false
521
+ Max: 6
522
+ Metrics/LineLength:
523
+ Description: Limit lines to 200 characters.
524
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#80-character-limits
525
+ Enabled: false
526
+ Max: 200
527
+ AllowURI: true
528
+ URISchemes:
529
+ - http
530
+ - https
531
+ Metrics/MethodLength:
532
+ Description: Avoid methods longer than 10 lines of code.
533
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#short-methods
534
+ Enabled: false
535
+ CountComments: false
536
+ Max: 10
537
+ Metrics/ParameterLists:
538
+ Description: Avoid parameter lists longer than three or four parameters.
539
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#too-many-params
540
+ Enabled: false
541
+ Max: 5
542
+ CountKeywordArgs: true
543
+ Metrics/PerceivedComplexity:
544
+ Description: A complexity metric geared towards measuring complexity for a human
545
+ reader.
546
+ Enabled: false
547
+ Max: 7
548
+ Lint/AssignmentInCondition:
549
+ Description: Don't use assignment in conditions.
550
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition
551
+ Enabled: false
552
+ AllowSafeAssignment: true
553
+ Lint/EndAlignment:
554
+ Description: Align ends correctly.
555
+ Enabled: true
556
+ AlignWith: keyword
557
+ SupportedStyles:
558
+ - keyword
559
+ - variable
560
+ Lint/DefEndAlignment:
561
+ Description: Align ends corresponding to defs correctly.
562
+ Enabled: true
563
+ AlignWith: start_of_line
564
+ SupportedStyles:
565
+ - start_of_line
566
+ - def
567
+ Rails/ActionFilter:
568
+ Description: Enforces consistent use of action filter methods.
569
+ Enabled: false
570
+ EnforcedStyle: action
571
+ SupportedStyles:
572
+ - action
573
+ - filter
574
+ Include:
575
+ - app/controllers/**/*.rb
576
+ Rails/HasAndBelongsToMany:
577
+ Description: Prefer has_many :through to has_and_belongs_to_many.
578
+ Enabled: false
579
+ Include:
580
+ - app/models/**/*.rb
581
+ Rails/Output:
582
+ Description: Checks for calls to puts, print, etc.
583
+ Enabled: true
584
+ Include:
585
+ - app/**/*.rb
586
+ - config/**/*.rb
587
+ - db/**/*.rb
588
+ - lib/**/*.rb
589
+ Rails/ReadWriteAttribute:
590
+ Description: Checks for read_attribute(:attr) and write_attribute(:attr, val).
591
+ Enabled: true
592
+ Include:
593
+ - app/models/**/*.rb
594
+ Rails/ScopeArgs:
595
+ Description: Checks the arguments of ActiveRecord scopes.
596
+ Enabled: false
597
+ Include:
598
+ - app/models/**/*.rb
599
+ Rails/Validation:
600
+ Description: Use validates :attribute, hash of validations.
601
+ Enabled: false
602
+ Include:
603
+ - app/models/**/*.rb
604
+ Style/InlineComment:
605
+ Description: Avoid inline comments.
606
+ Enabled: false
607
+ Style/MethodCalledOnDoEndBlock:
608
+ Description: Avoid chaining a method call on a do...end block.
609
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#single-line-blocks
610
+ Enabled: false
611
+ Style/SymbolArray:
612
+ Description: Use %i or %I for arrays of symbols.
613
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-i
614
+ Enabled: false
615
+ Style/ExtraSpacing:
616
+ Description: Do not use unnecessary spacing.
617
+ Enabled: true
618
+ Style/AccessorMethodName:
619
+ Description: Check the naming of accessor methods for get_/set_.
620
+ Enabled: true
621
+ Style/Alias:
622
+ Description: Use alias_method instead of alias.
623
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#alias-method
624
+ Enabled: false
625
+ Style/AlignArray:
626
+ Description: Align the elements of an array literal if they span more than one line.
627
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays
628
+ Enabled: true
629
+ Style/ArrayJoin:
630
+ Description: Use Array#join instead of Array#*.
631
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#array-join
632
+ Enabled: false
633
+ Style/AsciiComments:
634
+ Description: Use only ascii symbols in comments.
635
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#english-comments
636
+ Enabled: true
637
+ Style/AsciiIdentifiers:
638
+ Description: Use only ascii symbols in identifiers.
639
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#english-identifiers
640
+ Enabled: true
641
+ Style/Attr:
642
+ Description: Checks for uses of Module#attr.
643
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#attr
644
+ Enabled: false
645
+ Style/BeginBlock:
646
+ Description: Avoid the use of BEGIN blocks.
647
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks
648
+ Enabled: true
649
+ Style/BlockComments:
650
+ Description: Do not use block comments.
651
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-block-comments
652
+ Enabled: true
653
+ Style/BlockEndNewline:
654
+ Description: Put end statement of multiline block on its own line.
655
+ Enabled: true
656
+ Style/BlockDelimiters:
657
+ EnforcedStyle: line_count_based
658
+ Enabled: true
659
+ Style/CaseEquality:
660
+ Description: Avoid explicit use of the case equality operator(===).
661
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-case-equality
662
+ Enabled: false
663
+ Style/CharacterLiteral:
664
+ Description: Checks for uses of character literals.
665
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-character-literals
666
+ Enabled: false
667
+ Style/ClassAndModuleCamelCase:
668
+ Description: Use CamelCase for classes and modules.
669
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#camelcase-classes
670
+ Enabled: true
671
+ Style/ClassMethods:
672
+ Description: Use self when defining module/class methods.
673
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#def-self-singletons
674
+ Enabled: true
675
+ Style/ClassVars:
676
+ Description: Avoid the use of class variables.
677
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-class-vars
678
+ Enabled: false
679
+ Style/ColonMethodCall:
680
+ Description: 'Do not use :: for method call.'
681
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#double-colons
682
+ Enabled: false
683
+ Style/CommentIndentation:
684
+ Description: Indentation of comments.
685
+ Enabled: true
686
+ Style/ConstantName:
687
+ Description: Constants should use SCREAMING_SNAKE_CASE.
688
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#screaming-snake-case
689
+ Enabled: true
690
+ Style/DefWithParentheses:
691
+ Description: Use def with parentheses when there are arguments.
692
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#method-parens
693
+ Enabled: true
694
+ Style/DeprecatedHashMethods:
695
+ Description: Checks for use of deprecated Hash methods.
696
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#hash-key
697
+ Enabled: true
698
+ Style/Documentation:
699
+ Description: Document classes and non-namespace modules.
700
+ Enabled: false
701
+ Style/DoubleNegation:
702
+ Description: Checks for uses of double negation (!!).
703
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-bang-bang
704
+ Enabled: true
705
+ Style/EachWithObject:
706
+ Description: Prefer `each_with_object` over `inject` or `reduce`.
707
+ Enabled: false
708
+ Style/ElseAlignment:
709
+ Description: Align elses and elsifs correctly.
710
+ Enabled: true
711
+ Style/EmptyElse:
712
+ Description: Avoid empty else-clauses.
713
+ Enabled: true
714
+ Style/EmptyLines:
715
+ Description: Don't use several empty lines in a row.
716
+ Enabled: true
717
+ Style/EmptyLinesAroundAccessModifier:
718
+ Description: Keep blank lines around access modifiers.
719
+ Enabled: true
720
+ Style/EmptyLinesAroundMethodBody:
721
+ Description: Keeps track of empty lines around method bodies.
722
+ Enabled: true
723
+ Style/EmptyLiteral:
724
+ Description: Prefer literals to Array.new/Hash.new/String.new.
725
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#literal-array-hash
726
+ Enabled: true
727
+ Style/EndBlock:
728
+ Description: Avoid the use of END blocks.
729
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-END-blocks
730
+ Enabled: true
731
+ Style/EndOfLine:
732
+ Description: Use Unix-style line endings.
733
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#crlf
734
+ Enabled: true
735
+ Style/EvenOdd:
736
+ Description: Favor the use of Fixnum#even? && Fixnum#odd?
737
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#predicate-methods
738
+ Enabled: false
739
+ Style/FlipFlop:
740
+ Description: Checks for flip flops
741
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-flip-flops
742
+ Enabled: false
743
+ Style/IfWithSemicolon:
744
+ Description: Do not use if x; .... Use the ternary operator instead.
745
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs
746
+ Enabled: true
747
+ Style/IndentationConsistency:
748
+ Description: Keep indentation straight.
749
+ Enabled: true
750
+ Style/IndentArray:
751
+ Description: Checks the indentation of the first element in an array literal.
752
+ Enabled: true
753
+ Style/InfiniteLoop:
754
+ Description: Use Kernel#loop for infinite loops.
755
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#infinite-loop
756
+ Enabled: true
757
+ Style/Lambda:
758
+ Description: Use the new lambda literal syntax for single-line blocks.
759
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#lambda-multi-line
760
+ Enabled: true
761
+ Style/LeadingCommentSpace:
762
+ Description: Comments should start with a space.
763
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#hash-space
764
+ Enabled: true
765
+ Style/LineEndConcatenation:
766
+ Description: Use \ instead of + or << to concatenate two string literals at line
767
+ end.
768
+ Enabled: false
769
+ Style/MethodCallParentheses:
770
+ Description: Do not use parentheses for method calls with no arguments.
771
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-args-no-parens
772
+ Enabled: true
773
+ Style/ModuleFunction:
774
+ Description: Checks for usage of `extend self` in modules.
775
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#module-function
776
+ Enabled: false
777
+ Style/MultilineBlockChain:
778
+ Description: Avoid multi-line chains of blocks.
779
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#single-line-blocks
780
+ Enabled: true
781
+ Style/MultilineBlockLayout:
782
+ Description: Ensures newlines after multiline block do statements.
783
+ Enabled: true
784
+ Style/MultilineIfThen:
785
+ Description: Do not use then for multi-line if/unless.
786
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-then
787
+ Enabled: true
788
+ Style/MultilineTernaryOperator:
789
+ Description: 'Avoid multi-line ?: (the ternary operator); use if/unless instead.'
790
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-multiline-ternary
791
+ Enabled: true
792
+ Style/NegatedIf:
793
+ Description: Favor unless over if for negative conditions (or control flow or).
794
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#unless-for-negatives
795
+ Enabled: false
796
+ Style/NegatedWhile:
797
+ Description: Favor until over while for negative conditions.
798
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#until-for-negatives
799
+ Enabled: false
800
+ Style/NestedTernaryOperator:
801
+ Description: Use one expression per branch in a ternary operator.
802
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-nested-ternary
803
+ Enabled: true
804
+ Style/NilComparison:
805
+ Description: Prefer x.nil? to x == nil.
806
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#predicate-methods
807
+ Enabled: false
808
+ Style/Not:
809
+ Description: Use ! instead of not.
810
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#bang-not-not
811
+ Enabled: true
812
+ Style/OneLineConditional:
813
+ Description: Favor the ternary operator(?:) over if/then/else/end constructs.
814
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#ternary-operator
815
+ Enabled: false
816
+ Style/OpMethod:
817
+ Description: When defining binary operators, name the argument other.
818
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#other-arg
819
+ Enabled: false
820
+ Style/PerlBackrefs:
821
+ Description: Avoid Perl-style regex back references.
822
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers
823
+ Enabled: false
824
+ Style/Proc:
825
+ Description: Use proc instead of Proc.new.
826
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#proc
827
+ Enabled: false
828
+ Style/RedundantBegin:
829
+ Description: Don't use begin blocks when they are not needed.
830
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#begin-implicit
831
+ Enabled: true
832
+ Style/RedundantException:
833
+ Description: Checks for an obsolete RuntimeException argument in raise/fail.
834
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-explicit-runtimeerror
835
+ Enabled: true
836
+ Style/RedundantSelf:
837
+ Description: Don't use self where it's not needed.
838
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-self-unless-required
839
+ Enabled: true
840
+ Style/RescueModifier:
841
+ Description: Avoid using rescue in its modifier form.
842
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-rescue-modifiers
843
+ Enabled: true
844
+ Style/SelfAssignment:
845
+ Description: Checks for places where self-assignment shorthand should have been
846
+ used.
847
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#self-assignment
848
+ Enabled: true
849
+ Style/SpaceAfterColon:
850
+ Description: Use spaces after colons.
851
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators
852
+ Enabled: true
853
+ Style/SpaceAfterComma:
854
+ Description: Use spaces after commas.
855
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators
856
+ Enabled: true
857
+ Style/SpaceAroundKeyword:
858
+ Description: 'Use a space around keywords if appropriate.'
859
+ Enabled: true
860
+ Style/SpaceAfterMethodName:
861
+ Description: Do not put a space between a method name and the opening parenthesis
862
+ in a method definition.
863
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#parens-no-spaces
864
+ Enabled: true
865
+ Style/SpaceAfterNot:
866
+ Description: Tracks redundant space after the ! operator.
867
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-space-bang
868
+ Enabled: true
869
+ Style/SpaceAfterSemicolon:
870
+ Description: Use spaces after semicolons.
871
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators
872
+ Enabled: true
873
+ Style/SpaceBeforeComma:
874
+ Description: No spaces before commas.
875
+ Enabled: true
876
+ Style/SpaceBeforeComment:
877
+ Description: Checks for missing space between code and a comment on the same line.
878
+ Enabled: true
879
+ Style/SpaceBeforeSemicolon:
880
+ Description: No spaces before semicolons.
881
+ Enabled: true
882
+ Style/SpaceAroundOperators:
883
+ Description: Use spaces around operators.
884
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-operators
885
+ Enabled: true
886
+ Style/SpaceInsideBrackets:
887
+ Description: No spaces after [ or before ].
888
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-spaces-braces
889
+ Enabled: true
890
+ Style/SpaceInsideParens:
891
+ Description: No spaces after ( or before ).
892
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-spaces-braces
893
+ Enabled: true
894
+ Style/SpaceInsideRangeLiteral:
895
+ Description: No spaces inside range literals.
896
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals
897
+ Enabled: true
898
+ Style/SpecialGlobalVars:
899
+ Description: Avoid Perl-style global variables.
900
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms
901
+ Enabled: false
902
+ Style/StructInheritance:
903
+ Description: Checks for inheritance from Struct.new.
904
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-extend-struct-new
905
+ Enabled: true
906
+ Style/Tab:
907
+ Description: No hard tabs.
908
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#spaces-indentation
909
+ Enabled: true
910
+ Style/TrailingWhitespace:
911
+ Description: Avoid trailing whitespace.
912
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace
913
+ Enabled: true
914
+ Style/UnlessElse:
915
+ Description: Do not use unless with else. Rewrite these with the positive case first.
916
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-else-with-unless
917
+ Enabled: true
918
+ Style/UnneededCapitalW:
919
+ Description: Checks for %W when interpolation is not needed.
920
+ Enabled: true
921
+ Style/UnneededPercentQ:
922
+ Description: Checks for %q/%Q when single quotes or double quotes would do.
923
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-q
924
+ Enabled: true
925
+ Style/MultilineHashBraceLayout:
926
+ Description: >-
927
+ Checks that the closing brace in a hash literal is
928
+ symmetrical with respect to the opening brace and the
929
+ hash elements.
930
+ Enabled: false
931
+ Style/CommandLiteral:
932
+ Description: Checks for %x when `` would do.
933
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#percent-x
934
+ Enabled: true
935
+ Style/VariableInterpolation:
936
+ Description: Don't interpolate global, instance and class variables directly in
937
+ strings.
938
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#curlies-interpolate
939
+ Enabled: false
940
+ Style/WhenThen:
941
+ Description: Use when x then ... for one-line cases.
942
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#one-line-cases
943
+ Enabled: false
944
+ Style/WhileUntilDo:
945
+ Description: Checks for redundant do after while or until.
946
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-multiline-while-do
947
+ Enabled: true
948
+ Lint/AmbiguousOperator:
949
+ Description: Checks for ambiguous operators in the first argument of a method invocation
950
+ without parentheses.
951
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#parens-as-args
952
+ Enabled: false
953
+ Lint/AmbiguousRegexpLiteral:
954
+ Description: Checks for ambiguous regexp literals in the first argument of a method
955
+ invocation without parenthesis.
956
+ Enabled: false
957
+ Lint/BlockAlignment:
958
+ Description: Align block ends correctly.
959
+ Enabled: true
960
+ Lint/ConditionPosition:
961
+ Description: Checks for condition placed in a confusing position relative to the
962
+ keyword.
963
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#same-line-condition
964
+ Enabled: false
965
+ Lint/Debugger:
966
+ Description: Check for debugger calls.
967
+ Enabled: true
968
+ Lint/DeprecatedClassMethods:
969
+ Description: Check for deprecated class method calls.
970
+ Enabled: false
971
+ Lint/DuplicateMethods:
972
+ Description: Check for duplicate methods calls.
973
+ Enabled: true
974
+ Lint/ElseLayout:
975
+ Description: Check for odd code arrangement in an else block.
976
+ Enabled: true
977
+ Lint/EmptyEnsure:
978
+ Description: Checks for empty ensure block.
979
+ Enabled: true
980
+ Lint/EmptyInterpolation:
981
+ Description: Checks for empty string interpolation.
982
+ Enabled: true
983
+ Lint/EndInMethod:
984
+ Description: END blocks should not be placed inside method definitions.
985
+ Enabled: true
986
+ Lint/EnsureReturn:
987
+ Description: Do not use return in an ensure block.
988
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-return-ensure
989
+ Enabled: true
990
+ Lint/Eval:
991
+ Description: The use of eval represents a serious security risk.
992
+ Enabled: true
993
+ Exclude:
994
+ - "spec/**/*"
995
+ Lint/HandleExceptions:
996
+ Description: Don't suppress exception.
997
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions
998
+ Enabled: true
999
+ Lint/InvalidCharacterLiteral:
1000
+ Description: Checks for invalid character literals with a non-escaped whitespace
1001
+ character.
1002
+ Enabled: false
1003
+ Lint/LiteralInCondition:
1004
+ Description: Checks of literals used in conditions.
1005
+ Enabled: false
1006
+ Lint/LiteralInInterpolation:
1007
+ Description: Checks for literals used in interpolation.
1008
+ Enabled: true
1009
+ Lint/Loop:
1010
+ Description: Use Kernel#loop with break rather than begin/end/until or begin/end/while
1011
+ for post-loop tests.
1012
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#loop-with-break
1013
+ Enabled: false
1014
+ Lint/ParenthesesAsGroupedExpression:
1015
+ Description: Checks for method calls with a space before the opening parenthesis.
1016
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#parens-no-spaces
1017
+ Enabled: true
1018
+ Lint/RequireParentheses:
1019
+ Description: Use parentheses in the method call to avoid confusion about precedence.
1020
+ Enabled: false
1021
+ Lint/RescueException:
1022
+ Description: Avoid rescuing the Exception class.
1023
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-blind-rescues
1024
+ Enabled: true
1025
+ Lint/ShadowingOuterLocalVariable:
1026
+ Description: Do not use the same name as outer local variable for block arguments
1027
+ or block local variables.
1028
+ Enabled: true
1029
+ Lint/SpaceBeforeFirstArg:
1030
+ Description: Put a space between a method name and the first argument in a method
1031
+ call without parentheses.
1032
+ Enabled: true
1033
+ Lint/StringConversionInInterpolation:
1034
+ Description: Checks for Object#to_s usage in string interpolation.
1035
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#no-to-s
1036
+ Enabled: true
1037
+ Lint/UnderscorePrefixedVariableName:
1038
+ Description: Do not use prefix `_` for a variable that is used.
1039
+ Enabled: true
1040
+ Lint/UnusedBlockArgument:
1041
+ Description: Checks for unused block arguments.
1042
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars
1043
+ Enabled: true
1044
+ Lint/UnusedMethodArgument:
1045
+ Description: Checks for unused method arguments.
1046
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars
1047
+ Enabled: true
1048
+ Lint/UnreachableCode:
1049
+ Description: Unreachable code.
1050
+ Enabled: true
1051
+ Lint/UselessAccessModifier:
1052
+ Description: Checks for useless access modifiers.
1053
+ Enabled: true
1054
+ Lint/UselessAssignment:
1055
+ Description: Checks for useless assignment to a local variable.
1056
+ StyleGuide: https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars
1057
+ Enabled: true
1058
+ Lint/UselessComparison:
1059
+ Description: Checks for comparison of something with itself.
1060
+ Enabled: true
1061
+ Lint/UselessElseWithoutRescue:
1062
+ Description: Checks for useless `else` in `begin..end` without `rescue`.
1063
+ Enabled: true
1064
+ Lint/UselessSetterCall:
1065
+ Description: Checks for useless setter call to a local variable.
1066
+ Enabled: true
1067
+ Lint/Void:
1068
+ Description: Possible use of operator/literal/variable in void context.
1069
+ Enabled: true
1070
+ Performance/Casecmp:
1071
+ Description: 'Use `casecmp` rather than `downcase ==`.'
1072
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringcasecmp-vs-stringdowncase---code'
1073
+ Enabled: false
1074
+
1075
+ Performance/CaseWhenSplat:
1076
+ Description: >-
1077
+ Place `when` conditions that use splat at the end
1078
+ of the list of `when` branches.
1079
+ Enabled: true
1080
+
1081
+ Performance/Count:
1082
+ Description: >-
1083
+ Use `count` instead of `select...size`, `reject...size`,
1084
+ `select...count`, `reject...count`, `select...length`,
1085
+ and `reject...length`.
1086
+ Enabled: true
1087
+
1088
+ Performance/Detect:
1089
+ Description: >-
1090
+ Use `detect` instead of `select.first`, `find_all.first`,
1091
+ `select.last`, and `find_all.last`.
1092
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
1093
+ Enabled: true
1094
+
1095
+ Performance/DoubleStartEndWith:
1096
+ Description: >-
1097
+ Use `str.{start,end}_with?(x, ..., y, ...)`
1098
+ instead of `str.{start,end}_with?(x, ...) || str.{start,end}_with?(y, ...)`.
1099
+ Enabled: true
1100
+
1101
+ Performance/EndWith:
1102
+ Description: 'Use `end_with?` instead of a regex match anchored to the end of a string.'
1103
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
1104
+ Enabled: true
1105
+
1106
+ Performance/FixedSize:
1107
+ Description: 'Do not compute the size of statically sized objects except in constants'
1108
+ Enabled: true
1109
+
1110
+ Performance/FlatMap:
1111
+ Description: >-
1112
+ Use `Enumerable#flat_map`
1113
+ instead of `Enumerable#map...Array#flatten(1)`
1114
+ or `Enumberable#collect..Array#flatten(1)`
1115
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
1116
+ Enabled: true
1117
+ EnabledForFlattenWithoutParams: true
1118
+ # If enabled, this cop will warn about usages of
1119
+ # `flatten` being called without any parameters.
1120
+ # This can be dangerous since `flat_map` will only flatten 1 level, and
1121
+ # `flatten` without any parameters can flatten multiple levels.
1122
+
1123
+ Performance/HashEachMethods:
1124
+ Description: >-
1125
+ Use `Hash#each_key` and `Hash#each_value` instead of
1126
+ `Hash#keys.each` and `Hash#values.each`.
1127
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-each'
1128
+ Enabled: true
1129
+ AutoCorrect: true
1130
+
1131
+ Performance/LstripRstrip:
1132
+ Description: 'Use `strip` instead of `lstrip.rstrip`.'
1133
+ Enabled: true
1134
+
1135
+ Performance/RangeInclude:
1136
+ Description: 'Use `Range#cover?` instead of `Range#include?`.'
1137
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#cover-vs-include-code'
1138
+ Enabled: true
1139
+
1140
+ Performance/RedundantBlockCall:
1141
+ Description: 'Use `yield` instead of `block.call`.'
1142
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#proccall-vs-yield-code'
1143
+ Enabled: true
1144
+
1145
+ Performance/RedundantMatch:
1146
+ Description: >-
1147
+ Use `=~` instead of `String#match` or `Regexp#match` in a context where the
1148
+ returned `MatchData` is not needed.
1149
+ Enabled: true
1150
+
1151
+ Performance/RedundantMerge:
1152
+ Description: 'Use Hash#[]=, rather than Hash#merge! or Hash#update with a single key-value pair.'
1153
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#hashmerge-vs-hash-code'
1154
+ Enabled: true
1155
+
1156
+ Performance/RedundantSortBy:
1157
+ Description: 'Use `sort` instead of `sort_by { |x| x }`.'
1158
+ Enabled: true
1159
+
1160
+ Performance/ReverseEach:
1161
+ Description: 'Use `reverse_each` instead of `reverse.each`.'
1162
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
1163
+ Enabled: true
1164
+
1165
+ Performance/Sample:
1166
+ Description: >-
1167
+ Use `sample` instead of `shuffle.first`,
1168
+ `shuffle.last`, and `shuffle[Fixnum]`.
1169
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
1170
+ Enabled: true
1171
+
1172
+ Performance/Size:
1173
+ Description: >-
1174
+ Use `size` instead of `count` for counting
1175
+ the number of elements in `Array` and `Hash`.
1176
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
1177
+ Enabled: true
1178
+
1179
+ Performance/StartWith:
1180
+ Description: 'Use `start_with?` instead of a regex match anchored to the beginning of a string.'
1181
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringmatch-vs-stringstart_withstringend_with-code-start-code-end'
1182
+ Enabled: true
1183
+
1184
+ Performance/StringReplacement:
1185
+ Description: >-
1186
+ Use `tr` instead of `gsub` when you are replacing the same
1187
+ number of characters. Use `delete` instead of `gsub` when
1188
+ you are deleting characters.
1189
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
1190
+ Enabled: true
1191
+
1192
+ Performance/TimesMap:
1193
+ Description: 'Checks for .times.map calls.'
1194
+ Enabled: true
1195
+
1196
+ Rails/ActionFilter:
1197
+ Description: 'Enforces consistent use of action filter methods.'
1198
+ Enabled: true
1199
+
1200
+ Rails/Date:
1201
+ Description: >-
1202
+ Checks the correct usage of date aware methods,
1203
+ such as Date.today, Date.current etc.
1204
+ Enabled: true
1205
+
1206
+ Rails/Delegate:
1207
+ Description: 'Prefer delegate method for delegations.'
1208
+ Enabled: true
1209
+
1210
+ Rails/FindBy:
1211
+ Description: 'Prefer find_by over where.first.'
1212
+ Enabled: true
1213
+
1214
+ Rails/FindEach:
1215
+ Description: 'Prefer all.find_each over all.find.'
1216
+ Enabled: true
1217
+
1218
+ Rails/HasAndBelongsToMany:
1219
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
1220
+ Enabled: false
1221
+
1222
+ Rails/Output:
1223
+ Description: 'Checks for calls to puts, print, etc.'
1224
+ Enabled: true
1225
+
1226
+ Rails/PluralizationGrammar:
1227
+ Description: 'Checks for incorrect grammar when using methods like `3.day.ago`.'
1228
+ Enabled: true
1229
+
1230
+ Rails/ReadWriteAttribute:
1231
+ Description: >-
1232
+ Checks for read_attribute(:attr) and
1233
+ write_attribute(:attr, val).
1234
+ Enabled: true
1235
+
1236
+ Rails/ScopeArgs:
1237
+ Description: 'Checks the arguments of ActiveRecord scopes.'
1238
+ Enabled: false
1239
+
1240
+ Rails/TimeZone:
1241
+ Description: 'Checks the correct usage of time zone aware methods.'
1242
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
1243
+ Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
1244
+ Enabled: true
1245
+
1246
+ Rails/Validation:
1247
+ Description: 'Use validates :attribute, hash of validations.'
1248
+ Enabled: false