disco_app 0.15.2 → 0.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (310) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -5
  3. data/app/clients/disco_app/api_client.rb +25 -19
  4. data/app/clients/disco_app/graphql_client.rb +85 -0
  5. data/app/controllers/disco_app/admin/app_settings_controller.rb +2 -0
  6. data/app/controllers/disco_app/admin/application_controller.rb +1 -0
  7. data/app/controllers/disco_app/admin/concerns/app_settings_controller.rb +2 -1
  8. data/app/controllers/disco_app/admin/concerns/authenticated_controller.rb +5 -3
  9. data/app/controllers/disco_app/admin/concerns/plans_controller.rb +3 -2
  10. data/app/controllers/disco_app/admin/concerns/shops_controller.rb +1 -0
  11. data/app/controllers/disco_app/admin/concerns/sources_controller.rb +2 -1
  12. data/app/controllers/disco_app/admin/concerns/subscriptions_controller.rb +3 -2
  13. data/app/controllers/disco_app/admin/plans_controller.rb +2 -0
  14. data/app/controllers/disco_app/admin/resources/shops_controller.rb +2 -0
  15. data/app/controllers/disco_app/admin/shops_controller.rb +2 -0
  16. data/app/controllers/disco_app/admin/sources_controller.rb +2 -0
  17. data/app/controllers/disco_app/admin/subscriptions_controller.rb +2 -0
  18. data/app/controllers/disco_app/charges_controller.rb +6 -7
  19. data/app/controllers/disco_app/concerns/app_proxy_controller.rb +6 -6
  20. data/app/controllers/disco_app/concerns/authenticated_controller.rb +26 -27
  21. data/app/controllers/disco_app/concerns/carrier_request_controller.rb +22 -11
  22. data/app/controllers/disco_app/concerns/user_authenticated_controller.rb +1 -0
  23. data/app/controllers/disco_app/concerns/webhooks_controller.rb +13 -12
  24. data/app/controllers/disco_app/flow/actions_controller.rb +9 -0
  25. data/app/controllers/disco_app/flow/concerns/actions_controller.rb +23 -0
  26. data/app/controllers/disco_app/flow/concerns/trigger_usage_controller.rb +29 -0
  27. data/app/controllers/disco_app/flow/concerns/verifies_flow_payload.rb +39 -0
  28. data/app/controllers/disco_app/flow/trigger_usage_controller.rb +9 -0
  29. data/app/controllers/disco_app/frame_controller.rb +0 -1
  30. data/app/controllers/disco_app/install_controller.rb +3 -6
  31. data/app/controllers/disco_app/subscriptions_controller.rb +12 -4
  32. data/app/controllers/disco_app/user_sessions_controller.rb +1 -0
  33. data/app/controllers/disco_app/webhooks_controller.rb +2 -0
  34. data/app/controllers/sessions_controller.rb +5 -6
  35. data/app/helpers/disco_app/application_helper.rb +7 -7
  36. data/app/jobs/disco_app/app_installed_job.rb +2 -0
  37. data/app/jobs/disco_app/app_uninstalled_job.rb +2 -0
  38. data/app/jobs/disco_app/concerns/app_installed_job.rb +2 -3
  39. data/app/jobs/disco_app/concerns/app_uninstalled_job.rb +2 -1
  40. data/app/jobs/disco_app/concerns/customers_data_request_job.rb +13 -0
  41. data/app/jobs/disco_app/concerns/customers_redact_job.rb +13 -0
  42. data/app/jobs/disco_app/concerns/render_asset_group_job.rb +1 -0
  43. data/app/jobs/disco_app/concerns/shop_redact_job.rb +13 -0
  44. data/app/jobs/disco_app/concerns/shop_update_job.rb +9 -2
  45. data/app/jobs/disco_app/concerns/subscription_changed_job.rb +2 -1
  46. data/app/jobs/disco_app/concerns/synchronise_carrier_service_job.rb +8 -7
  47. data/app/jobs/disco_app/concerns/synchronise_resources_job.rb +1 -0
  48. data/app/jobs/disco_app/concerns/synchronise_users_job.rb +6 -3
  49. data/app/jobs/disco_app/concerns/synchronise_webhooks_job.rb +24 -11
  50. data/app/jobs/disco_app/customers_data_request_job.rb +5 -0
  51. data/app/jobs/disco_app/customers_redact_job.rb +5 -0
  52. data/app/jobs/disco_app/flow/process_action_job.rb +11 -0
  53. data/app/jobs/disco_app/flow/process_trigger_job.rb +11 -0
  54. data/app/jobs/disco_app/render_asset_group_job.rb +2 -0
  55. data/app/jobs/disco_app/shop_job.rb +10 -10
  56. data/app/jobs/disco_app/shop_redact_job.rb +5 -0
  57. data/app/jobs/disco_app/shop_update_job.rb +2 -0
  58. data/app/jobs/disco_app/subscription_changed_job.rb +2 -0
  59. data/app/jobs/disco_app/synchronise_carrier_service_job.rb +2 -0
  60. data/app/jobs/disco_app/synchronise_resources_job.rb +2 -0
  61. data/app/jobs/disco_app/synchronise_users_job.rb +2 -0
  62. data/app/jobs/disco_app/synchronise_webhooks_job.rb +2 -0
  63. data/app/models/application_record.rb +2 -0
  64. data/app/models/disco_app/app_settings.rb +2 -0
  65. data/app/models/disco_app/application_charge.rb +1 -1
  66. data/app/models/disco_app/concerns/app_settings.rb +2 -0
  67. data/app/models/disco_app/concerns/can_be_liquified.rb +29 -14
  68. data/app/models/disco_app/concerns/has_metafields.rb +1 -2
  69. data/app/models/disco_app/concerns/plan.rb +3 -4
  70. data/app/models/disco_app/concerns/plan_code.rb +1 -2
  71. data/app/models/disco_app/concerns/renders_assets.rb +15 -21
  72. data/app/models/disco_app/concerns/shop.rb +20 -14
  73. data/app/models/disco_app/concerns/source.rb +2 -3
  74. data/app/models/disco_app/concerns/subscription.rb +3 -3
  75. data/app/models/disco_app/concerns/synchronises.rb +10 -15
  76. data/app/models/disco_app/concerns/taggable.rb +1 -0
  77. data/app/models/disco_app/concerns/user.rb +3 -2
  78. data/app/models/disco_app/flow/action.rb +9 -0
  79. data/app/models/disco_app/flow/concerns/action.rb +27 -0
  80. data/app/models/disco_app/flow/concerns/trigger.rb +28 -0
  81. data/app/models/disco_app/flow/concerns/trigger_usage.rb +17 -0
  82. data/app/models/disco_app/flow/trigger.rb +9 -0
  83. data/app/models/disco_app/flow/trigger_usage.rb +9 -0
  84. data/app/models/disco_app/plan.rb +2 -0
  85. data/app/models/disco_app/plan_code.rb +2 -0
  86. data/app/models/disco_app/session_storage.rb +5 -2
  87. data/app/models/disco_app/shop.rb +2 -0
  88. data/app/models/disco_app/source.rb +2 -0
  89. data/app/models/disco_app/subscription.rb +2 -0
  90. data/app/models/disco_app/user.rb +2 -0
  91. data/app/resources/disco_app/admin/resources/concerns/shop_resource.rb +12 -15
  92. data/app/resources/disco_app/admin/resources/shop_resource.rb +1 -0
  93. data/app/services/disco_app/carrier_request_service.rb +3 -3
  94. data/app/services/disco_app/charges_service.rb +26 -34
  95. data/app/services/disco_app/flow/create_action.rb +35 -0
  96. data/app/services/disco_app/flow/create_trigger.rb +34 -0
  97. data/app/services/disco_app/flow/process_action.rb +50 -0
  98. data/app/services/disco_app/flow/process_trigger.rb +72 -0
  99. data/app/services/disco_app/flow/update_trigger_usage.rb +42 -0
  100. data/app/services/disco_app/partner_app_service.rb +1 -1
  101. data/app/services/disco_app/proxy_service.rb +2 -2
  102. data/app/services/disco_app/request_validation_service.rb +2 -2
  103. data/app/services/disco_app/subscription_service.rb +60 -32
  104. data/app/services/disco_app/webhook_service.rb +9 -11
  105. data/app/views/layouts/admin.html.erb +1 -2
  106. data/app/views/layouts/application.html.erb +1 -2
  107. data/app/views/layouts/embedded_app.html.erb +2 -4
  108. data/app/views/layouts/embedded_app_modal.html.erb +2 -3
  109. data/app/views/shopify_app/sessions/new.html.erb +2 -4
  110. data/config/routes.rb +11 -3
  111. data/db/migrate/20150525000000_create_shops_if_not_existent.rb +80 -80
  112. data/db/migrate/20170315062548_create_disco_app_sources.rb +2 -0
  113. data/db/migrate/20170315062629_add_sources_to_shop_subscriptions.rb +3 -1
  114. data/db/migrate/20170327214540_create_disco_app_users.rb +2 -1
  115. data/db/migrate/20170606160751_fix_disco_app_users_index.rb +2 -0
  116. data/db/migrate/20181229100327_create_flow_actions_and_triggers.rb +32 -0
  117. data/db/migrate/20200405000000_create_flow_trigger_usages.rb +16 -0
  118. data/lib/disco_app/configuration.rb +12 -5
  119. data/lib/disco_app/constants.rb +4 -2
  120. data/lib/disco_app/engine.rb +1 -1
  121. data/lib/disco_app/session.rb +1 -0
  122. data/lib/disco_app/support/file_fixtures.rb +2 -1
  123. data/lib/disco_app/version.rb +3 -1
  124. data/lib/generators/disco_app/install/USAGE +5 -0
  125. data/lib/generators/disco_app/install/install_generator.rb +297 -0
  126. data/lib/generators/disco_app/{templates → install/templates}/assets/javascripts/application.js +0 -0
  127. data/lib/generators/disco_app/{templates → install/templates}/assets/javascripts/components.js +0 -0
  128. data/lib/generators/disco_app/{templates → install/templates}/assets/stylesheets/application.scss +0 -0
  129. data/lib/generators/disco_app/install/templates/config/appsignal.yml +12 -0
  130. data/lib/generators/disco_app/install/templates/config/cable.yml.tt +11 -0
  131. data/lib/generators/disco_app/{templates → install/templates}/config/database.yml.tt +6 -3
  132. data/lib/generators/disco_app/install/templates/config/environments/staging.rb +108 -0
  133. data/lib/generators/disco_app/{templates → install/templates}/config/puma.rb +0 -0
  134. data/lib/generators/disco_app/{templates → install/templates}/controllers/home_controller.rb +1 -0
  135. data/lib/generators/disco_app/{templates → install/templates}/initializers/disco_app.rb +5 -0
  136. data/lib/generators/disco_app/install/templates/initializers/session_store.rb +2 -0
  137. data/lib/generators/disco_app/install/templates/initializers/shopify_app.rb +11 -0
  138. data/lib/generators/disco_app/{templates → install/templates}/initializers/shopify_session_repository.rb +0 -0
  139. data/lib/generators/disco_app/install/templates/initializers/timber.rb +4 -0
  140. data/lib/generators/disco_app/{templates → install/templates}/root/.editorconfig +0 -0
  141. data/lib/generators/disco_app/{templates → install/templates}/root/.env +7 -0
  142. data/lib/generators/disco_app/{templates → install/templates}/root/.env.local +4 -0
  143. data/lib/generators/disco_app/{templates → install/templates}/root/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  144. data/lib/generators/disco_app/{templates → install/templates}/root/.gitignore +6 -0
  145. data/lib/generators/disco_app/install/templates/root/.rspec +1 -0
  146. data/lib/generators/disco_app/{templates → install/templates}/root/.rubocop.yml +315 -217
  147. data/lib/generators/disco_app/install/templates/root/.tool-versions +2 -0
  148. data/lib/generators/disco_app/{templates → install/templates}/root/CHECKS +0 -0
  149. data/lib/generators/disco_app/{templates → install/templates}/root/Procfile +0 -0
  150. data/lib/generators/disco_app/{templates → install/templates}/root/README.md +0 -0
  151. data/lib/generators/disco_app/install/templates/root/package.json.tt +17 -0
  152. data/lib/generators/disco_app/install/templates/spec/rails_helper.rb +40 -0
  153. data/lib/generators/disco_app/install/templates/spec/spec_helper.rb +24 -0
  154. data/lib/generators/disco_app/install/templates/spec/support/active_job.rb +13 -0
  155. data/lib/generators/disco_app/install/templates/spec/support/coveralls.rb +3 -0
  156. data/lib/generators/disco_app/install/templates/spec/support/database_cleaner.rb +17 -0
  157. data/lib/generators/disco_app/install/templates/spec/support/factory_bot.rb +3 -0
  158. data/lib/generators/disco_app/install/templates/spec/support/helpers/json_helper.rb +13 -0
  159. data/lib/generators/disco_app/install/templates/spec/support/shared_examples/a_synchronise_job.rb +12 -0
  160. data/lib/generators/disco_app/install/templates/spec/support/shoulda.rb +6 -0
  161. data/lib/generators/disco_app/install/templates/spec/support/vcr.rb +14 -0
  162. data/lib/generators/disco_app/install/templates/spec/support/webmock.rb +8 -0
  163. data/lib/generators/disco_app/{templates → install/templates}/views/home/index.html.erb +0 -0
  164. data/lib/generators/disco_app/react/USAGE +5 -0
  165. data/lib/generators/disco_app/react/react_generator.rb +108 -0
  166. data/lib/generators/disco_app/react/templates/app/controllers/embedded/api/base_controller.rb +18 -0
  167. data/lib/generators/disco_app/react/templates/app/controllers/embedded/api/home_controller.rb +10 -0
  168. data/lib/generators/disco_app/react/templates/app/controllers/embedded/api/shops_controller.rb +11 -0
  169. data/lib/generators/disco_app/react/templates/app/controllers/embedded/api/users_controller.rb +11 -0
  170. data/lib/generators/disco_app/react/templates/app/controllers/embedded/home_controller.rb +13 -0
  171. data/lib/generators/disco_app/react/templates/app/models/api_response.rb +107 -0
  172. data/lib/generators/disco_app/react/templates/app/serializers/disco_app/shop_serializer.rb +13 -0
  173. data/lib/generators/disco_app/react/templates/app/serializers/disco_app/user_serializer.rb +13 -0
  174. data/lib/generators/disco_app/react/templates/app/serializers/empty_serializer.rb +5 -0
  175. data/lib/generators/disco_app/react/templates/app/serializers/error_serializer.rb +76 -0
  176. data/lib/generators/disco_app/react/templates/app/views/embedded/home/index.html.erb +12 -0
  177. data/lib/generators/disco_app/react/templates/app/views/layouts/embedded.html.erb +10 -0
  178. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/App.jsx +77 -0
  179. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/HomePage.jsx +34 -0
  180. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/Shared/EmbeddedPage.jsx +70 -0
  181. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/Shared/ErrorBanner.jsx +58 -0
  182. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/Shared/PaginationWrapper.jsx +10 -0
  183. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/Shared/ScrollToTop.jsx +23 -0
  184. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/components/withApi.jsx +125 -0
  185. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/index.jsx +39 -0
  186. data/lib/generators/disco_app/react/templates/app/webpack/javascripts/embedded/utils.js +19 -0
  187. data/lib/generators/disco_app/react/templates/app/webpack/packs/embedded.js +2 -0
  188. data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded/shared/banners.scss +7 -0
  189. data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded/shared/busy.scss +3 -0
  190. data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded/shared/index.scss +3 -0
  191. data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded/shared/pagination.scss +5 -0
  192. data/lib/generators/disco_app/react/templates/app/webpack/stylesheets/embedded.scss +2 -0
  193. data/lib/generators/disco_app/react/templates/config/initializers/mime_types.rb +13 -0
  194. data/lib/generators/disco_app/react/templates/config/initializers/omniauth.rb +27 -0
  195. data/lib/generators/disco_app/react/templates/config/initializers/version.rb.tt +7 -0
  196. data/lib/generators/disco_app/react/templates/config/webpack/staging.js +5 -0
  197. data/lib/generators/disco_app/react/templates/config/webpack/test.js +5 -0
  198. data/lib/generators/disco_app/react/templates/config/webpacker.yml +96 -0
  199. data/lib/generators/disco_app/react/templates/root/.eslintignore +5 -0
  200. data/lib/generators/disco_app/react/templates/root/.eslintrc +69 -0
  201. data/lib/generators/disco_app/react/templates/root/.prettierrc +3 -0
  202. data/lib/generators/disco_app/react/templates/root/VERSION +1 -0
  203. data/lib/generators/disco_app/react/templates/root/babel.config.js +72 -0
  204. data/lib/generators/disco_app/react/templates/root/package.json.tt +84 -0
  205. data/lib/generators/disco_app/react/templates/root/postcss.config.js +14 -0
  206. data/lib/tasks/api.rake +0 -2
  207. data/lib/tasks/carrier_service.rake +0 -2
  208. data/lib/tasks/database.rake +1 -1
  209. data/lib/tasks/sessions.rake +0 -2
  210. data/lib/tasks/shops.rake +0 -2
  211. data/lib/tasks/users.rake +0 -2
  212. data/lib/tasks/webhooks.rake +0 -2
  213. data/test/clients/disco_app/api_client_test.rb +3 -3
  214. data/test/controllers/disco_app/admin/shops_controller_test.rb +1 -0
  215. data/test/controllers/disco_app/charges_controller_test.rb +8 -9
  216. data/test/controllers/disco_app/flow/trigger_usage_controller_test.rb +41 -0
  217. data/test/controllers/disco_app/install_controller_test.rb +2 -1
  218. data/test/controllers/disco_app/subscriptions_controller_test.rb +2 -1
  219. data/test/controllers/disco_app/webhooks_controller_test.rb +1 -0
  220. data/test/controllers/home_controller_test.rb +1 -1
  221. data/test/disco_app_test.rb +3 -1
  222. data/test/dummy/Rakefile +1 -1
  223. data/test/dummy/app/assets/config/manifest.js +2 -0
  224. data/test/dummy/app/controllers/application_controller.rb +2 -0
  225. data/test/dummy/app/controllers/carrier_request_controller.rb +1 -0
  226. data/test/dummy/app/controllers/disco_app/admin/shops_controller.rb +1 -0
  227. data/test/dummy/app/controllers/home_controller.rb +1 -0
  228. data/test/dummy/app/controllers/proxy_controller.rb +1 -0
  229. data/test/dummy/app/javascript/packs/application.js +18 -0
  230. data/test/dummy/app/jobs/disco_app/app_installed_job.rb +2 -3
  231. data/test/dummy/app/jobs/disco_app/app_uninstalled_job.rb +1 -0
  232. data/test/dummy/app/models/application_record.rb +2 -0
  233. data/test/dummy/app/models/cart.rb +4 -3
  234. data/test/dummy/app/models/disco_app/shop.rb +4 -5
  235. data/test/dummy/app/models/js_configuration.rb +1 -0
  236. data/test/dummy/app/models/product.rb +3 -2
  237. data/test/dummy/app/models/widget_configuration.rb +1 -0
  238. data/test/dummy/babel.config.js +72 -0
  239. data/test/dummy/bin/bundle +1 -1
  240. data/test/dummy/bin/rails +1 -1
  241. data/test/dummy/bin/setup +8 -8
  242. data/test/dummy/bin/webpack +19 -0
  243. data/test/dummy/bin/webpack-dev-server +19 -0
  244. data/test/dummy/config/application.rb +4 -3
  245. data/test/dummy/config/boot.rb +2 -2
  246. data/test/dummy/config/database.yml +3 -0
  247. data/test/dummy/config/environment.rb +1 -1
  248. data/test/dummy/config/environments/staging.rb +85 -0
  249. data/test/dummy/config/initializers/disco_app.rb +8 -1
  250. data/test/dummy/config/initializers/omniauth.rb +3 -4
  251. data/test/dummy/config/initializers/session_store.rb +1 -1
  252. data/test/dummy/config/initializers/shopify_app.rb +1 -0
  253. data/test/dummy/config/routes.rb +0 -2
  254. data/test/dummy/config/secrets.yml +3 -0
  255. data/test/dummy/config/webpack/development.js +5 -0
  256. data/test/dummy/config/webpack/environment.js +3 -0
  257. data/test/dummy/config/webpack/production.js +5 -0
  258. data/test/dummy/config/webpack/test.js +5 -0
  259. data/test/dummy/config/webpacker.yml +95 -0
  260. data/test/dummy/db/migrate/20160307182229_create_products.rb +3 -1
  261. data/test/dummy/db/migrate/20160530160739_create_asset_models.rb +3 -1
  262. data/test/dummy/db/migrate/20161105054746_create_carts.rb +2 -1
  263. data/test/dummy/db/schema.rb +45 -6
  264. data/test/dummy/package.json +8 -0
  265. data/test/dummy/postcss.config.js +12 -0
  266. data/test/dummy/yarn.lock +7244 -0
  267. data/test/fixtures/api/subscriptions/valid_request.json +1 -1
  268. data/test/fixtures/api/widget_store/empty_webhooks.json +3 -0
  269. data/test/fixtures/api/widget_store/existing_webhooks.json +43 -0
  270. data/test/fixtures/disco_app/shops.yml +3 -0
  271. data/test/fixtures/webhooks/flow/trigger_usage.json +7 -0
  272. data/test/integration/synchronises_test.rb +2 -1
  273. data/test/jobs/disco_app/app_installed_job_test.rb +28 -9
  274. data/test/jobs/disco_app/app_uninstalled_job_test.rb +5 -2
  275. data/test/jobs/disco_app/send_subscription_job_test.rb +3 -2
  276. data/test/jobs/disco_app/synchronise_carrier_service_job_test.rb +1 -0
  277. data/test/jobs/disco_app/synchronise_users_job_test.rb +1 -0
  278. data/test/jobs/disco_app/synchronise_webhooks_job_test.rb +70 -13
  279. data/test/models/disco_app/can_be_liquified_test.rb +3 -1
  280. data/test/models/disco_app/has_metafields_test.rb +37 -18
  281. data/test/models/disco_app/renders_assets_test.rb +2 -1
  282. data/test/models/disco_app/session_test.rb +2 -2
  283. data/test/models/disco_app/shop_test.rb +1 -1
  284. data/test/services/disco_app/charges_service_test.rb +7 -8
  285. data/test/services/disco_app/flow/create_action_test.rb +51 -0
  286. data/test/services/disco_app/flow/create_trigger_test.rb +56 -0
  287. data/test/services/disco_app/flow/process_action_test.rb +68 -0
  288. data/test/services/disco_app/flow/process_trigger_test.rb +94 -0
  289. data/test/services/disco_app/flow/update_trigger_usage_test.rb +87 -0
  290. data/test/services/disco_app/subscription_service_test.rb +3 -2
  291. data/test/support/test_file_fixtures.rb +2 -2
  292. data/test/support/test_shopify_api.rb +1 -1
  293. data/test/test_helper.rb +10 -7
  294. data/test/vcr/flow_trigger_invalid_title.yml +35 -0
  295. data/test/vcr/flow_trigger_valid.yml +38 -0
  296. data/test/vcr/webhook_failure.yml +13 -13
  297. metadata +282 -148
  298. data/app/clients/disco_app/disco_api_error.rb +0 -2
  299. data/app/clients/disco_app/rollbar_client.rb +0 -53
  300. data/app/clients/disco_app/rollbar_client_error.rb +0 -2
  301. data/lib/generators/disco_app/USAGE +0 -5
  302. data/lib/generators/disco_app/disco_app_generator.rb +0 -236
  303. data/lib/generators/disco_app/templates/config/newrelic.yml +0 -26
  304. data/lib/generators/disco_app/templates/initializers/rollbar.rb +0 -23
  305. data/lib/generators/disco_app/templates/initializers/session_store.rb +0 -2
  306. data/lib/generators/disco_app/templates/initializers/shopify_app.rb +0 -6
  307. data/lib/generators/disco_app/templates/root/.codeclimate.yml +0 -7
  308. data/lib/generators/disco_app/templates/root/.ruby-version +0 -1
  309. data/lib/tasks/rollbar.rake +0 -24
  310. data/test/fixtures/api/widget_store/webhooks.json +0 -1
