drape 1.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. checksums.yaml +7 -0
  2. data/.codeclimate.yml +27 -0
  3. data/.gitignore +18 -0
  4. data/.rspec +2 -0
  5. data/.rubocop.yml +1159 -0
  6. data/.travis.yml +14 -0
  7. data/.yardopts +1 -0
  8. data/CHANGELOG.md +230 -0
  9. data/CONTRIBUTING.md +20 -0
  10. data/Gemfile +16 -0
  11. data/Guardfile +26 -0
  12. data/LICENSE +7 -0
  13. data/README.md +592 -0
  14. data/Rakefile +76 -0
  15. data/drape.gemspec +31 -0
  16. data/gemfiles/5.0.gemfile +8 -0
  17. data/lib/drape.rb +63 -0
  18. data/lib/drape/automatic_delegation.rb +55 -0
  19. data/lib/drape/collection_decorator.rb +102 -0
  20. data/lib/drape/decoratable.rb +93 -0
  21. data/lib/drape/decoratable/equality.rb +26 -0
  22. data/lib/drape/decorated_association.rb +33 -0
  23. data/lib/drape/decorates_assigned.rb +44 -0
  24. data/lib/drape/decorator.rb +282 -0
  25. data/lib/drape/delegation.rb +13 -0
  26. data/lib/drape/factory.rb +91 -0
  27. data/lib/drape/finders.rb +36 -0
  28. data/lib/drape/helper_proxy.rb +43 -0
  29. data/lib/drape/helper_support.rb +5 -0
  30. data/lib/drape/lazy_helpers.rb +13 -0
  31. data/lib/drape/railtie.rb +69 -0
  32. data/lib/drape/tasks/test.rake +9 -0
  33. data/lib/drape/test/devise_helper.rb +30 -0
  34. data/lib/drape/test/minitest_integration.rb +6 -0
  35. data/lib/drape/test/rspec_integration.rb +20 -0
  36. data/lib/drape/test_case.rb +42 -0
  37. data/lib/drape/undecorate.rb +9 -0
  38. data/lib/drape/version.rb +3 -0
  39. data/lib/drape/view_context.rb +104 -0
  40. data/lib/drape/view_context/build_strategy.rb +46 -0
  41. data/lib/drape/view_helpers.rb +34 -0
  42. data/lib/generators/controller_override.rb +17 -0
  43. data/lib/generators/mini_test/decorator_generator.rb +20 -0
  44. data/lib/generators/mini_test/templates/decorator_spec.rb +4 -0
  45. data/lib/generators/mini_test/templates/decorator_test.rb +4 -0
  46. data/lib/generators/rails/decorator_generator.rb +36 -0
  47. data/lib/generators/rails/templates/decorator.rb +19 -0
  48. data/lib/generators/rspec/decorator_generator.rb +9 -0
  49. data/lib/generators/rspec/templates/decorator_spec.rb +4 -0
  50. data/lib/generators/test_unit/decorator_generator.rb +9 -0
  51. data/lib/generators/test_unit/templates/decorator_test.rb +4 -0
  52. data/spec/draper/collection_decorator_spec.rb +305 -0
  53. data/spec/draper/decoratable/equality_spec.rb +10 -0
  54. data/spec/draper/decoratable_spec.rb +203 -0
  55. data/spec/draper/decorated_association_spec.rb +85 -0
  56. data/spec/draper/decorates_assigned_spec.rb +70 -0
  57. data/spec/draper/decorator_spec.rb +828 -0
  58. data/spec/draper/factory_spec.rb +250 -0
  59. data/spec/draper/finders_spec.rb +165 -0
  60. data/spec/draper/helper_proxy_spec.rb +61 -0
  61. data/spec/draper/lazy_helpers_spec.rb +21 -0
  62. data/spec/draper/undecorate_spec.rb +19 -0
  63. data/spec/draper/view_context/build_strategy_spec.rb +116 -0
  64. data/spec/draper/view_context_spec.rb +160 -0
  65. data/spec/draper/view_helpers_spec.rb +8 -0
  66. data/spec/dummy/.gitignore +21 -0
  67. data/spec/dummy/Rakefile +6 -0
  68. data/spec/dummy/app/assets/config/manifest.js +3 -0
  69. data/spec/dummy/app/assets/images/.keep +0 -0
  70. data/spec/dummy/app/assets/javascripts/application.js +16 -0
  71. data/spec/dummy/app/assets/javascripts/cable.js +13 -0
  72. data/spec/dummy/app/assets/javascripts/channels/.keep +0 -0
  73. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  74. data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
  75. data/spec/dummy/app/channels/application_cable/connection.rb +5 -0
  76. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  77. data/spec/dummy/app/controllers/concerns/.keep +0 -0
  78. data/spec/dummy/app/controllers/posts_controller.rb +21 -0
  79. data/spec/dummy/app/decorators/mongoid_post_decorator.rb +4 -0
  80. data/spec/dummy/app/decorators/post_decorator.rb +59 -0
  81. data/spec/dummy/app/helpers/application_helper.rb +5 -0
  82. data/spec/dummy/app/jobs/application_job.rb +2 -0
  83. data/spec/dummy/app/mailers/application_mailer.rb +4 -0
  84. data/spec/dummy/app/mailers/post_mailer.rb +18 -0
  85. data/spec/dummy/app/models/admin.rb +5 -0
  86. data/spec/dummy/app/models/application_record.rb +3 -0
  87. data/spec/dummy/app/models/concerns/.keep +0 -0
  88. data/spec/dummy/app/models/mongoid_post.rb +5 -0
  89. data/spec/dummy/app/models/post.rb +3 -0
  90. data/spec/dummy/app/models/user.rb +5 -0
  91. data/spec/dummy/app/views/layouts/application.html.erb +9 -0
  92. data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
  93. data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
  94. data/spec/dummy/app/views/post_mailer/decorated_email.html.erb +31 -0
  95. data/spec/dummy/app/views/posts/_post.html.erb +40 -0
  96. data/spec/dummy/app/views/posts/show.html.erb +1 -0
  97. data/spec/dummy/bin/bundle +3 -0
  98. data/spec/dummy/bin/rails +9 -0
  99. data/spec/dummy/bin/rake +9 -0
  100. data/spec/dummy/bin/setup +34 -0
  101. data/spec/dummy/bin/spring +15 -0
  102. data/spec/dummy/bin/update +29 -0
  103. data/spec/dummy/config.ru +5 -0
  104. data/spec/dummy/config/application.rb +21 -0
  105. data/spec/dummy/config/boot.rb +2 -0
  106. data/spec/dummy/config/cable.yml +10 -0
  107. data/spec/dummy/config/database.yml +25 -0
  108. data/spec/dummy/config/environment.rb +5 -0
  109. data/spec/dummy/config/environments/development.rb +51 -0
  110. data/spec/dummy/config/environments/production.rb +91 -0
  111. data/spec/dummy/config/environments/test.rb +42 -0
  112. data/spec/dummy/config/initializers/active_record_belongs_to_required_by_default.rb +6 -0
  113. data/spec/dummy/config/initializers/application_controller_renderer.rb +6 -0
  114. data/spec/dummy/config/initializers/assets.rb +11 -0
  115. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  116. data/spec/dummy/config/initializers/callback_terminator.rb +6 -0
  117. data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
  118. data/spec/dummy/config/initializers/devise.rb +3 -0
  119. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  120. data/spec/dummy/config/initializers/inflections.rb +16 -0
  121. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  122. data/spec/dummy/config/initializers/per_form_csrf_tokens.rb +4 -0
  123. data/spec/dummy/config/initializers/request_forgery_protection.rb +4 -0
  124. data/spec/dummy/config/initializers/session_store.rb +3 -0
  125. data/spec/dummy/config/initializers/ssl_options.rb +4 -0
  126. data/spec/dummy/config/initializers/to_time_preserves_timezone.rb +10 -0
  127. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  128. data/spec/dummy/config/locales/en.yml +23 -0
  129. data/spec/dummy/config/mongoid.yml +16 -0
  130. data/spec/dummy/config/puma.rb +47 -0
  131. data/spec/dummy/config/routes.rb +8 -0
  132. data/spec/dummy/config/secrets.yml +22 -0
  133. data/spec/dummy/config/spring.rb +6 -0
  134. data/spec/dummy/db/migrate/20121019115657_create_posts.rb +7 -0
  135. data/spec/dummy/db/schema.rb +19 -0
  136. data/spec/dummy/db/seeds.rb +2 -0
  137. data/spec/dummy/lib/assets/.keep +0 -0
  138. data/spec/dummy/lib/tasks/.keep +0 -0
  139. data/spec/dummy/lib/tasks/test.rake +16 -0
  140. data/spec/dummy/log/.keep +0 -0
  141. data/spec/dummy/public/404.html +67 -0
  142. data/spec/dummy/public/422.html +67 -0
  143. data/spec/dummy/public/500.html +66 -0
  144. data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
  145. data/spec/dummy/public/apple-touch-icon.png +0 -0
  146. data/spec/dummy/public/favicon.ico +0 -0
  147. data/spec/dummy/public/robots.txt +5 -0
  148. data/spec/dummy/spec/decorators/active_model_serializers_spec.rb +12 -0
  149. data/spec/dummy/spec/decorators/devise_spec.rb +64 -0
  150. data/spec/dummy/spec/decorators/helpers_spec.rb +21 -0
  151. data/spec/dummy/spec/decorators/post_decorator_spec.rb +66 -0
  152. data/spec/dummy/spec/decorators/spec_type_spec.rb +7 -0
  153. data/spec/dummy/spec/decorators/view_context_spec.rb +22 -0
  154. data/spec/dummy/spec/mailers/post_mailer_spec.rb +33 -0
  155. data/spec/dummy/spec/models/mongoid_post_spec.rb +8 -0
  156. data/spec/dummy/spec/models/post_spec.rb +6 -0
  157. data/spec/dummy/spec/shared_examples/decoratable.rb +26 -0
  158. data/spec/dummy/spec/spec_helper.rb +8 -0
  159. data/spec/dummy/test/controllers/.keep +0 -0
  160. data/spec/dummy/test/fixtures/.keep +0 -0
  161. data/spec/dummy/test/fixtures/files/.keep +0 -0
  162. data/spec/dummy/test/helpers/.keep +0 -0
  163. data/spec/dummy/test/integration/.keep +0 -0
  164. data/spec/dummy/test/mailers/.keep +0 -0
  165. data/spec/dummy/test/models/.keep +0 -0
  166. data/spec/dummy/test/test_helper.rb +10 -0
  167. data/spec/dummy/vendor/assets/javascripts/.keep +0 -0
  168. data/spec/dummy/vendor/assets/stylesheets/.keep +0 -0
  169. data/spec/generators/controller/controller_generator_spec.rb +24 -0
  170. data/spec/generators/decorator/decorator_generator_spec.rb +94 -0
  171. data/spec/integration/integration_spec.rb +68 -0
  172. data/spec/performance/active_record.rb +4 -0
  173. data/spec/performance/benchmark.rb +57 -0
  174. data/spec/performance/decorators.rb +41 -0
  175. data/spec/performance/models.rb +20 -0
  176. data/spec/spec_helper.rb +41 -0
  177. data/spec/support/dummy_app.rb +88 -0
  178. data/spec/support/matchers/have_text.rb +50 -0
  179. data/spec/support/shared_examples/decoratable_equality.rb +40 -0
  180. data/spec/support/shared_examples/view_helpers.rb +39 -0
  181. metadata +497 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: e6fdaaeef228e75e137588eb1cd39acb231d2b11
