bigcommerce 0.10.0 → 1.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (162) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +17 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +620 -0
  5. data/.travis.yml +15 -0
  6. data/CHANGELOG.md +11 -0
  7. data/CONTRIBUTING.md +119 -0
  8. data/DEPENDENCIES.md +7 -0
  9. data/Gemfile +15 -0
  10. data/Guardfile +22 -0
  11. data/LICENSE +15 -15
  12. data/README.md +61 -70
  13. data/RELEASING.md +64 -0
  14. data/Rakefile +8 -6
  15. data/bigcommerce.gemspec +22 -53
  16. data/examples/README.md +148 -0
  17. data/examples/configuration/legacy_auth.rb +12 -0
  18. data/examples/configuration/oauth.rb +9 -0
  19. data/examples/content/blog_post.rb +39 -0
  20. data/examples/content/blog_tag.rb +10 -0
  21. data/examples/content/redirect.rb +43 -0
  22. data/examples/customers/customer.rb +36 -0
  23. data/examples/customers/customer_address.rb +50 -0
  24. data/examples/customers/customer_group.rb +35 -0
  25. data/examples/exception_handling.rb +50 -0
  26. data/examples/geography/country.rb +16 -0
  27. data/examples/geography/state.rb +19 -0
  28. data/examples/marketing/coupon.rb +44 -0
  29. data/examples/orders/order.rb +53 -0
  30. data/examples/orders/order_coupon.rb +17 -0
  31. data/examples/orders/order_message.rb +17 -0
  32. data/examples/orders/order_product.rb +23 -0
  33. data/examples/orders/order_shipping_address.rb +23 -0
  34. data/examples/orders/order_status.rb +15 -0
  35. data/examples/orders/order_tax.rb +17 -0
  36. data/examples/orders/shipment.rb +57 -0
  37. data/examples/payments/payment_method.rb +10 -0
  38. data/examples/products/brand.rb +36 -0
  39. data/examples/products/bulk_pricing_rule.rb +47 -0
  40. data/examples/products/category.rb +37 -0
  41. data/examples/products/configurable_field.rb +29 -0
  42. data/examples/products/custom_field.rb +44 -0
  43. data/examples/products/google_product_search_mapping.rb +12 -0
  44. data/examples/products/option.rb +37 -0
  45. data/examples/products/option_set.rb +35 -0
  46. data/examples/products/option_set_option.rb +50 -0
  47. data/examples/products/option_value.rb +43 -0
  48. data/examples/products/product.rb +44 -0
  49. data/examples/products/product_image.rb +42 -0
  50. data/examples/products/product_option.rb +17 -0
  51. data/examples/products/product_review.rb +12 -0
  52. data/examples/products/product_rule.rb +54 -0
  53. data/examples/products/product_video.rb +45 -0
  54. data/examples/products/sku.rb +48 -0
  55. data/examples/shipping/shipping_method.rb +13 -0
  56. data/examples/store/store_info.rb +10 -0
  57. data/examples/system/time.rb +10 -0
  58. data/examples/tax/tax_class.rb +13 -0
  59. data/examples/webhooks/webhook.rb +29 -0
  60. data/lib/bigcommerce.rb +50 -8
  61. data/lib/bigcommerce/exception.rb +51 -0
  62. data/lib/bigcommerce/middleware/auth.rb +16 -0
  63. data/lib/bigcommerce/middleware/http_exception.rb +14 -0
  64. data/lib/bigcommerce/request.rb +89 -0
  65. data/lib/bigcommerce/resource_actions.rb +51 -0
  66. data/lib/bigcommerce/resources/content/blog_post.rb +31 -0
  67. data/lib/bigcommerce/resources/content/blog_tag.rb +17 -0
  68. data/lib/bigcommerce/resources/content/redirect.rb +21 -0
  69. data/lib/bigcommerce/resources/customers/customer.rb +30 -0
  70. data/lib/bigcommerce/resources/customers/customer_address.rb +34 -0
  71. data/lib/bigcommerce/resources/customers/customer_group.rb +21 -0
  72. data/lib/bigcommerce/resources/geography/country.rb +22 -0
  73. data/lib/bigcommerce/resources/geography/state.rb +25 -0
  74. data/lib/bigcommerce/resources/marketing/coupon.rb +30 -0
  75. data/lib/bigcommerce/resources/orders/order.rb +73 -0
  76. data/lib/bigcommerce/resources/orders/order_coupon.rb +20 -0
  77. data/lib/bigcommerce/resources/orders/order_message.rb +23 -0
  78. data/lib/bigcommerce/resources/orders/order_product.rb +64 -0
  79. data/lib/bigcommerce/resources/orders/order_shipping_address.rb +50 -0
  80. data/lib/bigcommerce/resources/orders/order_status.rb +16 -0
  81. data/lib/bigcommerce/resources/orders/order_tax.rb +23 -0
  82. data/lib/bigcommerce/resources/orders/shipment.rb +30 -0
  83. data/lib/bigcommerce/resources/payments/payment_method.rb +17 -0
  84. data/lib/bigcommerce/resources/products/brand.rb +23 -0
  85. data/lib/bigcommerce/resources/products/bulk_pricing_rule.rb +26 -0
  86. data/lib/bigcommerce/resources/products/category.rb +29 -0
  87. data/lib/bigcommerce/resources/products/configurable_field.rb +30 -0
  88. data/lib/bigcommerce/resources/products/custom_field.rb +24 -0
  89. data/lib/bigcommerce/resources/products/google_product_search_mapping.rb +26 -0
  90. data/lib/bigcommerce/resources/products/option.rb +20 -0
  91. data/lib/bigcommerce/resources/products/option_set.rb +18 -0
  92. data/lib/bigcommerce/resources/products/option_set_option.rb +19 -0
  93. data/lib/bigcommerce/resources/products/option_value.rb +15 -0
  94. data/lib/bigcommerce/resources/products/product.rb +97 -0
  95. data/lib/bigcommerce/resources/products/product_image.rb +31 -0
  96. data/lib/bigcommerce/resources/products/product_option.rb +17 -0
  97. data/lib/bigcommerce/resources/products/product_review.rb +22 -0
  98. data/lib/bigcommerce/resources/products/product_rule.rb +31 -0
  99. data/lib/bigcommerce/resources/products/product_video.rb +24 -0
  100. data/lib/bigcommerce/resources/products/sku.rb +29 -0
  101. data/lib/bigcommerce/resources/resource.rb +10 -0
  102. data/lib/bigcommerce/resources/shipping/shipping_method.rb +15 -0
  103. data/lib/bigcommerce/resources/store/store_information.rb +37 -0
  104. data/lib/bigcommerce/resources/system/time.rb +15 -0
  105. data/lib/bigcommerce/resources/tax/tax_class.rb +15 -0
  106. data/lib/bigcommerce/resources/webhooks/webhook.rb +22 -0
  107. data/lib/bigcommerce/subresource_actions.rb +43 -0
  108. data/lib/bigcommerce/version.rb +1 -4
  109. data/spec/bigcommerce/bigcommerce_spec.rb +76 -0
  110. data/spec/bigcommerce/unit/actions_spec.rb +151 -0
  111. data/spec/bigcommerce/unit/exception_spec.rb +53 -0
  112. data/spec/bigcommerce/unit/middleware/auth_spec.rb +18 -0
  113. data/spec/bigcommerce/unit/middleware/http_exception_spec.rb +40 -0
  114. data/spec/bigcommerce/unit/request_spec.rb +180 -0
  115. data/spec/bigcommerce/unit/resources/content/blog_post_spec.rb +12 -0
  116. data/spec/bigcommerce/unit/resources/content/blog_tag_spec.rb +12 -0
  117. data/spec/bigcommerce/unit/resources/content/redirect_spec.rb +12 -0
  118. data/spec/bigcommerce/unit/resources/customers/customer_address_spec.rb +21 -0
  119. data/spec/bigcommerce/unit/resources/customers/customer_group_spec.rb +12 -0
  120. data/spec/bigcommerce/unit/resources/customers/customer_spec.rb +12 -0
  121. data/spec/bigcommerce/unit/resources/geography/country_spec.rb +12 -0
  122. data/spec/bigcommerce/unit/resources/geography/state_spec.rb +21 -0
  123. data/spec/bigcommerce/unit/resources/marketing/coupon_spec.rb +12 -0
  124. data/spec/bigcommerce/unit/resources/orders/order_product_spec.rb +21 -0
  125. data/spec/bigcommerce/unit/resources/orders/order_shipping_address_spec.rb +21 -0
  126. data/spec/bigcommerce/unit/resources/orders/order_spec.rb +13 -0
  127. data/spec/bigcommerce/unit/resources/orders/shipment_spec.rb +21 -0
  128. data/spec/bigcommerce/unit/resources/payments/payment_method_spec.rb +23 -0
  129. data/spec/bigcommerce/unit/resources/products/brand_spec.rb +12 -0
  130. data/spec/bigcommerce/unit/resources/products/bulk_pricing_rule_spec.rb +21 -0
  131. data/spec/bigcommerce/unit/resources/products/category_spec.rb +12 -0
  132. data/spec/bigcommerce/unit/resources/products/configurable_field_spec.rb +21 -0
  133. data/spec/bigcommerce/unit/resources/products/custom_field_spec.rb +21 -0
  134. data/spec/bigcommerce/unit/resources/products/google_product_search_mapping_spec.rb +14 -0
  135. data/spec/bigcommerce/unit/resources/products/option_set_spec.rb +12 -0
  136. data/spec/bigcommerce/unit/resources/products/option_spec.rb +12 -0
  137. data/spec/bigcommerce/unit/resources/products/product_image_spec.rb +21 -0
  138. data/spec/bigcommerce/unit/resources/products/product_review_spec.rb +14 -0
  139. data/spec/bigcommerce/unit/resources/products/product_rule_spec.rb +21 -0
  140. data/spec/bigcommerce/unit/resources/products/product_spec.rb +13 -0
  141. data/spec/bigcommerce/unit/resources/products/product_video_spec.rb +21 -0
  142. data/spec/bigcommerce/unit/resources/products/sku_spec.rb +21 -0
  143. data/spec/bigcommerce/unit/resources/resource_spec.rb +4 -0
  144. data/spec/bigcommerce/unit/resources/store_info/store_information_spec.rb +12 -0
  145. data/spec/bigcommerce/unit/resources/system/time_spec.rb +12 -0
  146. data/spec/bigcommerce/unit/version_spec.rb +7 -0
  147. data/spec/spec_helper.rb +9 -25
  148. metadata +203 -127
  149. data/lib/big_commerce.rb +0 -1
  150. data/lib/bigcommerce/api.rb +0 -473
  151. data/lib/bigcommerce/connection.rb +0 -171
  152. data/lib/bigcommerce/product.rb +0 -13
  153. data/lib/bigcommerce/resource.rb +0 -50
  154. data/spec/big_commerce_spec.rb +0 -9
  155. data/spec/integration/orders_spec.rb +0 -18
  156. data/spec/support/integration_context.rb +0 -13
  157. data/spec/support/mock_api_context.rb +0 -10
  158. data/spec/unit/api_request_spec.rb +0 -34
  159. data/spec/unit/api_spec.rb +0 -49
  160. data/spec/unit/connection_spec.rb +0 -23
  161. data/spec/unit/date_time_spec.rb +0 -31
  162. data/spec/unit/version_spec.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a54eb51eb08fb56817334d0725b0f58f7815e882