@@ -1,11 +1,152 @@
1
+ require:
2
+ - rubocop-rails
3
+ - rubocop-performance
4
+
1
5
  AllCops:
2
6
  Exclude:
7
+ - bin/*
3
8
  - db/schema.rb
9
+ - vendor/ruby/**/*
10
+ - node_modules/**/*
11
+ TargetRubyVersion: 2.5
12
+
13
+ # Layout
14
+
15
+ Layout/AccessModifierIndentation:
16
+ Enabled: true
17
+
18
+ Layout/AlignParameters:
19
+ Description: 'Here we check if the parameters on a multi-line method call or definition are aligned.'
20
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
21
+ Enabled: true
22
+ EnforcedStyle: with_fixed_indentation
23
+
24
+ Layout/ClassStructure:
25
+ Categories:
26
+ associations:
27
+ - belongs_to
28
+ - has_one
29
+ - has_many
30
+ attributes:
31
+ - attr_accessor
32
+ - attr_reader
33
+ - attr_writer
34
+ - attr_accessible
35
+ callbacks:
36
+ - before_validation
37
+ - after_validation
38
+ - before_save
39
+ - around_save
40
+ - before_create
41
+ - around_create
42
+ - after_create
43
+ - after_save
44
+ - after_commit
45
+ module_inclusion:
46
+ - include
47
+ - prepend
48
+ - extend
49
+ validations:
50
+ - validates
51
+ ExpectedOrder:
52
+ - module_inclusion
53
+ - constants
54
+ - public_attributes
55
+ - associations
56
+ - validations
57
+ - callbacks
58
+ - public_class_methods
59
+ - initializer
60
+ - public_methods
61
+ - protected_methods
62
+ - private_attributes
63
+ - private_methods
64
+ Enabled: true
65
+
66
+ Layout/DotPosition:
67
+ Description: 'Checks the position of the dot in multi-line method calls.'
68
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
69
+ EnforcedStyle: leading
70
+
71
+ Layout/EmptyLinesAroundClassBody:
72
+ Enabled: true
73
+ EnforcedStyle: empty_lines
74
+
75
+ Layout/EmptyLinesAroundModuleBody:
76
+ Enabled: true
77
+ EnforcedStyle: empty_lines_except_namespace
78
+
79
+ Layout/ExtraSpacing:
80
+ Description: 'Do not use unnecessary spacing.'
81
+ Enabled: true
82
+
83
+ Layout/InitialIndentation:
84
+ Description: >-
85
+ Checks the indentation of the first non-blank non-comment line in a file.
86
+ Enabled: false
87
+
88
+ Layout/IndentFirstHashElement:
89
+ Enabled: true
90
+ EnforcedStyle: consistent
91
+
92
+ Layout/IndentationConsistency:
93
+ EnforcedStyle: indented_internal_methods
94
+ Enabled: true
95
+
96
+ Layout/MultilineBlockLayout:
97
+ Enabled: false
98
+
99
+ Layout/MultilineOperationIndentation:
100
+ Description: >-
101
+ Checks indentation of binary operations that span more than
102
+ one line.
103
+ Enabled: true
104
+ EnforcedStyle: indented
105
+
106
+ Layout/MultilineMethodCallIndentation:
107
+ Description: >-
108
+ Checks indentation of method calls with the dot operator
109
+ that span more than one line.
110
+ Enabled: true
111
+ EnforcedStyle: indented
112
+
113
+ Layout/SpaceBeforeBlockBraces:
114
+ Description: >-
115
+ Checks that block braces have or don't have a space before
116
+ the opening brace depending on configuration.
117
+ Enabled: false
118
+
119
+ # Naming
4
120
 