4
+ data.tar.gz: 6c4cf624ef619ceca9c44a68473a884fe9edd433
5
+ SHA512:
6
+ metadata.gz: 55565af9829a547366cbdf7d15ba24f3793cf3b4cbaf293f0c1b8c7e5b16038ccc381f35d15bdc14792d3c41412852b196f99489b93d5e2cbf9741f9dd8db64c
7
+ data.tar.gz: 7e59906ee9682ed9cd6e1054c241da73790bda1d87087c537e90f5a30cc569d9fba7a4665c91db2d9182d9ef545362e2e9e1b20a4537ddc3421cc7257af1a68f
@@ -0,0 +1,27 @@
1
+ ---
2
+ engines:
3
+ duplication:
4
+ enabled: true
5
+ config:
6
+ languages:
7
+ - ruby
8
+ - javascript
9
+ - python
10
+ - php
11
+ fixme:
12
+ enabled: true
13
+ rubocop:
14
+ enabled: true
15
+ brakeman:
16
+ enabled: true
17
+ ratings:
18
+ paths:
19
+ - "**.inc"
20
+ - "**.js"
21
+ - "**.jsx"
22
+ - "**.module"
23
+ - "**.php"
24
+ - "**.py"
25
+ - "**.rb"
26
+ exclude_paths:
27
+ - spec/
@@ -0,0 +1,18 @@
1
+ *.gem
2
+ *.rvmrc
3
+ .bundle
4
+ Gemfile.lock
5
+ pkg/*
6
+ coverage.data
7
+ coverage/*
8
+ .yardoc
9
+ doc/*
10
+ tmp
11
+ vendor/bundle
12
+ *.swp
13
+ *.swo
14
+ *.DS_Store
15
+ spec/dummy/log/*
16
+ spec/dummy/db/*.sqlite3
17
+ .idea
18
+ .ruby-version
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --order rand
@@ -0,0 +1,1159 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.3
3
+ DisabledByDefault: true
4
+
5
+ #################### Lint ################################
6
+
7
+ Lint/AmbiguousOperator:
8
+ Description: >-
9
+ Checks for ambiguous operators in the first argument of a
10
+ method invocation without parentheses.
11
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
12
+ Enabled: true
13
+
14
+ Lint/AmbiguousRegexpLiteral:
15
+ Description: >-
16
+ Checks for ambiguous regexp literals in the first argument of
17
+ a method invocation without parenthesis.
18
+ Enabled: true
19
+
20
+ Lint/AssignmentInCondition:
21
+ Description: "Don't use assignment in conditions."
22
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
23
+ Enabled: true
24
+
25
+ Lint/BlockAlignment:
26
+ Description: 'Align block ends correctly.'
27
+ Enabled: true
28
+
29
+ Lint/CircularArgumentReference:
30
+ Description: "Don't refer to the keyword argument in the default value."
31
+ Enabled: true
32
+
33
+ Lint/ConditionPosition:
34
+ Description: >-
35
+ Checks for condition placed in a confusing position relative to
36
+ the keyword.
37
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
38
+ Enabled: true
39
+
40
+ Lint/Debugger:
41
+ Description: 'Check for debugger calls.'
42
+ Enabled: true
43
+
44
+ Lint/DefEndAlignment:
45
+ Description: 'Align ends corresponding to defs correctly.'
46
+ Enabled: true
47
+
48
+ Lint/DeprecatedClassMethods:
49
+ Description: 'Check for deprecated class method calls.'
50
+ Enabled: true
51
+
52
+ Lint/DuplicateMethods:
53
+ Description: 'Check for duplicate methods calls.'
54
+ Enabled: true
55
+
56
+ Lint/EachWithObjectArgument:
57
+ Description: 'Check for immutable argument given to each_with_object.'
58
+ Enabled: true
59
+
60
+ Lint/ElseLayout:
61
+ Description: 'Check for odd code arrangement in an else block.'
62
+ Enabled: true
63
+
64
+ Lint/EmptyEnsure:
65
+ Description: 'Checks for empty ensure block.'
66
+ Enabled: true
67
+
68
+ Lint/EmptyInterpolation:
69
+ Description: 'Checks for empty string interpolation.'
70
+ Enabled: true
71
+
72
+ Lint/EndAlignment:
73
+ Description: 'Align ends correctly.'
74
+ Enabled: true
75
+
76
+ Lint/EndInMethod:
77
+ Description: 'END blocks should not be placed inside method definitions.'
78
+ Enabled: true
79
+
80
+ Lint/EnsureReturn:
81
+ Description: 'Do not use return in an ensure block.'
82
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-return-ensure'
83
+ Enabled: true
84
+
85
+ Lint/Eval:
86
+ Description: 'The use of eval represents a serious security risk.'
87
+ Enabled: true
88
+
89
+ Lint/FormatParameterMismatch:
90
+ Description: 'The number of parameters to format/sprint must match the fields.'
91
+ Enabled: true
92
+
93
+ Lint/HandleExceptions:
94
+ Description: "Don't suppress exception."
95
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
96
+ Enabled: true
97
+
98
+ Lint/InvalidCharacterLiteral:
99
+ Description: >-
100
+ Checks for invalid character literals with a non-escaped
101
+ whitespace character.
102
+ Enabled: true
103
+
104
+ Lint/LiteralInCondition:
105
+ Description: 'Checks of literals used in conditions.'
106
+ Enabled: true
107
+
108
+ Lint/LiteralInInterpolation:
109
+ Description: 'Checks for literals used in interpolation.'
110
+ Enabled: true
111
+
112
+ Lint/Loop:
113
+ Description: >-
114
+ Use Kernel#loop with break rather than begin/end/until or
115
+ begin/end/while for post-loop tests.
116
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
117
+ Enabled: true
118
+
119
+ Lint/NestedMethodDefinition:
120
+ Description: 'Do not use nested method definitions.'
121
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-methods'
122
+ Enabled: true
123
+
124
+ Lint/NonLocalExitFromIterator:
125
+ Description: 'Do not use return in iterator to cause non-local exit.'
126
+ Enabled: true
127
+
128
+ Lint/ParenthesesAsGroupedExpression:
129
+ Description: >-
130
+ Checks for method calls with a space before the opening
131
+ parenthesis.
132
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
133
+ Enabled: true
134
+
135
+ Lint/RequireParentheses:
136
+ Description: >-
137
+ Use parentheses in the method call to avoid confusion
138
+ about precedence.
139
+ Enabled: true
140
+
141
+ Lint/RescueException:
142
+ Description: 'Avoid rescuing the Exception class.'
143
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-blind-rescues'
144
+ Enabled: true
145
+
146
+ Lint/ShadowingOuterLocalVariable:
147
+ Description: >-
148
+ Do not use the same name as outer local variable
149
+ for block arguments or block local variables.
150
+ Enabled: true
151
+
152
+ Lint/StringConversionInInterpolation:
153
+ Description: 'Checks for Object#to_s usage in string interpolation.'
154
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-to-s'
155
+ Enabled: true
156
+
157
+ Lint/UnderscorePrefixedVariableName:
158
+ Description: 'Do not use prefix `_` for a variable that is used.'
159
+ Enabled: true
160
+
161
+ Lint/UnneededDisable:
162
+ Description: >-
163
+ Checks for rubocop:disable comments that can be removed.
164
+ Note: this cop is not disabled when disabling all cops.
165
+ It must be explicitly disabled.
166
+ Enabled: true
167
+
168
+ Lint/UnusedBlockArgument:
169
+ Description: 'Checks for unused block arguments.'
170
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
171
+ Enabled: true
172
+
173
+ Lint/UnusedMethodArgument:
174
+ Description: 'Checks for unused method arguments.'
175
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
176
+ Enabled: true
177
+
178
+ Lint/UnreachableCode:
179
+ Description: 'Unreachable code.'
180
+ Enabled: true
181
+
182
+ Lint/UselessAccessModifier:
183
+ Description: 'Checks for useless access modifiers.'
184
+ Enabled: true
185
+
186
+ Lint/UselessAssignment:
187
+ Description: 'Checks for useless assignment to a local variable.'
188
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscore-unused-vars'
189
+ Enabled: true
190
+
191
+ Lint/UselessComparison:
192
+ Description: 'Checks for comparison of something with itself.'
193
+ Enabled: true
194
+
195
+ Lint/UselessElseWithoutRescue:
196
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
197
+ Enabled: true
198
+
199
+ Lint/UselessSetterCall:
200
+ Description: 'Checks for useless setter call to a local variable.'
201
+ Enabled: true
202
+
203
+ Lint/Void:
204
+ Description: 'Possible use of operator/literal/variable in void context.'
205
+ Enabled: true
206
+
207
+ ###################### Metrics ####################################
208
+
209
+ Metrics/AbcSize:
210
+ Description: >-
211
+ A calculated magnitude based on number of assignments,
212
+ branches, and conditions.
213
+ Reference: 'http://c2.com/cgi/wiki?AbcMetric'
214
+ Enabled: false
215
+ Max: 20
216
+
217
+ Metrics/BlockNesting:
218
+ Description: 'Avoid excessive block nesting'
219
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
220
+ Enabled: true
221
+ Max: 4
222
+
223
+ Metrics/ClassLength:
224
+ Description: 'Avoid classes longer than 250 lines of code.'
225
+ Enabled: true
226
+ Max: 250
227
+
228
+ Metrics/CyclomaticComplexity:
229
+ Description: >-
230
+ A complexity metric that is strongly correlated to the number
231
+ of test cases needed to validate a method.
232
+ Enabled: true
233
+
234
+ Metrics/LineLength:
235
+ Description: 'Limit lines to 80 characters.'
236
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
237
+ Enabled: true
238
+ Max: 120
239
+
240
+ Metrics/MethodLength:
241
+ Description: 'Avoid methods longer than 30 lines of code.'
242
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
243
+ Enabled: true
244
+ Max: 30
245
+
246
+ Metrics/ModuleLength:
247
+ Description: 'Avoid modules longer than 250 lines of code.'
248
+ Enabled: true
249
+ Max: 250
250
+
251
+ Metrics/ParameterLists:
252
+ Description: 'Avoid parameter lists longer than three or four parameters.'
253
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
254
+ Enabled: true
255
+
256
+ Metrics/PerceivedComplexity:
257
+ Description: >-
258
+ A complexity metric geared towards measuring complexity for a
259
+ human reader.
260
+ Enabled: false
261
+
262
+ ##################### Performance #############################
263
+
264
+ Performance/Count:
265
+ Description: >-
266
+ Use `count` instead of `select...size`, `reject...size`,
267
+ `select...count`, `reject...count`, `select...length`,
268
+ and `reject...length`.
269
+ Enabled: true
270
+
271
+ Performance/Detect:
272
+ Description: >-
273
+ Use `detect` instead of `select.first`, `find_all.first`,
274
+ `select.last`, and `find_all.last`.
275
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
276
+ Enabled: true
277
+
278
+ Performance/FlatMap:
279
+ Description: >-
280
+ Use `Enumerable#flat_map`
281
+ instead of `Enumerable#map...Array#flatten(1)`
282
+ or `Enumberable#collect..Array#flatten(1)`
283
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
284
+ Enabled: true
285
+ EnabledForFlattenWithoutParams: false
286
+ # If enabled, this cop will warn about usages of
287
+ # `flatten` being called without any parameters.
288
+ # This can be dangerous since `flat_map` will only flatten 1 level, and
289
+ # `flatten` without any parameters can flatten multiple levels.
290
+
291
+ Performance/ReverseEach:
292
+ Description: 'Use `reverse_each` instead of `reverse.each`.'
293
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
294
+ Enabled: true
295
+
296
+ Performance/Sample:
297
+ Description: >-
298
+ Use `sample` instead of `shuffle.first`,
299
+ `shuffle.last`, and `shuffle[Fixnum]`.
300
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
301
+ Enabled: true
302
+
303
+ Performance/Size:
304
+ Description: >-
305
+ Use `size` instead of `count` for counting
306
+ the number of elements in `Array` and `Hash`.
307
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
308
+ Enabled: true
309
+
310
+ Performance/StringReplacement:
311
+ Description: >-
312
+ Use `tr` instead of `gsub` when you are replacing the same
313
+ number of characters. Use `delete` instead of `gsub` when
314
+ you are deleting characters.
315
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
316
+ Enabled: true
317
+
318
+ ##################### Rails ##################################
319
+
320
+ Rails/ActionFilter:
321
+ Description: 'Enforces consistent use of action filter methods.'
322
+ Enabled: true
323
+
324
+ Rails/Date:
325
+ Description: >-
326
+ Checks the correct usage of date aware methods,
327
+ such as Date.today, Date.current etc.
328
+ Enabled: true
329
+
330
+ Rails/Delegate:
331
+ Description: 'Prefer delegate method for delegations.'
332
+ Enabled: true
333
+
334
+ Rails/FindBy:
335
+ Description: 'Prefer find_by over where.first.'
336
+ Enabled: true
337
+
338
+ Rails/FindEach:
339
+ Description: 'Prefer all.find_each over all.find.'
340
+ Enabled: true
341
+
342
+ Rails/HasAndBelongsToMany:
343
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
344
+ Enabled: false
345
+
346
+ Rails/Output:
347
+ Description: 'Checks for calls to puts, print, etc.'
348
+ Enabled: true
349
+
350
+ Rails/ReadWriteAttribute:
351
+ Description: >-
352
+ Checks for read_attribute(:attr) and
353
+ write_attribute(:attr, val).
354
+ Enabled: true
355
+
356
+ Rails/ScopeArgs:
357
+ Description: 'Checks the arguments of ActiveRecord scopes.'
358
+ Enabled: true
359
+
360
+ Rails/TimeZone:
361
+ Description: 'Checks the correct usage of time zone aware methods.'
362
+ StyleGuide: 'https://github.com/bbatsov/rails-style-guide#time'
363
+ Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
364
+ Enabled: true
365
+
366
+ Rails/Validation:
367
+ Description: 'Use validates :attribute, hash of validations.'
368
+ Enabled: true
369
+
370
+ ################## Style #################################
371
+
372
+ Style/AccessModifierIndentation:
373
+ Description: Check indentation of private/protected visibility modifiers.
374
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected'
375
+ Enabled: true
376
+
377
+ Style/AccessorMethodName:
378
+ Description: Check the naming of accessor methods for get_/set_.
379
+ Enabled: true
380
+
381
+ Style/Alias:
382
+ Description: 'Use alias_method instead of alias.'
383
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
384
+ Enabled: true
385
+
386
+ Style/AlignArray:
387
+ Description: >-
388
+ Align the elements of an array literal if they span more than
389
+ one line.
390
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays'
391
+ Enabled: true
392
+
393
+ Style/AlignHash:
394
+ Description: >-
395
+ Align the elements of a hash literal if they span more than
396
+ one line.
397
+ Enabled: true
398
+
399
+ Style/AlignParameters:
400
+ Description: >-
401
+ Align the parameters of a method call if they span more
402
+ than one line.
403
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
404
+ Enabled: true
405
+
406
+ Style/AndOr:
407
+ Description: 'Use &&/|| instead of and/or.'
408
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-and-or-or'
409
+ Enabled: true
410
+ EnforcedStyle: conditionals
411
+
412
+ Style/ArrayJoin:
413
+ Description: 'Use Array#join instead of Array#*.'
414
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#array-join'
415
+ Enabled: true
416
+
417
+ Style/AsciiComments:
418
+ Description: 'Use only ascii symbols in comments.'
419
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
420
+ Enabled: true
421
+
422
+ Style/AsciiIdentifiers:
423
+ Description: 'Use only ascii symbols in identifiers.'
424
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
425
+ Enabled: true
426
+
427
+ Style/Attr:
428
+ Description: 'Checks for uses of Module#attr.'
429
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
430
+ Enabled: true
431
+
432
+ Style/BeginBlock:
433
+ Description: 'Avoid the use of BEGIN blocks.'
434
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-BEGIN-blocks'
435
+ Enabled: true
436
+
437
+ Style/BarePercentLiterals:
438
+ Description: 'Checks if usage of %() or %Q() matches configuration.'
439
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q-shorthand'
440
+ Enabled: true
441
+
442
+ Style/BlockComments:
443
+ Description: 'Do not use block comments.'
444
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
445
+ Enabled: true
446
+
447
+ Style/BlockEndNewline:
448
+ Description: 'Put end statement of multiline block on its own line.'
449
+ Enabled: true
450
+
451
+ Style/BlockDelimiters:
452
+ Description: >-
453
+ Avoid using {...} for multi-line blocks (multiline chaining is
454
+ always ugly).
455
+ Prefer {...} over do...end for single-line blocks.
456
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
457
+ Enabled: true
458
+
459
+ Style/BracesAroundHashParameters:
460
+ Description: 'Enforce braces style around hash parameters.'
461
+ Enabled: false
462
+
463
+ Style/CaseEquality:
464
+ Description: 'Avoid explicit use of the case equality operator(===).'
465
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
466
+ Enabled: true
467
+
468
+ Style/CaseIndentation:
469
+ Description: 'Indentation of when in a case/when/[else/]end.'
470
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-when-to-case'
471
+ Enabled: true
472
+
473
+ Style/CharacterLiteral:
474
+ Description: 'Checks for uses of character literals.'
475
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
476
+ Enabled: true
477
+
478
+ Style/ClassAndModuleCamelCase:
479
+ Description: 'Use CamelCase for classes and modules.'
480
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#camelcase-classes'
481
+ Enabled: true
482
+
483
+ Style/ClassAndModuleChildren:
484
+ Description: 'Checks style of children classes and modules.'
485
+ Enabled: false
486
+
487
+ Style/ClassCheck:
488
+ Description: 'Enforces consistent use of `Object#is_a?` or `Object#kind_of?`.'
489
+ Enabled: true
490
+
491
+ Style/ClassMethods:
492
+ Description: 'Use self when defining module/class methods.'
493
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#def-self-class-methods'
494
+ Enabled: true
495
+
496
+ Style/ClassVars:
497
+ Description: 'Avoid the use of class variables.'
498
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
499
+ Enabled: true
500
+
501
+ Style/ClosingParenthesisIndentation:
502
+ Description: 'Checks the indentation of hanging closing parentheses.'
503
+ Enabled: true
504
+
505
+ Style/ColonMethodCall:
506
+ Description: 'Do not use :: for method call.'
507
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
508
+ Enabled: true
509
+
510
+ Style/CommandLiteral:
511
+ Description: 'Use `` or %x around command literals.'
512
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-x'
513
+ Enabled: true
514
+
515
+ Style/CommentAnnotation:
516
+ Description: 'Checks formatting of annotation comments.'
517
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
518
+ Enabled: false
519
+
520
+ Style/CommentIndentation:
521
+ Description: 'Indentation of comments.'
522
+ Enabled: true
523
+
524
+ Style/ConstantName:
525
+ Description: 'Constants should use SCREAMING_SNAKE_CASE.'
526
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#screaming-snake-case'
527
+ Enabled: true
528
+
529
+ Style/DefWithParentheses:
530
+ Description: 'Use def with parentheses when there are arguments.'
531
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
532
+ Enabled: true
533
+
534
+ Style/DeprecatedHashMethods:
535
+ Description: 'Checks for use of deprecated Hash methods.'
536
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key'
537
+ Enabled: true
538
+
539
+ Style/Documentation:
540
+ Description: 'Document classes and non-namespace modules.'
541
+ Enabled: false
542
+
543
+ Style/DotPosition:
544
+ Description: 'Checks the position of the dot in multi-line method calls.'
545
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
546
+ Enabled: true
547
+
548
+ Style/DoubleNegation:
549
+ Description: 'Checks for uses of double negation (!!).'
550
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
551
+ Enabled: true
552
+
553
+ Style/EachWithObject:
554
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
555
+ Enabled: true
556
+
557
+ Style/ElseAlignment:
558
+ Description: 'Align elses and elsifs correctly.'
559
+ Enabled: true
560
+
561
+ Style/EmptyElse:
562
+ Description: 'Avoid empty else-clauses.'
563
+ Enabled: true
564
+
565
+ Style/EmptyLineBetweenDefs:
566
+ Description: 'Use empty lines between defs.'
567
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods'
568
+ Enabled: true
569
+
570
+ Style/EmptyLines:
571
+ Description: "Don't use several empty lines in a row."
572
+ Enabled: true
573
+
574
+ Style/EmptyLinesAroundAccessModifier:
575
+ Description: "Keep blank lines around access modifiers."
576
+ Enabled: true
577
+
578
+ Style/EmptyLinesAroundBlockBody:
579
+ Description: "Keeps track of empty lines around block bodies."
580
+ Enabled: true
581
+
582
+ Style/EmptyLinesAroundClassBody:
583
+ Description: "Keeps track of empty lines around class bodies."
584
+ Enabled: true
585
+
586
+ Style/EmptyLinesAroundModuleBody:
587
+ Description: "Keeps track of empty lines around module bodies."
588
+ Enabled: true
589
+
590
+ Style/EmptyLinesAroundMethodBody:
591
+ Description: "Keeps track of empty lines around method bodies."
592
+ Enabled: true
593
+
594
+ Style/EmptyLiteral:
595
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
596
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash'
597
+ Enabled: true
598
+
599
+ Style/EndBlock:
600
+ Description: 'Avoid the use of END blocks.'
601
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-END-blocks'
602
+ Enabled: true
603
+
604
+ Style/EndOfLine:
605
+ Description: 'Use Unix-style line endings.'
606
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#crlf'
607
+ Enabled: true
608
+
609
+ Style/EvenOdd:
610
+ Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
611
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
612
+ Enabled: true
613
+
614
+ Style/ExtraSpacing:
615
+ Description: 'Do not use unnecessary spacing.'
616
+ Enabled: false
617
+
618
+ Style/FileName:
619
+ Description: 'Use snake_case for source file names.'
620
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
621
+ Enabled: true
622
+
623
+ Style/InitialIndentation:
624
+ Description: >-
625
+ Checks the indentation of the first non-blank non-comment line in a file.
626
+ Enabled: true
627
+
628
+ Style/FirstParameterIndentation:
629
+ Description: 'Checks the indentation of the first parameter in a method call.'
630
+ Enabled: true
631
+
632
+ Style/FlipFlop:
633
+ Description: 'Checks for flip flops'
634
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
635
+ Enabled: true
636
+
637
+ Style/For:
638
+ Description: 'Checks use of for or each in multiline loops.'
639
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-for-loops'
640
+ Enabled: true
641
+
642
+ Style/FormatString:
643
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
644
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
645
+ Enabled: true
646
+
647
+ Style/GlobalVars:
648
+ Description: 'Do not introduce global variables.'
649
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#instance-vars'
650
+ Reference: 'http://www.zenspider.com/Languages/Ruby/QuickRef.html'
651
+ Enabled: true
652
+
653
+ Style/GuardClause:
654
+ Description: 'Check for conditionals that can be replaced with guard clauses'
655
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
656
+ Enabled: true
657
+
658
+ Style/HashSyntax:
659
+ Description: >-
660
+ Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
661
+ { :a => 1, :b => 2 }.
662
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-literals'
663
+ Enabled: true
664
+
665
+ Style/IfUnlessModifier:
666
+ Description: >-
667
+ Favor modifier if/unless usage when you have a
668
+ single-line body.
669
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
670
+ Enabled: true
671
+
672
+ Style/IfWithSemicolon:
673
+ Description: 'Do not use if x; .... Use the ternary operator instead.'
674
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
675
+ Enabled: true
676
+
677
+ Style/IndentationConsistency:
678
+ Description: 'Keep indentation straight.'
679
+ Enabled: true
680
+
681
+ Style/IndentationWidth:
682
+ Description: 'Use 2 spaces for indentation.'
683
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
684
+ Enabled: true
685
+
686
+ Style/IndentArray:
687
+ Description: >-
688
+ Checks the indentation of the first element in an array
689
+ literal.
690
+ Enabled: true
691
+
692
+ Style/IndentHash:
693
+ Description: 'Checks the indentation of the first key in a hash literal.'
694
+ Enabled: true
695
+
696
+ Style/InfiniteLoop:
697
+ Description: 'Use Kernel#loop for infinite loops.'
698
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#infinite-loop'
699
+ Enabled: true
700
+
701
+ Style/Lambda:
702
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
703
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#lambda-multi-line'
704
+ Enabled: true
705
+
706
+ Style/LambdaCall:
707
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
708
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call'
709
+ Enabled: true
710
+
711
+ Style/LeadingCommentSpace:
712
+ Description: 'Comments should start with a space.'
713
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space'
714
+ Enabled: true
715
+
716
+ Style/LineEndConcatenation:
717
+ Description: >-
718
+ Use \ instead of + or << to concatenate two string literals at
719
+ line end.
720
+ Enabled: true
721
+
722
+ Style/MethodCallParentheses:
723
+ Description: 'Do not use parentheses for method calls with no arguments.'
724
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens'
725
+ Enabled: true
726
+
727
+ Style/MethodDefParentheses:
728
+ Description: >-
729
+ Checks if the method definitions have or don't have
730
+ parentheses.
731
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
732
+ Enabled: true
733
+
734
+ Style/MethodName:
735
+ Description: 'Use the configured style when naming methods.'
736
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
737
+ Enabled: true
738
+
739
+ Style/ModuleFunction:
740
+ Description: 'Checks for usage of `extend self` in modules.'
741
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
742
+ Enabled: true
743
+
744
+ Style/MultilineBlockChain:
745
+ Description: 'Avoid multi-line chains of blocks.'
746
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
747
+ Enabled: true
748
+
749
+ Style/MultilineBlockLayout:
750
+ Description: 'Ensures newlines after multiline block do statements.'
751
+ Enabled: true
752
+
753
+ Style/MultilineIfThen:
754
+ Description: 'Do not use then for multi-line if/unless.'
755
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-then'
756
+ Enabled: true
757
+
758
+ Style/MultilineOperationIndentation:
759
+ Description: >-
760
+ Checks indentation of binary operations that span more than
761
+ one line.
762
+ Enabled: true
763
+
764
+ Style/MultilineTernaryOperator:
765
+ Description: >-
766
+ Avoid multi-line ?: (the ternary operator);
767
+ use if/unless instead.
768
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-ternary'
769
+ Enabled: true
770
+
771
+ Style/NegatedIf:
772
+ Description: >-
773
+ Favor unless over if for negative conditions
774
+ (or control flow or).
775
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
776
+ Enabled: true
777
+
778
+ Style/NegatedWhile:
779
+ Description: 'Favor until over while for negative conditions.'
780
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#until-for-negatives'
781
+ Enabled: true
782
+
783
+ Style/NestedTernaryOperator:
784
+ Description: 'Use one expression per branch in a ternary operator.'
785
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-ternary'
786
+ Enabled: true
787
+
788
+ Style/Next:
789
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
790
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-nested-conditionals'
791
+ Enabled: true
792
+
793
+ Style/NilComparison:
794
+ Description: 'Prefer x.nil? to x == nil.'
795
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
796
+ Enabled: true
797
+
798
+ Style/NonNilCheck:
799
+ Description: 'Checks for redundant nil checks.'
800
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-non-nil-checks'
801
+ Enabled: true
802
+
803
+ Style/Not:
804
+ Description: 'Use ! instead of not.'
805
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bang-not-not'
806
+ Enabled: true
807
+
808
+ Style/NumericLiterals:
809
+ Description: >-
810
+ Add underscores to large numeric literals to improve their
811
+ readability.
812
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
813
+ Enabled: true
814
+
815
+ Style/OneLineConditional:
816
+ Description: >-
817
+ Favor the ternary operator(?:) over
818
+ if/then/else/end constructs.
819
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
820
+ Enabled: true
821
+
822
+ Style/OpMethod:
823
+ Description: 'When defining binary operators, name the argument other.'
824
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
825
+ Enabled: true
826
+
827
+ Style/OptionalArguments:
828
+ Description: >-
829
+ Checks for optional arguments that do not appear at the end
830
+ of the argument list
831
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#optional-arguments'
832
+ Enabled: true
833
+
834
+ Style/ParallelAssignment:
835
+ Description: >-
836
+ Check for simple usages of parallel assignment.
837
+ It will only warn when the number of variables
838
+ matches on both sides of the assignment.
839
+ This also provides performance benefits
840
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parallel-assignment'
841
+ Enabled: true
842
+
843
+ Style/ParenthesesAroundCondition:
844
+ Description: >-
845
+ Don't use parentheses around the condition of an
846
+ if/unless/while.
847
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-parens-if'
848
+ Enabled: true
849
+
850
+ Style/PercentLiteralDelimiters:
851
+ Description: 'Use `%`-literal delimiters consistently'
852
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
853
+ Enabled: true
854
+
855
+ Style/PercentQLiterals:
856
+ Description: 'Checks if uses of %Q/%q match the configured preference.'
857
+ Enabled: true
858
+
859
+ Style/PerlBackrefs:
860
+ Description: 'Avoid Perl-style regex back references.'
861
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
862
+ Enabled: true
863
+
864
+ Style/PredicateName:
865
+ Description: 'Check the names of predicate methods.'
866
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
867
+ Enabled: true
868
+
869
+ Style/Proc:
870
+ Description: 'Use proc instead of Proc.new.'
871
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc'
872
+ Enabled: true
873
+
874
+ Style/RaiseArgs:
875
+ Description: 'Checks the arguments passed to raise/fail.'
876
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#exception-class-messages'
877
+ Enabled: true
878
+
879
+ Style/RedundantBegin:
880
+ Description: "Don't use begin blocks when they are not needed."
881
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#begin-implicit'
882
+ Enabled: true
883
+
884
+ Style/RedundantException:
885
+ Description: "Checks for an obsolete RuntimeException argument in raise/fail."
886
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-runtimeerror'
887
+ Enabled: true
888
+
889
+ Style/RedundantReturn:
890
+ Description: "Don't use return where it's not required."
891
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-explicit-return'
892
+ Enabled: true
893
+
894
+ Style/RedundantSelf:
895
+ Description: "Don't use self where it's not needed."
896
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-self-unless-required'
897
+ Enabled: true
898
+
899
+ Style/RegexpLiteral:
900
+ Description: 'Use / or %r around regular expressions.'
901
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
902
+ Enabled: true
903
+
904
+ Style/RescueEnsureAlignment:
905
+ Description: 'Align rescues and ensures correctly.'
906
+ Enabled: true
907
+
908
+ Style/RescueModifier:
909
+ Description: 'Avoid using rescue in its modifier form.'
910
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-rescue-modifiers'
911
+ Enabled: true
912
+
913
+ Style/SelfAssignment:
914
+ Description: >-
915
+ Checks for places where self-assignment shorthand should have
916
+ been used.
917
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
918
+ Enabled: true
919
+
920
+ Style/Semicolon:
921
+ Description: "Don't use semicolons to terminate expressions."
922
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon'
923
+ Enabled: true
924
+
925
+ Style/SignalException:
926
+ Description: 'Checks for proper usage of fail and raise.'
927
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#fail-method'
928
+ Enabled: false
929
+
930
+ Style/SingleLineBlockParams:
931
+ Description: 'Enforces the names of some block params.'
932
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#reduce-blocks'
933
+ Enabled: true
934
+
935
+ Style/SingleLineMethods:
936
+ Description: 'Avoid single-line methods.'
937
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
938
+ Enabled: true
939
+
940
+ Style/SpaceBeforeFirstArg:
941
+ Description: >-
942
+ Checks that exactly one space is used between a method name
943
+ and the first argument for method calls without parentheses.
944
+ Enabled: true
945
+
946
+ Style/SpaceAfterColon:
947
+ Description: 'Use spaces after colons.'
948
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
949
+ Enabled: true
950
+
951
+ Style/SpaceAfterComma:
952
+ Description: 'Use spaces after commas.'
953
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
954
+ Enabled: true
955
+
956
+ Style/SpaceAroundKeyword:
957
+ Description: 'Use spaces around keywords.'
958
+ Enabled: true
959
+
960
+ Style/SpaceAfterMethodName:
961
+ Description: >-
962
+ Do not put a space between a method name and the opening
963
+ parenthesis in a method definition.
964
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
965
+ Enabled: true
966
+
967
+ Style/SpaceAfterNot:
968
+ Description: Tracks redundant space after the ! operator.
969
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-bang'
970
+ Enabled: true
971
+
972
+ Style/SpaceAfterSemicolon:
973
+ Description: 'Use spaces after semicolons.'
974
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
975
+ Enabled: true
976
+
977
+ Style/SpaceBeforeBlockBraces:
978
+ Description: >-
979
+ Checks that the left block brace has or doesn't have space
980
+ before it.
981
+ Enabled: true
982
+
983
+ Style/SpaceBeforeComma:
984
+ Description: 'No spaces before commas.'
985
+ Enabled: true
986
+
987
+ Style/SpaceBeforeComment:
988
+ Description: >-
989
+ Checks for missing space between code and a comment on the
990
+ same line.
991
+ Enabled: true
992
+
993
+ Style/SpaceBeforeSemicolon:
994
+ Description: 'No spaces before semicolons.'
995
+ Enabled: true
996
+
997
+ Style/SpaceInsideBlockBraces:
998
+ Description: >-
999
+ Checks that block braces have or don't have surrounding space.
1000
+ For blocks taking parameters, checks that the left brace has
1001
+ or doesn't have trailing space.
1002
+ Enabled: true
1003
+
1004
+ Style/SpaceAroundBlockParameters:
1005
+ Description: 'Checks the spacing inside and after block parameters pipes.'
1006
+ Enabled: true
1007
+
1008
+ Style/SpaceAroundEqualsInParameterDefault:
1009
+ Description: >-
1010
+ Checks that the equals signs in parameter default assignments
1011
+ have or don't have surrounding space depending on
1012
+ configuration.
1013
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-around-equals'
1014
+ Enabled: true
1015
+
1016
+ Style/SpaceAroundOperators:
1017
+ Description: 'Use a single space around operators.'
1018
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
1019
+ Enabled: true
1020
+
1021
+ Style/SpaceInsideBrackets:
1022
+ Description: 'No spaces after [ or before ].'
1023
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
1024
+ Enabled: true
1025
+
1026
+ Style/SpaceInsideHashLiteralBraces:
1027
+ Description: "Use spaces inside hash literal braces - or don't."
1028
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
1029
+ Enabled: true
1030
+
1031
+ Style/SpaceInsideParens:
1032
+ Description: 'No spaces after ( or before ).'
1033
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
1034
+ Enabled: true
1035
+
1036
+ Style/SpaceInsideRangeLiteral:
1037
+ Description: 'No spaces inside range literals.'
1038
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals'
1039
+ Enabled: true
1040
+
1041
+ Style/SpaceInsideStringInterpolation:
1042
+ Description: 'Checks for padding/surrounding spaces inside string interpolation.'
1043
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#string-interpolation'
1044
+ Enabled: true
1045
+
1046
+ Style/SpecialGlobalVars:
1047
+ Description: 'Avoid Perl-style global variables.'
1048
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-cryptic-perlisms'
1049
+ Enabled: true
1050
+
1051
+ Style/StringLiterals:
1052
+ Description: 'Checks if uses of quotes match the configured preference.'
1053
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-string-literals'
1054
+ Enabled: true
1055
+
1056
+ Style/StringLiteralsInInterpolation:
1057
+ Description: >-
1058
+ Checks if uses of quotes inside expressions in interpolated
1059
+ strings match the configured preference.
1060
+ Enabled: true
1061
+
1062
+ Style/StructInheritance:
1063
+ Description: 'Checks for inheritance from Struct.new.'
1064
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-extend-struct-new'
1065
+ Enabled: true
1066
+
1067
+ Style/SymbolLiteral:
1068
+ Description: 'Use plain symbols instead of string symbols when possible.'
1069
+ Enabled: true
1070
+
1071
+ Style/SymbolProc:
1072
+ Description: 'Use symbols as procs instead of blocks when possible.'
1073
+ Enabled: true
1074
+
1075
+ Style/Tab:
1076
+ Description: 'No hard tabs.'
1077
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
1078
+ Enabled: true
1079
+
1080
+ Style/TrailingBlankLines:
1081
+ Description: 'Checks trailing blank lines and final newline.'
1082
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#newline-eof'
1083
+ Enabled: true
1084
+
1085
+ Style/TrailingCommaInArguments:
1086
+ Description: 'Checks for trailing comma in parameter lists.'
1087
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-params-comma'
1088
+ Enabled: true
1089
+
1090
+ Style/TrailingCommaInLiteral:
1091
+ Description: 'Checks for trailing comma in literals.'
1092
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
1093
+ Enabled: true
1094
+
1095
+ Style/TrailingWhitespace:
1096
+ Description: 'Avoid trailing whitespace.'
1097
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace'
1098
+ Enabled: true
1099
+
1100
+ Style/TrivialAccessors:
1101
+ Description: 'Prefer attr_* methods to trivial readers/writers.'
1102
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family'
1103
+ Enabled: true
1104
+
1105
+ Style/UnlessElse:
1106
+ Description: >-
1107
+ Do not use unless with else. Rewrite these with the positive
1108
+ case first.
1109
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-else-with-unless'
1110
+ Enabled: true
1111
+
1112
+ Style/UnneededCapitalW:
1113
+ Description: 'Checks for %W when interpolation is not needed.'
1114
+ Enabled: true
1115
+
1116
+ Style/UnneededPercentQ:
1117
+ Description: 'Checks for %q/%Q when single quotes or double quotes would do.'
1118
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-q'
1119
+ Enabled: true
1120
+
1121
+ Style/TrailingUnderscoreVariable:
1122
+ Description: >-
1123
+ Checks for the usage of unneeded trailing underscores at the
1124
+ end of parallel variable assignment.
1125
+ Enabled: true
1126
+
1127
+ Style/VariableInterpolation:
1128
+ Description: >-
1129
+ Don't interpolate global, instance and class variables
1130
+ directly in strings.
1131
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
1132
+ Enabled: true
1133
+
1134
+ Style/VariableName:
1135
+ Description: 'Use the configured style when naming variables.'
1136
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
1137
+ Enabled: true
1138
+
1139
+ Style/WhenThen:
1140
+ Description: 'Use when x then ... for one-line cases.'
1141
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#one-line-cases'
1142
+ Enabled: true
1143
+
1144
+ Style/WhileUntilDo:
1145
+ Description: 'Checks for redundant do after while or until.'
1146
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-multiline-while-do'
1147
+ Enabled: true
1148
+
1149
+ Style/WhileUntilModifier:
1150
+ Description: >-
1151
+ Favor modifier while/until usage when you have a
1152
+ single-line body.
1153
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
1154
+ Enabled: true
1155
+
1156
+ Style/WordArray:
1157
+ Description: 'Use %w or %W for arrays of words.'
1158
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
1159
+ Enabled: false