4
- data.tar.gz: 293bfd8af80d9a3ebdc19a0c5c49c39ed1f3b1ff
3
+ metadata.gz: d098924abf4c82d2daa1a8dfdd09068a8960e771
4
+ data.tar.gz: d31b1ab3c0f9c52df72d16c06a00c72f615e21e0
5
5
  SHA512:
6
- metadata.gz: 839f079c9d4f3aef25dbbf2faf5455c3496084784243b4cb92ed9df643968ff6acba952d71eebb2b43799cc6f0845611cde3315844ff56b9d01d0ec2c9f67624
7
- data.tar.gz: 19da39343bff9cd3f49a140478c5300f6dbfd071ed33d0ba894c2b44deceba26630fd13ecdba098be5a7c5e94b4d9abba9ba657e09386106b7452ba27cc51070
6
+ metadata.gz: 4b520cad6ba40ea401e4a79e15ed7d0308dc8d87599382a6cb6b02972b4e30729351832cbbccedff8054fae635b6d769c0d9970528ed448d90e5a21de483602f
7
+ data.tar.gz: 81357d00e6c8cd9eec5a2d8123c68c33c36b7bb686369d82e80e30b8cbb6b9b378041f54cd21d64878e53508cedd613cb7d0aab8c4fb1183c1f04f6eb18e66ae
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .DS_Store
4
+ .bundle
5
+ .rvmrc
6
+ .ruby-version
7
+ .yardoc
8
+ .rake_tasks~
9
+ Gemfile.lock
10
+ coverage/*
11
+ doc/*
12
+ log/*
13
+ pkg/*
14
+ .idea/*
15
+ tmp/*
16
+ .env
17
+ .env-*
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --colour
2
+ --format=documentation
@@ -0,0 +1,620 @@
1
+ # This is the default configuration file. Enabling and disabling is configured
2
+ # in separate files. This file adds all other parameters apart from Enabled.
3
+
4
+ # Common configuration.
5
+ AllCops:
6
+ # Include gemspec and Rakefile
7
+ Include:
8
+ - '**/*.gemspec'
9
+ - '**/*.podspec'
10
+ - '**/*.jbuilder'
11
+ - '**/*.rake'
12
+ - '**/*.opal'
13
+ - '**/Gemfile'
14
+ - '**/Rakefile'
15
+ - '**/Capfile'
16
+ - '**/Guardfile'
17
+ - '**/Podfile'
18
+ - '**/Thorfile'
19
+ - '**/Vagrantfile'
20
+ - '**/Berksfile'
21
+ - '**/Cheffile'
22
+ - '**/Vagabondfile'
23
+ Exclude:
24
+ - 'vendor/**/*'
25
+ - 'spec/**/*'
26
+ # By default, the rails cops are not run. Override in project or home
27
+ # directory .rubocop.yml files, or by giving the -R/--rails option.
28
+ RunRailsCops: false
29
+ # Cop names are not displayed in offense messages by default. Change behavior
30
+ # by overriding DisplayCopNames, or by giving the -D/--display-cop-names
31
+ # option.
32
+ DisplayCopNames: false
33
+ # Additional cops that do not reference a style guide rule may be enabled by
34
+ # default. Change behavior by overriding StyleGuideCopsOnly, or by giving
35
+ # the --only-guide-cops option.
36
+ StyleGuideCopsOnly: false
37
+
38
+ # Indent private/protected/public as deep as method definitions
39
+ Style/Documentation:
40
+ Enabled: false
41
+
42
+ Style/AccessModifierIndentation:
43
+ EnforcedStyle: indent
44
+ SupportedStyles:
45
+ - outdent
46
+ - indent
47
+
48
+ # Align the elements of a hash literal if they span more than one line.
49
+ Style/AlignHash:
50
+ # Alignment of entries using hash rocket as separator. Valid values are:
51
+ #
52
+ # key - left alignment of keys
53
+ # 'a' => 2
54
+ # 'bb' => 3
55
+ # separator - alignment of hash rockets, keys are right aligned
56
+ # 'a' => 2
57
+ # 'bb' => 3
58
+ # table - left alignment of keys, hash rockets, and values
59
+ # 'a' => 2
60
+ # 'bb' => 3
61
+ EnforcedHashRocketStyle: key
62
+ # Alignment of entries using colon as separator. Valid values are:
63
+ #
64
+ # key - left alignment of keys
65
+ # a: 0
66
+ # bb: 1
67
+ # separator - alignment of colons, keys are right aligned
68
+ # a: 0
69
+ # bb: 1
70
+ # table - left alignment of keys and values
71
+ # a: 0
72
+ # bb: 1
73
+ EnforcedColonStyle: key
74
+ # Select whether hashes that are the last argument in a method call should be
75
+ # inspected? Valid values are:
76
+ #
77
+ # always_inspect - Inspect both implicit and explicit hashes.
78
+ # Registers an offense for:
79
+ # function(a: 1,
80
+ # b: 2)
81
+ # Registers an offense for:
82
+ # function({a: 1,
83
+ # b: 2})
84
+ # always_ignore - Ignore both implicit and explicit hashes.
85
+ # Accepts:
86
+ # function(a: 1,
87
+ # b: 2)
88
+ # Accepts:
89
+ # function({a: 1,
90
+ # b: 2})
91
+ # ignore_implicit - Ignore only implicit hashes.
92
+ # Accepts:
93
+ # function(a: 1,
94
+ # b: 2)
95
+ # Registers an offense for:
96
+ # function({a: 1,
97
+ # b: 2})
98
+ # ignore_explicit - Ignore only explicit hashes.
99
+ # Accepts:
100
+ # function({a: 1,
101
+ # b: 2})
102
+ # Registers an offense for:
103
+ # function(a: 1,
104
+ # b: 2)
105
+ EnforcedLastArgumentHashStyle: always_inspect
106
+ SupportedLastArgumentHashStyles:
107
+ - always_inspect
108
+ - always_ignore
109
+ - ignore_implicit
110
+ - ignore_explicit
111
+
112
+ Style/AlignParameters:
113
+ # Alignment of parameters in multi-line method calls.
114
+ #
115
+ # The `with_first_parameter` style aligns the following lines along the same
116
+ # column as the first parameter.
117
+ #
118
+ # method_call(a,
119
+ # b)
120
+ #
121
+ # The `with_fixed_indentation` style aligns the following lines with one
122
+ # level of indentation relative to the start of the line with the method call.
123
+ #
124
+ # method_call(a,
125
+ # b)
126
+ EnforcedStyle: with_first_parameter
127
+ SupportedStyles:
128
+ - with_first_parameter
129
+ - with_fixed_indentation
130
+
131
+ Style/AndOr:
132
+ # Whether `and` and `or` are banned only in conditionals (conditionals)
133
+ # or completely (always).
134
+ EnforcedStyle: always
135
+ SupportedStyles:
136
+ - always
137
+ - conditionals
138
+
139
+
140
+ # Checks if usage of %() or %Q() matches configuration.
141
+ Style/BarePercentLiterals:
142
+ EnforcedStyle: bare_percent
143
+ SupportedStyles:
144
+ - percent_q
145
+ - bare_percent
146
+
147
+ Style/BracesAroundHashParameters:
148
+ EnforcedStyle: no_braces
149
+ SupportedStyles:
150
+ # The `braces` style enforces braces around all method parameters that are
151
+ # hashes.
152
+ - braces
153
+ # The `no_braces` style checks that the last parameter doesn't have braces
154
+ # around it.
155
+ - no_braces
156
+ # The `context_dependent` style checks that the last parameter doesn't have
157
+ # braces around it, but requires braces if the second to last parameter is
158
+ # also a hash literal.
159
+ - context_dependent
160
+
161
+ # Indentation of `when`.
162
+ Style/CaseIndentation:
163
+ IndentWhenRelativeTo: case
164
+
165
+ Style/ClassAndModuleChildren:
166
+ # Checks the style of children definitions at classes and modules.
167
+ #
168
+ # Basically there are two different styles:
169
+ #
170
+ # `nested` - have each child on a separate line
171
+ # class Foo
172
+ # class Bar
173
+ # end
174
+ # end
175
+ #
176
+ # `compact` - combine definitions as much as possible
177
+ # class Foo::Bar
178
+ # end
179
+ #
180
+ # The compact style is only forced, for classes / modules with one child.
181
+ EnforcedStyle: nested
182
+ SupportedStyles:
183
+ - nested
184
+ - compact
185
+
186
+ Style/ClassCheck:
187
+ EnforcedStyle: is_a?
188
+ SupportedStyles:
189
+ - is_a?
190
+ - kind_of?
191
+
192
+ # Align with the style guide.
193
+ Style/CollectionMethods:
194
+ # Mapping from undesired method to desired_method
195
+ # e.g. to use `detect` over `find`:
196
+ #
197
+ # CollectionMethods:
198
+ # PreferredMethods:
199
+ # find: detect
200
+ PreferredMethods:
201
+ collect: 'map'
202
+ collect!: 'map!'
203
+ inject: 'reduce'
204
+ detect: 'find'
205
+ find_all: 'select'
206
+
207
+ # Checks formatting of special comments
208
+ Style/CommentAnnotation:
209
+ Keywords:
210
+ - TODO
211
+ - FIXME
212
+ - OPTIMIZE
213
+ - HACK
214
+ - REVIEW
215
+
216
+ # Multi-line method chaining should be done with leading dots.
217
+ Style/DotPosition:
218
+ EnforcedStyle: leading
219
+ SupportedStyles:
220
+ - leading
221
+ - trailing
222
+
223
+ # Use empty lines between defs.
224
+ Style/EmptyLineBetweenDefs:
225
+ # If true, this parameter means that single line method definitions don't
226
+ # need an empty line between them.
227
+ AllowAdjacentOneLineDefs: false
228
+
229
+ Style/EmptyLinesAroundBlockBody:
230
+ EnforcedStyle: no_empty_lines
231
+ SupportedStyles:
232
+ - empty_lines
233
+ - no_empty_lines
234
+
235
+ Style/EmptyLinesAroundClassBody:
236
+ EnforcedStyle: no_empty_lines
237
+ SupportedStyles:
238
+ - empty_lines
239
+ - no_empty_lines
240
+
241
+ Style/EmptyLinesAroundModuleBody:
242
+ EnforcedStyle: no_empty_lines
243
+ SupportedStyles:
244
+ - empty_lines
245
+ - no_empty_lines
246
+
247
+ Style/FileName:
248
+ # File names listed in AllCops:Include are excluded by default. Add extra
249
+ # excludes here.
250
+ Exclude: []
251
+
252
+ Style/FirstParameterIndentation:
253
+ EnforcedStyle: special_for_inner_method_call_in_parentheses
254
+ SupportedStyles:
255
+ # The first parameter should always be indented one step more than the
256
+ # preceding line.
257
+ - consistent
258
+ # The first parameter should normally be indented one step more than the
259
+ # preceding line, but if it's a parameter for a method call that is itself
260
+ # a parameter in a method call, then the inner parameter should be indented
261
+ # relative to the inner method.
262
+ - special_for_inner_method_call
263
+ # Same as special_for_inner_method_call except that the special rule only
264
+ # applies if the outer method call encloses its arguments in parentheses.
265
+ - special_for_inner_method_call_in_parentheses
266
+
267
+ # Checks use of for or each in multiline loops.
268
+ Style/For:
269
+ EnforcedStyle: each
270
+ SupportedStyles:
271
+ - for
272
+ - each
273
+
274
+ # Enforce the method used for string formatting.
275
+ Style/FormatString:
276
+ EnforcedStyle: format
277
+ SupportedStyles:
278
+ - format
279
+ - sprintf
280
+ - percent
281
+
282
+ # Built-in global variables are allowed by default.
283
+ Style/GlobalVars:
284
+ AllowedVariables: []
285
+
286
+ # `MinBodyLength` defines the number of lines of the a body of an if / unless
287
+ # needs to have to trigger this cop
288
+ Style/GuardClause:
289
+ MinBodyLength: 1
290
+
291
+ Style/HashSyntax:
292
+ EnforcedStyle: ruby19
293
+ SupportedStyles:
294
+ - ruby19
295
+ - ruby19_no_mixed_keys
296
+ - hash_rockets
297
+
298
+ Style/IfUnlessModifier:
299
+ MaxLineLength: 90
300
+
301
+ Style/IndentationWidth:
302
+ # Number of spaces for each indentation level.
303
+ Width: 2
304
+
305
+ # Checks the indentation of the first key in a hash literal.
306
+ Style/IndentHash:
307
+ # The value `special_inside_parentheses` means that hash literals with braces
308
+ # that have their opening brace on the same line as a surrounding opening
309
+ # round parenthesis, shall have their first key indented relative to the
310
+ # first position inside the parenthesis.
311
+ # The value `consistent` means that the indentation of the first key shall
312
+ # always be relative to the first position of the line where the opening
313
+ # brace is.
314
+ EnforcedStyle: special_inside_parentheses
315
+ SupportedStyles:
316
+ - special_inside_parentheses
317
+ - consistent
318
+
319
+ Style/LambdaCall:
320
+ EnforcedStyle: call
321
+ SupportedStyles:
322
+ - call
323
+ - braces
324
+
325
+ Style/Next:
326
+ # With `always` all conditions at the end of an iteration needs to be
327
+ # replaced by next - with `skip_modifier_ifs` the modifier if like this one
328
+ # are ignored: [1, 2].each { |a| return 'yes' if a == 1 }
329
+ EnforcedStyle: skip_modifier_ifs
330
+ # `MinBodyLength` defines the number of lines of the a body of an if / unless
331
+ # needs to have to trigger this cop
332
+ MinBodyLength: 3
333
+ SupportedStyles:
334
+ - skip_modifier_ifs
335
+ - always
336
+
337
+ Style/NonNilCheck:
338
+ # With `IncludeSemanticChanges` set to `true`, this cop reports offenses for
339
+ # `!x.nil?` and autocorrects that and `x != nil` to solely `x`, which is
340
+ # **usually** OK, but might change behavior.
341
+ #
342
+ # With `IncludeSemanticChanges` set to `false`, this cop does not report
343
+ # offenses for `!x.nil?` and does no changes that might change behavior.
344
+ IncludeSemanticChanges: false
345
+
346
+ Style/MethodDefParentheses:
347
+ EnforcedStyle: require_parentheses
348
+ SupportedStyles:
349
+ - require_parentheses
350
+ - require_no_parentheses
351
+
352
+ Style/MethodName:
353
+ EnforcedStyle: snake_case
354
+ SupportedStyles:
355
+ - snake_case
356
+ - camelCase
357
+
358
+ Style/MultilineOperationIndentation:
359
+ EnforcedStyle: aligned
360
+ SupportedStyles:
361
+ - aligned
362
+ - indented
363
+
364
+ Style/NumericLiterals:
365
+ MinDigits: 5
366
+
367
+ # Allow safe assignment in conditions.
368
+ Style/ParenthesesAroundCondition:
369
+ AllowSafeAssignment: true
370
+
371
+ Style/PercentLiteralDelimiters:
372
+ PreferredDelimiters:
373
+ '%': ()
374
+ '%i': ()
375
+ '%q': ()
376
+ '%Q': ()
377
+ '%r': '{}'
378
+ '%s': ()
379
+ '%w': ()
380
+ '%W': ()
381
+ '%x': ()
382
+
383
+ Style/PercentQLiterals:
384
+ EnforcedStyle: lower_case_q
385
+ SupportedStyles:
386
+ - lower_case_q # Use %q when possible, %Q when necessary
387
+ - upper_case_q # Always use %Q
388
+
389
+ Style/PredicateName:
390
+ # Predicate name prefices.
391
+ NamePrefix:
392
+ - is_
393
+ - has_
394
+ - have_
395
+ # Predicate name prefices that should be removed.
396
+ NamePrefixBlacklist:
397
+ - is_
398
+ - has_
399
+ - have_
400
+
401
+ Style/RaiseArgs:
402
+ EnforcedStyle: exploded
403
+ SupportedStyles:
404
+ - compact # raise Exception.new(msg)
405
+ - exploded # raise Exception, msg
406
+
407
+ Style/RedundantReturn:
408
+ # When true allows code like `return x, y`.
409
+ AllowMultipleReturnValues: false
410
+
411
+ Style/RegexpLiteral:
412
+ # The maximum number of (escaped) slashes that a slash-delimited regexp is
413
+ # allowed to have. If there are more slashes, a %r regexp shall be used.
414
+ MaxSlashes: 1
415
+
416
+ Style/Semicolon:
417
+ # Allow ; to separate several expressions on the same line.
418
+ AllowAsExpressionSeparator: false
419
+
420
+ Style/SignalException:
421
+ EnforcedStyle: semantic
422
+ SupportedStyles:
423
+ - only_raise
424
+ - only_fail
425
+ - semantic
426
+
427
+ Style/SingleLineBlockParams:
428
+ Methods:
429
+ - reduce:
430
+ - a
431
+ - e
432
+ - inject:
433
+ - a
434
+ - e
435
+
436
+ Style/SingleLineMethods:
437
+ AllowIfMethodIsEmpty: true
438
+
439
+ Style/StringLiterals:
440
+ EnforcedStyle: single_quotes
441
+ SupportedStyles:
442
+ - single_quotes
443
+ - double_quotes
444
+
445
+ Style/StringLiteralsInInterpolation:
446
+ EnforcedStyle: single_quotes
447
+ SupportedStyles:
448
+ - single_quotes
449
+ - double_quotes
450
+
451
+ Style/SpaceAroundBlockParameters:
452
+ EnforcedStyleInsidePipes: no_space
453
+ SupportedStyles:
454
+ - space
455
+ - no_space
456
+
457
+ Style/SpaceAroundEqualsInParameterDefault:
458
+ EnforcedStyle: space
459
+ SupportedStyles:
460
+ - space
461
+ - no_space
462
+
463
+ Style/SpaceBeforeBlockBraces:
464
+ EnforcedStyle: space
465
+ SupportedStyles:
466
+ - space
467
+ - no_space
468
+
469
+ Style/SpaceInsideBlockBraces:
470
+ EnforcedStyle: space
471
+ SupportedStyles:
472
+ - space
473
+ - no_space
474
+ # Valid values are: space, no_space
475
+ EnforcedStyleForEmptyBraces: no_space
476
+ # Space between { and |. Overrides EnforcedStyle if there is a conflict.
477
+ SpaceBeforeBlockParameters: true
478
+
479
+ Style/SpaceInsideHashLiteralBraces:
480
+ EnforcedStyle: space
481
+ EnforcedStyleForEmptyBraces: no_space
482
+ SupportedStyles:
483
+ - space
484
+ - no_space
485
+
486
+ Style/SymbolProc:
487
+ # A list of method names to be ignored by the check.
488
+ # The names should be fairly unique, otherwise you'll end up ignoring lots of code.
489
+ IgnoredMethods:
490
+ - respond_to
491
+
492
+ Style/TrailingBlankLines:
493
+ EnforcedStyle: final_newline
494
+ SupportedStyles:
495
+ - final_newline
496
+ - final_blank_line
497
+
498
+ Style/TrailingComma:
499
+ # If EnforcedStyleForMultiline is comma, the cop requires a comma after the
500
+ # last item of a list, but only for lists where each item is on its own line.
501
+ # If EnforcedStyleForMultiline is consistent_comma, the cop requires a comma
502
+ # after the last item of a list, for all lists.
503
+ EnforcedStyleForMultiline: no_comma
504
+ SupportedStyles:
505
+ - comma
506
+ - consistent_comma
507
+ - no_comma
508
+
509
+ # TrivialAccessors doesn't require exact name matches and doesn't allow
510
+ # predicated methods by default.
511
+ Style/TrivialAccessors:
512
+ ExactNameMatch: false
513
+ AllowPredicates: false
514
+ # Allows trivial writers that don't end in an equal sign. e.g.
515
+ #
516
+ # def on_exception(action)
517
+ # @on_exception=action
518
+ # end
519
+ # on_exception :restart
520
+ #
521
+ # Commonly used in DSLs
522
+ AllowDSLWriters: false
523
+ Whitelist:
524
+ - to_ary
525
+ - to_a
526
+ - to_c
527
+ - to_enum
528
+ - to_h
529
+ - to_hash
530
+ - to_i
531
+ - to_int
532
+ - to_io
533
+ - to_open
534
+ - to_path
535
+ - to_proc
536
+ - to_r
537
+ - to_regexp
538
+ - to_str
539
+ - to_s
540
+ - to_sym
541
+
542
+ Style/VariableName:
543
+ EnforcedStyle: snake_case
544
+ SupportedStyles:
545
+ - snake_case
546
+ - camelCase
547
+
548
+ Style/WhileUntilModifier:
549
+ MaxLineLength: 90
550
+
551
+ Style/WordArray:
552
+ MinSize: 0
553
+ # The regular expression WordRegex decides what is considered a word.
554
+ WordRegex: !ruby/regexp '/\A[\p{Word}]+\z/'
555
+
556
+ ##################### Metrics ##################################
557
+
558
+ Metrics/AbcSize:
559
+ # The ABC size is a calculated magnitude, so this number can be a Fixnum or
560
+ # a Float.
561
+ Max: 20
562
+
563
+ Metrics/BlockNesting:
564
+ Max: 3
565
+
566
+ Metrics/ClassLength:
567
+ CountComments: false # count full line comments?
568
+ Max: 100
569
+
570
+ # Avoid complex methods.
571
+ Metrics/CyclomaticComplexity:
572
+ Max: 6
573
+
574
+ Metrics/LineLength:
575
+ Max: 90
576
+ # To make it possible to copy or click on URIs in the code, we allow lines
577
+ # contaning a URI to be longer than Max.
578
+ AllowURI: true
579
+ URISchemes:
580
+ - http
581
+ - https
582
+
583
+ Metrics/MethodLength:
584
+ CountComments: false # count full line comments?
585
+ Max: 15
586
+
587
+ Metrics/ParameterLists:
588
+ Max: 5
589
+ CountKeywordArgs: true
590
+
591
+ Metrics/PerceivedComplexity:
592
+ Max: 7
593
+
594
+ ##################### Lint ##################################
595
+
596
+ # Allow safe assignment in conditions.
597
+ Lint/AssignmentInCondition:
598
+ AllowSafeAssignment: true
599
+
600
+ # Align ends correctly.
601
+ Lint/EndAlignment:
602
+ # The value `keyword` means that `end` should be aligned with the matching
603
+ # keyword (if, while, etc.).
604
+ # The value `variable` means that in assignments, `end` should be aligned
605
+ # with the start of the variable on the left hand side of `=`. In all other
606
+ # situations, `end` should still be aligned with the keyword.
607
+ AlignWith: keyword
608
+ SupportedStyles:
609
+ - keyword
610
+ - variable
611
+
612
+ Lint/DefEndAlignment:
613
+ # The value `def` means that `end` should be aligned with the def keyword.
614
+ # The value `start_of_line` means that `end` should be aligned with method
615
+ # calls like `private`, `public`, etc, if present in front of the `def`
616
+ # keyword on the same line.
617
+ AlignWith: start_of_line
618
+ SupportedStyles:
619
+ - start_of_line
620
+ - def