5
- Style/AccessorMethodName:
121
+ Naming/AccessorMethodName:
6
122
  Description: Check the naming of accessor methods for get_/set_.
7
123
  Enabled: false
8
124
 
125
+ Naming/AsciiIdentifiers:
126
+ Description: 'Use only ascii symbols in identifiers.'
127
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
128
+ Enabled: true
129
+
130
+ Naming/BinaryOperatorParameterName:
131
+ Description: 'When defining binary operators, name the argument other.'
132
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
133
+ Enabled: false
134
+
135
+ Naming/FileName:
136
+ Description: 'Use snake_case for source file names.'
137
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
138
+ Enabled: true
139
+
140
+ Naming/PredicateName:
141
+ Description: 'Check the names of predicate methods.'
142
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
143
+ NamePrefixBlacklist:
144
+ - is_
145
+ Exclude:
146
+ - spec/**/*
147
+
148
+ # Style
149
+
9
150
  Style/Alias:
10
151
  Description: 'Use alias_method instead of alias.'
11
152
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
@@ -21,21 +162,11 @@ Style/AsciiComments:
21
162
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
22
163
  Enabled: true
23
164
 
24
- Style/AsciiIdentifiers:
25
- Description: 'Use only ascii symbols in identifiers.'
26
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
27
- Enabled: true
28
-
29
165
  Style/Attr:
30
166
  Description: 'Checks for uses of Module#attr.'
31
167
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr'
32
168
  Enabled: true
33
169
 
34
- Metrics/BlockNesting:
35
- Description: 'Avoid excessive block nesting'
36
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
37
- Enabled: true
38
-
39
170
  Style/CaseEquality:
40
171
  Description: 'Avoid explicit use of the case equality operator(===).'
41
172
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
@@ -51,14 +182,6 @@ Style/ClassAndModuleChildren:
51
182
  Enabled: true
52
183
  EnforcedStyle: nested
53
184
 
54
- Metrics/ClassLength:
55
- Description: 'Avoid classes longer than 100 lines of code.'
56
- Enabled: false
57
-
58
- Metrics/ModuleLength:
59
- Description: 'Avoid modules longer than 100 lines of code.'
60
- Enabled: false
61
-
62
185
  Style/ClassVars:
63
186
  Description: 'Avoid the use of class variables.'
64
187
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
@@ -67,7 +190,7 @@ Style/ClassVars:
67
190
  Style/CollectionMethods:
68
191
  Enabled: true
69
192
  PreferredMethods:
70
- find: find
193
+ detect: find
71
194
  inject: reduce
72
195
  collect: map
73
196
  find_all: select
@@ -77,39 +200,13 @@ Style/ColonMethodCall:
77
200
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#double-colons'
78
201
  Enabled: true
79
202
 
80
- Style/MutableConstant:
81
- Description: 'Avoids assignment of mutable literals to constants..'
82
- StyleGuide: 'http://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Style/MutableConstant'
83
- Enabled: false
84
-
85
203
  Style/CommentAnnotation:
86
204
  Description: >-
87
- Checks formatting of special comments
88
- (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
205
+ Checks formatting of special comments
206
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
89
207
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
90
208
  Enabled: false
91
209
 
92
- Metrics/AbcSize:
93
- Description: >-
94
- A calculated magnitude based on number of assignments,
95
- branches, and conditions.
96
- Enabled: false
97
-
98
- Metrics/CyclomaticComplexity:
99
- Description: >-
100
- A complexity metric that is strongly correlated to the number
101
- of test cases needed to validate a method.
102
- Enabled: false
103
-
104
- Rails/Delegate:
105
- Description: 'Prefer delegate method for delegations.'
106
- Enabled: false
107
-
108
- Style/PreferredHashMethods:
109
- Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
110
- StyleGuide: '#hash-key'
111
- Enabled: true
112
-
113
210
  Style/Documentation:
114
211
  Description: 'Document classes and non-namespace modules.'
115
212
  Enabled: false
@@ -128,6 +225,9 @@ Style/EmptyLiteral:
128
225
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#literal-array-hash'
129
226
  Enabled: true
130
227
 
228
+ Style/EmptyMethod:
229
+ EnforcedStyle: expanded
230
+
131
231
  # Checks whether the source file has a utf-8 encoding comment or not
132
232
  # AutoCorrectEncodingComment must match the regex
133
233
  # /#.*coding\s?[:=]\s?(?:UTF|utf)-8/
@@ -139,22 +239,12 @@ Style/EvenOdd:
139
239
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
140
240
  Enabled: true
141
241
 
142
- Style/FileName:
143
- Description: 'Use snake_case for source file names.'
144
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
145
- Enabled: true
146
-
147
242
  Style/FrozenStringLiteralComment:
148
243
  Description: >-
149
244
  Add the frozen_string_literal comment to the top of files
150
245
  to help transition from Ruby 2.3.0 to Ruby 3.0.
151
246
  Enabled: false
152
247
 
153
- Style/FlipFlop:
154
- Description: 'Checks for flip flops'
155
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
156
- Enabled: true
157
-
158
248
  Style/FormatString:
159
249
  Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
160
250
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#sprintf'
@@ -173,8 +263,8 @@ Style/GuardClause:
173
263
 
174
264
  Style/IfUnlessModifier:
175
265
  Description: >-
176
- Favor modifier if/unless usage when you have a
177
- single-line body.
266
+ Favor modifier if/unless usage when you have a
267
+ single-line body.
178
268
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#if-as-a-modifier'
179
269
  Enabled: true
180
270
 
@@ -199,20 +289,15 @@ Style/LambdaCall:
199
289
 
200
290
  Style/LineEndConcatenation:
201
291
  Description: >-
202
- Use \ instead of + or << to concatenate two string literals at
203
- line end.
292
+ Use \ instead of + or << to concatenate two string literals at
293
+ line end.
204
294
  Enabled: true
205
295
 
206
- Metrics/LineLength:
207
- Description: 'Limit lines to 80 characters.'
208
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
209
- Max: 80
210
- Enabled: false
211
-
212
- Metrics/MethodLength:
213
- Description: 'Avoid methods longer than 10 lines of code.'
214
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
215
- Enabled: false
296
+ Style/MixinUsage:
297
+ Description: 'Checks that `include` statements appaear inside classes.'
298
+ Enabled: true
299
+ Exclude:
300
+ - bin/*
216
301
 
217
302
  Style/ModuleFunction:
218
303
  Description: 'Checks for usage of `extend self` in modules.'
@@ -224,10 +309,15 @@ Style/MultilineBlockChain:
224
309
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
225
310
  Enabled: false
226
311
 
312
+ Style/MutableConstant:
313
+ Description: 'Avoids assignment of mutable literals to constants..'
314
+ StyleGuide: 'http://www.rubydoc.info/github/bbatsov/RuboCop/RuboCop/Cop/Style/MutableConstant'
315
+ Enabled: true
316
+
227
317
  Style/NegatedIf:
228
318
  Description: >-
229
- Favor unless over if for negative conditions
230
- (or control flow or).
319
+ Favor unless over if for negative conditions
320
+ (or control flow or).
231
321
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#unless-for-negatives'
232
322
  Enabled: true
233
323
 
@@ -253,28 +343,18 @@ Style/Not:
253
343
 
254
344
  Style/NumericLiterals:
255
345
  Description: >-
256
- Add underscores to large numeric literals to improve their
257
- readability.
346
+ Add underscores to large numeric literals to improve their
347
+ readability.
258
348
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#underscores-in-numerics'
259
- Enabled: true
349
+ Enabled: false
260
350
 
261
351
  Style/OneLineConditional:
262
352
  Description: >-
263
- Favor the ternary operator(?:) over
264
- if/then/else/end constructs.
353
+ Favor the ternary operator(?:) over
354
+ if/then/else/end constructs.
265
355
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
266
356
  Enabled: true
267
357
 
268
- Style/OpMethod:
269
- Description: 'When defining binary operators, name the argument other.'
270
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
271
- Enabled: false
272
-
273
- Metrics/ParameterLists:
274
- Description: 'Avoid parameter lists longer than three or four parameters.'
275
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
276
- Enabled: true
277
-
278
358
  Style/PercentLiteralDelimiters:
279
359
  Description: 'Use `%`-literal delimiters consistently'
280
360
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-literal-braces'
@@ -285,13 +365,10 @@ Style/PerlBackrefs:
285
365
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
286
366
  Enabled: true
287
367
 
288
- Style/PredicateName:
289
- Description: 'Check the names of predicate methods.'
290
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
291
- NamePrefixBlacklist:
292
- - is_
293
- Exclude:
294
- - spec/**/*
368
+ Style/PreferredHashMethods:
369
+ Description: 'Checks use of `has_key?` and `has_value?` Hash methods.'
370
+ StyleGuide: '#hash-key'
371
+ Enabled: true
295
372
 
296
373
  Style/Proc:
297
374
  Description: 'Use proc instead of Proc.new.'
@@ -308,10 +385,17 @@ Style/RegexpLiteral:
308
385
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
309
386
  Enabled: true
310
387
 
388
+ Style/Sample:
389
+ Description: >-
390
+ Use `sample` instead of `shuffle.first`,
391
+ `shuffle.last`, and `shuffle[Fixnum]`.
392
+ Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
393
+ Enabled: true
394
+
311
395
  Style/SelfAssignment:
312
396
  Description: >-
313
- Checks for places where self-assignment shorthand should have
314
- been used.
397
+ Checks for places where self-assignment shorthand should have
398
+ been used.
315
399
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#self-assignment'
316
400
  Enabled: true
317
401
 
@@ -344,15 +428,21 @@ Style/StringLiterals:
344
428
  Style/TrailingCommaInArguments:
345
429
  Description: 'Checks for trailing comma in argument lists.'
346
430
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
347
- EnforcedStyleForMultiline: comma
431
+ EnforcedStyleForMultiline: no_comma
348
432
  Enabled: true
349
433
 
350
- Style/TrailingCommaInLiteral:
351
- Description: 'Checks for trailing comma in array and hash literals.'
434
+ Style/TrailingCommaInArrayLiteral:
435
+ Description: 'Checks for trailing comma in array literals.'
352
436
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
353
- EnforcedStyleForMultiline: comma
437
+ EnforcedStyleForMultiline: no_comma
354
438
  Enabled: false
355
439
 
440
+ Style/TrailingCommaInHashLiteral:
441
+ Description: 'Checks for trailing comma in hash literals.'
442
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
443
+ EnforcedStyleForMultiline: no_comma
444
+ Enabled: true
445
+
356
446
  Style/TrivialAccessors:
357
447
  Description: 'Prefer attr_* methods to trivial readers/writers.'
358
448
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#attr_family'
@@ -360,8 +450,8 @@ Style/TrivialAccessors:
360
450
 
361
451
  Style/VariableInterpolation:
362
452
  Description: >-
363
- Don't interpolate global, instance and class variables
364
- directly in strings.
453
+ Don't interpolate global, instance and class variables
454
+ directly in strings.
365
455
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
366
456
  Enabled: true
367
457
 
@@ -372,32 +462,97 @@ Style/WhenThen:
372
462
 
373
463
  Style/WhileUntilModifier:
374
464
  Description: >-
375
- Favor modifier while/until usage when you have a
376
- single-line body.
465
+ Favor modifier while/until usage when you have a
466
+ single-line body.
377
467
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#while-as-a-modifier'
378
468
  Enabled: true
379
469
 
470
+ Style/SymbolArray:
471
+ MinSize: 4
472
+
380
473
  Style/WordArray:
381
474
  Description: 'Use %w or %W for arrays of words.'
382
475
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
383
476
  Enabled: true
477
+ MinSize: 4
384
478
 
385
- Style/SymbolArray:
386
- MinSize: 3
479
+ # Metrics
480
+
481
+ Metrics/AbcSize:
482
+ Description: >-
483
+ A calculated magnitude based on number of assignments,
484
+ branches, and conditions.
485
+ Enabled: false
486
+
487
+ Metrics/BlockLength:
488
+ Enabled: true
489
+ Exclude:
490
+ - config/environments/*
491
+ ExcludedMethods:
492
+ - context
493
+ - define
494
+ - describe
495
+ - draw
496
+ - factory
497
+ - guard
498
+ - included
499
+ - namespace
500
+ - trait
501
+
502
+
503
+ Metrics/BlockNesting:
504
+ Description: 'Avoid excessive block nesting'
505
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#three-is-the-number-thou-shalt-count'
506
+ Enabled: true
507
+
508
+ Metrics/ClassLength:
509
+ Description: 'Avoid classes longer than 100 lines of code.'
510
+ Enabled: false
511
+
512
+ Metrics/CyclomaticComplexity:
513
+ Description: >-
514
+ A complexity metric that is strongly correlated to the number
515
+ of test cases needed to validate a method.
516
+ Enabled: false
517
+
518
+ Metrics/LineLength:
519
+ Description: 'Limit lines to 80 characters.'
520
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
521
+ Max: 80
522
+ Enabled: false
523
+
524
+ Metrics/MethodLength:
525
+ Description: 'Avoid methods longer than 10 lines of code.'
526
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#short-methods'
527
+ Enabled: false
528
+
529
+ Metrics/ModuleLength:
530
+ Description: 'Avoid modules longer than 100 lines of code.'
531
+ Enabled: false
532
+
533
+ Metrics/ParameterLists:
534
+ Description: 'Avoid parameter lists longer than three or four parameters.'
535
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#too-many-params'
536
+ Enabled: true
387
537
 
388
538
  # Lint
389
539
 
540
+ Lint/AmbiguousBlockAssociation:
541
+ Enabled: true
542
+ Exclude:
543
+ - spec/**/*
544
+
390
545
  Lint/AmbiguousOperator:
391
546
  Description: >-
392
- Checks for ambiguous operators in the first argument of a
393
- method invocation without parentheses.
547
+ Checks for ambiguous operators in the first argument of a
548
+ method invocation without parentheses.
394
549
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-as-args'
395
550
  Enabled: true
396
551
 
397
552
  Lint/AmbiguousRegexpLiteral:
398
553
  Description: >-
399
- Checks for ambiguous regexp literals in the first argument of
400
- a method invocation without parenthesis.
554
+ Checks for ambiguous regexp literals in the first argument of
555
+ a method invocation without parenthesis.
401
556
  Enabled: false
402
557
 
403
558
  Lint/AssignmentInCondition:
@@ -409,13 +564,6 @@ Lint/CircularArgumentReference:
409
564
  Description: "Don't refer to the keyword argument in the default value."
410
565
  Enabled: false
411
566
 
412
- Lint/ConditionPosition:
413
- Description: >-
414
- Checks for condition placed in a confusing position relative to
415
- the keyword.
416
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#same-line-condition'
417
- Enabled: true
418
-
419
567
  Lint/DeprecatedClassMethods:
420
568
  Description: 'Check for deprecated class method calls.'
421
569
  Enabled: true
@@ -432,6 +580,11 @@ Lint/ElseLayout:
432
580
  Description: 'Check for odd code arrangement in an else block.'
433
581
  Enabled: true
434
582
 
583
+ Lint/FlipFlop:
584
+ Description: 'Checks for flip flops'
585
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-flip-flops'
586
+ Enabled: true
587
+
435
588
  Lint/FormatParameterMismatch:
436
589
  Description: 'The number of parameters to format/sprint must match the fields.'
437
590
  Enabled: true
@@ -441,13 +594,7 @@ Lint/HandleExceptions:
441
594
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
442
595
  Enabled: true
443
596
 
444
- Lint/InvalidCharacterLiteral:
445
- Description: >-
446
- Checks for invalid character literals with a non-escaped
447
- whitespace character.
448
- Enabled: false
449
-
450
- Lint/LiteralInCondition:
597
+ Lint/LiteralAsCondition:
451
598
  Description: 'Checks of literals used in conditions.'
452
599
  Enabled: false
453
600
 
@@ -457,8 +604,8 @@ Lint/LiteralInInterpolation:
457
604
 
458
605
  Lint/Loop:
459
606
  Description: >-
460
- Use Kernel#loop with break rather than begin/end/until or
461
- begin/end/while for post-loop tests.
607
+ Use Kernel#loop with break rather than begin/end/until or
608
+ begin/end/while for post-loop tests.
462
609
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#loop-with-break'
463
610
  Enabled: false
464
611
 
@@ -473,28 +620,21 @@ Lint/NonLocalExitFromIterator:
473
620
 
474
621
  Lint/ParenthesesAsGroupedExpression:
475
622
  Description: >-
476
- Checks for method calls with a space before the opening
477
- parenthesis.
623
+ Checks for method calls with a space before the opening
624
+ parenthesis.
478
625
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
479
626
  Enabled: true
480
627
 
481
628
  Lint/RequireParentheses:
482
629
  Description: >-
483
- Use parentheses in the method call to avoid confusion
484
- about precedence.
630
+ Use parentheses in the method call to avoid confusion
631
+ about precedence.
485
632
  Enabled: true
486
633
 
487
634
  Lint/UnderscorePrefixedVariableName:
488
635
  Description: 'Do not use prefix `_` for a variable that is used.'
489
636
  Enabled: false
490
637
 
491
- Lint/UnneededDisable:
492
- Description: >-
493
- Checks for rubocop:disable comments that can be removed.
494
- Note: this cop is not disabled when disabling all cops.
495
- It must be explicitly disabled.
496
- Enabled: false
497
-
498
638
  Lint/Void:
499
639
  Description: 'Possible use of operator/literal/variable in void context.'
500
640
  Enabled: false
@@ -503,29 +643,29 @@ Lint/Void:
503
643
 
504
644
  Performance/CaseWhenSplat:
505
645
  Description: >-
506
- Place `when` conditions that use splat at the end
507
- of the list of `when` branches.
646
+ Place `when` conditions that use splat at the end
647
+ of the list of `when` branches.
508
648
  Enabled: false
509
649
 
510
650
  Performance/Count:
511
651
  Description: >-
512
- Use `count` instead of `select...size`, `reject...size`,
513
- `select...count`, `reject...count`, `select...length`,
514
- and `reject...length`.
652
+ Use `count` instead of `select...size`, `reject...size`,
653
+ `select...count`, `reject...count`, `select...length`,
654
+ and `reject...length`.
515
655
  Enabled: true
516
656
 
517
657
  Performance/Detect:
518
658
  Description: >-
519
- Use `detect` instead of `select.first`, `find_all.first`,
520
- `select.last`, and `find_all.last`.
659
+ Use `detect` instead of `select.first`, `find_all.first`,
660
+ `select.last`, and `find_all.last`.
521
661
  Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerabledetect-vs-enumerableselectfirst-code'
522
- Enabled: false
662
+ Enabled: true
523
663
 
524
664
  Performance/FlatMap:
525
665
  Description: >-
526
- Use `Enumerable#flat_map`
527
- instead of `Enumerable#map...Array#flatten(1)`
528
- or `Enumberable#collect..Array#flatten(1)`
666
+ Use `Enumerable#flat_map`
667
+ instead of `Enumerable#map...Array#flatten(1)`
668
+ or `Enumberable#collect..Array#flatten(1)`
529
669
  Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablemaparrayflatten-vs-enumerableflat_map-code'
530
670
  Enabled: true
531
671
 
@@ -534,25 +674,18 @@ Performance/ReverseEach:
534
674
  Reference: 'https://github.com/JuanitoFatas/fast-ruby#enumerablereverseeach-vs-enumerablereverse_each-code'
535
675
  Enabled: true
536
676
 
537
- Performance/Sample:
538
- Description: >-
539
- Use `sample` instead of `shuffle.first`,
540
- `shuffle.last`, and `shuffle[Fixnum]`.
541
- Reference: 'https://github.com/JuanitoFatas/fast-ruby#arrayshufflefirst-vs-arraysample-code'
542
- Enabled: true
543
-
544
677
  Performance/Size:
545
678
  Description: >-
546
- Use `size` instead of `count` for counting
547
- the number of elements in `Array` and `Hash`.
679
+ Use `size` instead of `count` for counting
680
+ the number of elements in `Array` and `Hash`.
548
681
  Reference: 'https://github.com/JuanitoFatas/fast-ruby#arraycount-vs-arraysize-code'
549
682
  Enabled: true
550
683
 
551
684
  Performance/StringReplacement:
552
685
  Description: >-
553
- Use `tr` instead of `gsub` when you are replacing the same
554
- number of characters. Use `delete` instead of `gsub` when
555
- you are deleting characters.
686
+ Use `tr` instead of `gsub` when you are replacing the same
687
+ number of characters. Use `delete` instead of `gsub` when
688
+ you are deleting characters.
556
689
  Reference: 'https://github.com/JuanitoFatas/fast-ruby#stringgsub-vs-stringtr-code'
557
690
  Enabled: true
558
691
 
@@ -564,10 +697,18 @@ Rails/ActionFilter:
564
697
 
565
698
  Rails/Date:
566
699
  Description: >-
567
- Checks the correct usage of date aware methods,
568
- such as Date.today, Date.current etc.
700
+ Checks the correct usage of date aware methods,
701
+ such as Date.today, Date.current etc.
569
702
  Enabled: true
570
703
 
704
+ Rails/Delegate:
705
+ Description: 'Prefer delegate method for delegations.'
706
+ Enabled: false
707
+
708
+ Rails/Exit:
709
+ Exclude:
710
+ - lib/generators/disco_app/install/templates/spec/rails_helper.rb
711
+
571
712
  Rails/FindBy:
572
713
  Description: 'Prefer find_by over where.first.'
573
714
  Enabled: true
@@ -586,8 +727,8 @@ Rails/Output:
586
727
 
587
728
  Rails/ReadWriteAttribute:
588
729
  Description: >-
589
- Checks for read_attribute(:attr) and
590
- write_attribute(:attr, val).
730
+ Checks for read_attribute(:attr) and
731
+ write_attribute(:attr, val).
591
732
  Enabled: false
592
733
 
593
734
  Rails/ScopeArgs:
@@ -600,61 +741,18 @@ Rails/TimeZone:
600
741
  Reference: 'http://danilenko.org/2012/7/6/rails_timezones'
601
742
  Enabled: true
602
743
 
744
+ Rails/UnknownEnv:
745
+ Environments:
746
+ - development
747
+ - production
748
+ - staging
749
+ - test
750
+
603
751
  Rails/Validation:
604
752
  Description: 'Use validates :attribute, hash of validations.'
605
753
  Enabled: false
606
754
 
607
- # Layout
608
-
609
- Layout/EmptyLinesAroundClassBody:
610
- Enabled: true
611
- EnforcedStyle: empty_lines
612
-
613
- Layout/AlignParameters:
614
- Description: 'Here we check if the parameters on a multi-line method call or definition are aligned.'
615
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-double-indent'
616
- Enabled: true
617
-
618
- Layout/DotPosition:
619
- Description: 'Checks the position of the dot in multi-line method calls.'
620
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
621
- EnforcedStyle: leading
622
-
623
- Layout/ExtraSpacing:
624
- Description: 'Do not use unnecessary spacing.'
625
- Enabled: true
626
-
627
- Layout/MultilineOperationIndentation:
628
- Description: >-
629
- Checks indentation of binary operations that span more than
630
- one line.
631
- Enabled: true
632
- EnforcedStyle: indented
633
-
634
- Layout/MultilineMethodCallIndentation:
635
- Description: >-
636
- Checks indentation of method calls with the dot operator
637
- that span more than one line.
638
- Enabled: true
639
- EnforcedStyle: indented
640
-
641
- Layout/InitialIndentation:
642
- Description: >-
643
- Checks the indentation of the first non-blank non-comment line in a file.
644
- Enabled: false
645
-
646
- Layout/IndentHash:
647
- Enabled: true
648
- EnforcedStyle: consistent
649
-
650
- Layout/AccessModifierIndentation:
651
- Enabled: true
652
-
653
- Layout/IndentationConsistency:
654
- EnforcedStyle: rails
655
- Enabled: true
656
-
657
755
  # Bundler
658
756
 
659
757
  Bundler/OrderedGems:
660
- Enabled: false
758
+ Enabled: true