neeto-commons-backend 1.0.89

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. checksums.yaml +7 -0
  2. data/.eslintignore +14 -0
  3. data/.eslintrc.js +87 -0
  4. data/.husky/helpers/verify_neeto_audit.sh +18 -0
  5. data/.husky/pre-push +5 -0
  6. data/.neetoci/neetoci.yml +26 -0
  7. data/.prettierrc.js +15 -0
  8. data/.rubocop.yml +626 -0
  9. data/.ruby-version +1 -0
  10. data/.semaphore/semaphore.yml +32 -0
  11. data/.semaphore/staging-deploy.yml +23 -0
  12. data/Gemfile +92 -0
  13. data/Gemfile.lock +461 -0
  14. data/README.md +286 -0
  15. data/Rakefile +18 -0
  16. data/app/controllers/api/base_controller.rb +6 -0
  17. data/app/controllers/neeto_commons_backend/api/base_controller.rb +9 -0
  18. data/app/controllers/neeto_commons_backend/api/direct_uploads_controller.rb +57 -0
  19. data/app/controllers/neeto_commons_backend/app_versions_controller.rb +20 -0
  20. data/app/controllers/neeto_commons_backend/failures_controller.rb +29 -0
  21. data/app/controllers/neeto_commons_backend/health_check_controller.rb +9 -0
  22. data/app/controllers/neeto_commons_backend/well_knowns_controller.rb +13 -0
  23. data/app/mailers/neeto_commons_backend/application_mailer.rb +22 -0
  24. data/app/models/concerns/neeto_commons_backend/sluggable.rb +27 -0
  25. data/app/models/concerns/neeto_commons_backend/soft_deletable.rb +20 -0
  26. data/app/services/neeto_commons_backend/sample_data/common/admin_service.rb +26 -0
  27. data/app/services/neeto_commons_backend/sample_data/common/app_organization_service.rb +11 -0
  28. data/app/services/neeto_commons_backend/sample_data/common/base.rb +49 -0
  29. data/app/services/neeto_commons_backend/sample_data/common/database_cleanup_service.rb +13 -0
  30. data/app/services/neeto_commons_backend/sample_data/common/loader_service.rb +30 -0
  31. data/app/services/neeto_commons_backend/sample_data/common/neeto_team_members_service.rb +16 -0
  32. data/app/services/neeto_commons_backend/sample_data/common/organization_base.rb +36 -0
  33. data/app/services/neeto_commons_backend/sample_data/common/organization_service.rb +11 -0
  34. data/app/services/neeto_commons_backend/source_map_publish_service.rb +47 -0
  35. data/app/views/neeto_commons_backend/failures/show.html.erb +1 -0
  36. data/app/views/shared/_common.html.erb +8 -0
  37. data/app/views/shared/_neeto_engineering_replay_widget.html.erb +31 -0
  38. data/app/views/shared/_neeto_widget.html.erb +30 -0
  39. data/app/workers/neeto_commons_backend/base_workers/auth.rb +9 -0
  40. data/app/workers/neeto_commons_backend/base_workers/base.rb +52 -0
  41. data/app/workers/neeto_commons_backend/base_workers/default.rb +8 -0
  42. data/app/workers/neeto_commons_backend/base_workers/low.rb +9 -0
  43. data/app/workers/neeto_commons_backend/base_workers/urgent.rb +9 -0
  44. data/app/workers/neeto_commons_backend/purge_unattached_files_worker.rb +11 -0
  45. data/babel.config.js +47 -0
  46. data/bin/console +15 -0
  47. data/bin/rails +16 -0
  48. data/bin/setup +8 -0
  49. data/config/brakeman.ignore +52 -0
  50. data/config/locales/en.yml +5 -0
  51. data/docs/carriers/README.md +5 -0
  52. data/docs/controller_concerns/README.md +34 -0
  53. data/docs/controllers/README.md +27 -0
  54. data/docs/gemfiles/README.md +5 -0
  55. data/docs/helpers/README.md +21 -0
  56. data/docs/mailers/README.md +5 -0
  57. data/docs/model_concerns/README.md +39 -0
  58. data/docs/routes/README.md +44 -0
  59. data/docs/scripts/README.md +5 -0
  60. data/docs/semaphore/README.md +5 -0
  61. data/docs/services/README.md +23 -0
  62. data/docs/workers/README.md +32 -0
  63. data/docs/workflows/README.md +9 -0
  64. data/lib/Rakefile +4 -0
  65. data/lib/neeto-commons-backend.rb +62 -0
  66. data/lib/neeto_commons_backend/.circleci/config.yml +84 -0
  67. data/lib/neeto_commons_backend/.slugignore +17 -0
  68. data/lib/neeto_commons_backend/carriers/app_url_carrier.rb +71 -0
  69. data/lib/neeto_commons_backend/common_files/.bundler-version +1 -0
  70. data/lib/neeto_commons_backend/common_files/.editorconfig +10 -0
  71. data/lib/neeto_commons_backend/common_files/.erb-lint.yml +20 -0
  72. data/lib/neeto_commons_backend/common_files/.eslintignore +14 -0
  73. data/lib/neeto_commons_backend/common_files/.eslintrc.js +2 -0
  74. data/lib/neeto_commons_backend/common_files/.gitignore +132 -0
  75. data/lib/neeto_commons_backend/common_files/.husky/helpers/lint_staged.sh +5 -0
  76. data/lib/neeto_commons_backend/common_files/.husky/helpers/prevent_conflict_markers.sh +35 -0
  77. data/lib/neeto_commons_backend/common_files/.husky/helpers/prevent_pushing_to_main.sh +24 -0
  78. data/lib/neeto_commons_backend/common_files/.husky/helpers/verify_neeto_audit.sh +17 -0
  79. data/lib/neeto_commons_backend/common_files/.husky/pre-commit +9 -0
  80. data/lib/neeto_commons_backend/common_files/.husky/pre-push +7 -0
  81. data/lib/neeto_commons_backend/common_files/.node-version +1 -0
  82. data/lib/neeto_commons_backend/common_files/.nvmrc +1 -0
  83. data/lib/neeto_commons_backend/common_files/.postcssrc.yml +6 -0
  84. data/lib/neeto_commons_backend/common_files/.prettierrc.js +1 -0
  85. data/lib/neeto_commons_backend/common_files/.rubocop.yml +625 -0
  86. data/lib/neeto_commons_backend/common_files/.ruby-version +1 -0
  87. data/lib/neeto_commons_backend/common_files/.semaphore/commands/run_eslint_on_modified_files.sh +5 -0
  88. data/lib/neeto_commons_backend/common_files/.vscode/extensions.json +10 -0
  89. data/lib/neeto_commons_backend/common_files/.vscode/settings.json +21 -0
  90. data/lib/neeto_commons_backend/common_files/Dockerfile.dev +50 -0
  91. data/lib/neeto_commons_backend/common_files/app/javascript/jsconfig.json +62 -0
  92. data/lib/neeto_commons_backend/common_files/app/javascript/src/types.d.ts +36 -0
  93. data/lib/neeto_commons_backend/common_files/babel.config.js +1 -0
  94. data/lib/neeto_commons_backend/common_files/bin/bundle +5 -0
  95. data/lib/neeto_commons_backend/common_files/bin/rails +6 -0
  96. data/lib/neeto_commons_backend/common_files/bin/rake +6 -0
  97. data/lib/neeto_commons_backend/common_files/bin/setup +40 -0
  98. data/lib/neeto_commons_backend/common_files/bin/update +33 -0
  99. data/lib/neeto_commons_backend/common_files/bin/webpacker +17 -0
  100. data/lib/neeto_commons_backend/common_files/bin/webpacker-dev-server +17 -0
  101. data/lib/neeto_commons_backend/common_files/bin/yarn +19 -0
  102. data/lib/neeto_commons_backend/common_files/cypress-tests/.eslintrc.js +57 -0
  103. data/lib/neeto_commons_backend/common_files/cypress-tests/cypress/plugins/index.js +63 -0
  104. data/lib/neeto_commons_backend/common_files/github/workflows/auto_update_prs_with_latest_master.yml +21 -0
  105. data/lib/neeto_commons_backend/common_files/neeto_gems/github/workflows/bump_version.yml +51 -0
  106. data/lib/neeto_commons_backend/common_files/newrelic.yml +31 -0
  107. data/lib/neeto_commons_backend/common_files/package-common.json +119 -0
  108. data/lib/neeto_commons_backend/common_files/roles.yml +34 -0
  109. data/lib/neeto_commons_backend/common_files/semaphore/semaphore.yml +58 -0
  110. data/lib/neeto_commons_backend/common_files/sitemap.xml +15 -0
  111. data/lib/neeto_commons_backend/common_files/test/support/assertion_support.rb +9 -0
  112. data/lib/neeto_commons_backend/common_files/webpacker.yml +90 -0
  113. data/lib/neeto_commons_backend/config/secrets.yml +169 -0
  114. data/lib/neeto_commons_backend/controllers/concerns/api_exceptions.rb +83 -0
  115. data/lib/neeto_commons_backend/controllers/concerns/api_helpers.rb +9 -0
  116. data/lib/neeto_commons_backend/controllers/concerns/api_responders.rb +33 -0
  117. data/lib/neeto_commons_backend/controllers/concerns/authenticatable.rb +51 -0
  118. data/lib/neeto_commons_backend/controllers/concerns/honeybadger_context.rb +17 -0
  119. data/lib/neeto_commons_backend/controllers/concerns/store_user_location.rb +23 -0
  120. data/lib/neeto_commons_backend/cypress/cypress.review.json +13 -0
  121. data/lib/neeto_commons_backend/cypress/jsconfig.json +17 -0
  122. data/lib/neeto_commons_backend/cypress/package.json +51 -0
  123. data/lib/neeto_commons_backend/cypress/resolve.js +16 -0
  124. data/lib/neeto_commons_backend/cypress/webpack.config.js +21 -0
  125. data/lib/neeto_commons_backend/engine.rb +6 -0
  126. data/lib/neeto_commons_backend/environments/application.rb +33 -0
  127. data/lib/neeto_commons_backend/environments/development.rb +46 -0
  128. data/lib/neeto_commons_backend/environments/heroku.rb +35 -0
  129. data/lib/neeto_commons_backend/environments/production.rb +45 -0
  130. data/lib/neeto_commons_backend/environments/staging.rb +43 -0
  131. data/lib/neeto_commons_backend/environments/test.rb +29 -0
  132. data/lib/neeto_commons_backend/gemfiles/Gemfile.common.rb +240 -0
  133. data/lib/neeto_commons_backend/helpers/auth_server_api.rb +92 -0
  134. data/lib/neeto_commons_backend/helpers/favicon.rb +18 -0
  135. data/lib/neeto_commons_backend/helpers/global_props.rb +76 -0
  136. data/lib/neeto_commons_backend/helpers/neeto_widget_helper.rb +19 -0
  137. data/lib/neeto_commons_backend/helpers/test_helper.rb +90 -0
  138. data/lib/neeto_commons_backend/initializers/_enable_extension_hack.rb +32 -0
  139. data/lib/neeto_commons_backend/initializers/assets.rb +11 -0
  140. data/lib/neeto_commons_backend/initializers/bullet.rb +26 -0
  141. data/lib/neeto_commons_backend/initializers/cache_store.rb +27 -0
  142. data/lib/neeto_commons_backend/initializers/common.rb +33 -0
  143. data/lib/neeto_commons_backend/initializers/cookies_serializer.rb +11 -0
  144. data/lib/neeto_commons_backend/initializers/cors.rb +16 -0
  145. data/lib/neeto_commons_backend/initializers/database_cleaner.rb +11 -0
  146. data/lib/neeto_commons_backend/initializers/datetime.rb +14 -0
  147. data/lib/neeto_commons_backend/initializers/email_setup.rb +25 -0
  148. data/lib/neeto_commons_backend/initializers/filter_parameter_logging.rb +11 -0
  149. data/lib/neeto_commons_backend/initializers/honeybadger.rb +23 -0
  150. data/lib/neeto_commons_backend/initializers/kaminari_config.rb +13 -0
  151. data/lib/neeto_commons_backend/initializers/mime_types.rb +12 -0
  152. data/lib/neeto_commons_backend/initializers/mini_profiler.rb +14 -0
  153. data/lib/neeto_commons_backend/initializers/neeto_email_prefixer.rb +40 -0
  154. data/lib/neeto_commons_backend/initializers/neeto_mail_interceptor.rb +35 -0
  155. data/lib/neeto_commons_backend/initializers/post_compilation.rb +17 -0
  156. data/lib/neeto_commons_backend/initializers/rack_attack.rb +38 -0
  157. data/lib/neeto_commons_backend/initializers/rack_deflater.rb +11 -0
  158. data/lib/neeto_commons_backend/initializers/rack_timeout.rb +15 -0
  159. data/lib/neeto_commons_backend/initializers/rails_email_preview.rb +21 -0
  160. data/lib/neeto_commons_backend/initializers/redis_client_patch.rb +18 -0
  161. data/lib/neeto_commons_backend/initializers/remove_backtrace_silencers.rb +11 -0
  162. data/lib/neeto_commons_backend/initializers/session_store.rb +21 -0
  163. data/lib/neeto_commons_backend/initializers/shared_redis.rb +13 -0
  164. data/lib/neeto_commons_backend/initializers/sidekiq.rb +46 -0
  165. data/lib/neeto_commons_backend/initializers/strong_migrations.rb +13 -0
  166. data/lib/neeto_commons_backend/initializers/wrap_parameters.rb +13 -0
  167. data/lib/neeto_commons_backend/models/concerns/devise_validator.rb +19 -0
  168. data/lib/neeto_commons_backend/railtie.rb +20 -0
  169. data/lib/neeto_commons_backend/routes/catch_all.rb +9 -0
  170. data/lib/neeto_commons_backend/routes/devise.rb +16 -0
  171. data/lib/neeto_commons_backend/routes/direct_uploads.rb +9 -0
  172. data/lib/neeto_commons_backend/routes/draw.rb +29 -0
  173. data/lib/neeto_commons_backend/routes/email_previews.rb +5 -0
  174. data/lib/neeto_commons_backend/routes/errors.rb +7 -0
  175. data/lib/neeto_commons_backend/routes/health.rb +8 -0
  176. data/lib/neeto_commons_backend/routes/letter_opener.rb +5 -0
  177. data/lib/neeto_commons_backend/routes/sidekiq.rb +22 -0
  178. data/lib/neeto_commons_backend/routes/well_knowns.rb +10 -0
  179. data/lib/neeto_commons_backend/scripts/sync_with_wheel.sh +54 -0
  180. data/lib/neeto_commons_backend/secrets_management.rb +41 -0
  181. data/lib/neeto_commons_backend/services/custom_domain_service.rb +40 -0
  182. data/lib/neeto_commons_backend/tasks/assets.rake +27 -0
  183. data/lib/neeto_commons_backend/tasks/before_assets_precompile.rake +13 -0
  184. data/lib/neeto_commons_backend/tasks/simplecov_coverage.rake +25 -0
  185. data/lib/neeto_commons_backend/version.rb +5 -0
  186. data/neeto-commons-backend.gemspec +52 -0
  187. data/package.json +31 -0
  188. data/yarn.lock +2530 -0
  189. metadata +497 -0
data/.rubocop.yml ADDED
@@ -0,0 +1,626 @@
1
+ # cspell:Disable
2
+ require:
3
+ - rubocop-rails
4
+
5
+ AllCops:
6
+ TargetRubyVersion: 3.2.2
7
+ # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
8
+ # to ignore them, so only the ones explicitly set in this file are enabled.
9
+ DisabledByDefault: true
10
+ # From time to time rubocop adds new cops to say rails etc.
11
+ # So rather than disabling them it's better to enable them,
12
+ # try it out and then disable them manually one by one.
13
+ NewCops: enable
14
+ Exclude:
15
+ - "lib/neeto_commons_backend/common_files/.rubocop.yml"
16
+ - "app/javascript/**/*"
17
+ - "app/assets/**/*"
18
+ - "app/views/**/*.erb"
19
+ - "lib/tasks/**/*"
20
+ - ".vscode/**/*"
21
+ - ".husky/**/*"
22
+ - ".bundle/**/*"
23
+ - ".circleci/**/*"
24
+ - ".semaphore/**/*"
25
+ - "**/log/**/*"
26
+ - "**/public/**/*"
27
+ - "**/tmp/**/*"
28
+ - "**/templates/**/*"
29
+ - "**/vendor/**/*"
30
+ - "node_modules/**/*"
31
+ - "bin/**/*"
32
+ - "config/webpack/**/*"
33
+ - "db/schema.rb"
34
+ - "test/dummy/db/schema.rb"
35
+
36
+ # ====================================================================================================
37
+ # All access modifier related rules
38
+ # ====================================================================================================
39
+ # Add a newline before and after private keyword or other access modifiers
40
+ Layout/EmptyLinesAroundAccessModifier:
41
+ Enabled: true
42
+
43
+ # This cop checks for redundant access modifiers, including those with no code,
44
+ # those which are repeated, and leading `public` modifiers in a class or module body.
45
+ Lint/UselessAccessModifier:
46
+ Enabled: true
47
+
48
+ # Checks for debug calls
49
+ Lint/Debugger:
50
+ Enabled: true
51
+
52
+ # # bad
53
+ # class Foo
54
+ # private def bar; end
55
+ # private def baz; end
56
+ # end
57
+ # # good
58
+ # class Foo
59
+ # private
60
+ #
61
+ # def bar; end
62
+ # def baz; end
63
+ # end
64
+ Style/AccessModifierDeclarations:
65
+ Enabled: true
66
+
67
+ # # bad
68
+ # class Plumbus
69
+ # private
70
+ # def smooth; end
71
+ # end
72
+ # # good
73
+ # class Plumbus
74
+ # private
75
+ # def smooth; end
76
+ # end
77
+ Layout/AccessModifierIndentation:
78
+ Enabled: true
79
+
80
+ # ====================================================================================================
81
+ # All comment related rules
82
+ # ====================================================================================================
83
+ # Align comments with method definitions.
84
+ Layout/CommentIndentation:
85
+ Enabled: true
86
+
87
+ # Requires an empty line after frozen_string_literal: true comment
88
+ Layout/EmptyLineAfterMagicComment:
89
+ Enabled: true
90
+
91
+ # frozen_string_literal: true magic comment is required on the top of files
92
+ Style/FrozenStringLiteralComment:
93
+ Enabled: true
94
+ EnforcedStyle: always
95
+ SafeAutoCorrect: true
96
+
97
+ # ====================================================================================================
98
+ # All Class related rules
99
+ # ====================================================================================================
100
+ # Helps in brining the include statements etc to top of the class definition
101
+ Layout/ClassStructure:
102
+ Enabled: true
103
+ Description: "Enforces a canonical order of definitions within a class body."
104
+ StyleGuide: "https://github.com/rubocop/rails-style-guide#macro-style-methods"
105
+ Categories:
106
+ module_inclusions:
107
+ - include
108
+ - prepend
109
+ - extend
110
+ third_party:
111
+ - neeto_sso_track_widget_tokens
112
+ - devise
113
+ scopes:
114
+ - default_scope
115
+ - scope
116
+ attributes:
117
+ - attribute
118
+ - attr_reader
119
+ - attr_writer
120
+ - attr_accessor
121
+ enum:
122
+ - enum
123
+ store:
124
+ # https://api.rubyonrails.org/classes/ActiveRecord/Store.html
125
+ - store
126
+ associations:
127
+ - belongs_to
128
+ - has_one
129
+ - has_many
130
+ - has_and_belongs_to_many
131
+ other_macros:
132
+ - delegate
133
+ - accepts_nested_attributes_for
134
+ validations:
135
+ - validate
136
+ - validates
137
+ - validates_acceptance_of
138
+ - validates_associated
139
+ - validates_confirmation_of
140
+ - validates_exclusion_of
141
+ - validates_format_of
142
+ - validates_inclusion_of
143
+ - validates_length_of
144
+ - validates_numericality_of
145
+ - validates_presence_of
146
+ - validates_uniqueness_of
147
+ - validates_each
148
+ - validate_with
149
+ callbacks:
150
+ - before_validation
151
+ - after_validation
152
+ - before_save
153
+ - around_save
154
+ - after_save
155
+ - before_update
156
+ - around_update
157
+ - after_update
158
+ - before_create
159
+ - after_create
160
+ - before_destroy
161
+ - around_destroy
162
+ - after_destroy
163
+ - after_commit
164
+ - after_create_commit
165
+ ExpectedOrder:
166
+ - module_inclusions
167
+ - third_party
168
+ - scopes
169
+ - constants
170
+ - attributes
171
+ - enum
172
+ - store
173
+ - associations
174
+ - validations
175
+ - callbacks
176
+ - other_macros
177
+ - initializer
178
+ - public_class_methods
179
+ - public_methods
180
+ - protected_methods
181
+ - private_methods
182
+
183
+ # In a regular class definition, no empty lines around the body.
184
+ # bad
185
+ # class Foo
186
+ #
187
+ # def bar
188
+ # # ...
189
+ # end
190
+ #
191
+ # end
192
+ #
193
+ # good
194
+ # class Foo
195
+ # def bar
196
+ # # ...
197
+ # end
198
+ # end
199
+ Layout/EmptyLinesAroundClassBody:
200
+ Enabled: true
201
+
202
+ # ====================================================================================================
203
+ # All Method related rules
204
+ # ====================================================================================================
205
+ # This cop checks whether class/module/method definitions are separated by one or more empty lines.
206
+ Layout/EmptyLineBetweenDefs:
207
+ Enabled: true
208
+
209
+ # This cop checks the . position in multi-line method calls.
210
+ # The dot should be leading rather than trailing.
211
+ Layout/DotPosition:
212
+ Enabled: true
213
+ EnforcedStyle: leading
214
+
215
+ # No space in method name and the arguments
216
+ Lint/ParenthesesAsGroupedExpression:
217
+ Enabled: true
218
+
219
+ # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg,
220
+ # when a boolean operator, && or ||, is chained along with this method/argument
221
+ Lint/RequireParentheses:
222
+ Enabled: true
223
+
224
+ # avoid redundant `return` expressions
225
+ Style/RedundantReturn:
226
+ Enabled: true
227
+ AllowMultipleReturnValues: true
228
+
229
+ # Ensures that exactly one space is used between a method name and the
230
+ # first argument for method calls without parentheses
231
+ Layout/SpaceBeforeFirstArg:
232
+ Enabled: true
233
+
234
+ # Methods that doesn't take any parameters shouldn't have paranthesis in its definition
235
+ Style/DefWithParentheses:
236
+ Enabled: true
237
+
238
+ # Defining a method with parameters needs parentheses.
239
+ Style/MethodDefParentheses:
240
+ Enabled: true
241
+
242
+ # # bad
243
+ # def some_method(arg1=:default, arg2=nil, arg3=[])
244
+ # # good
245
+ # def some_method(arg1 = :default, arg2 = nil, arg3 = [])
246
+ Layout/SpaceAroundEqualsInParameterDefault:
247
+ Enabled: true
248
+
249
+ # This cop checks for a line break before the first argument in a multi-line method call.
250
+ # # bad
251
+ # method(foo, bar,
252
+ # baz)
253
+ # # good
254
+ # method(
255
+ # foo, bar,
256
+ # baz)
257
+ Layout/FirstMethodArgumentLineBreak:
258
+ Enabled: true
259
+
260
+ # Method definitions after `private` or `protected` isolated calls need one
261
+ # extra level of indentation.
262
+ Layout/IndentationConsistency:
263
+ Enabled: true
264
+ EnforcedStyle: indented_internal_methods
265
+
266
+ # This cop checks the indentation of the method name part in method calls that span more than one line.
267
+ # # bad
268
+ # while myvariable
269
+ # .instance_method_call1
270
+ # .instance_method_call2
271
+ # # do something
272
+ # end
273
+ #
274
+ # # good
275
+ # while myvariable
276
+ # .instance_method_call1
277
+ # .instance_method_call2
278
+ #
279
+ # # do something
280
+ # end
281
+ Layout/MultilineMethodCallIndentation:
282
+ Enabled: true
283
+ EnforcedStyle: indented
284
+
285
+ # This cop ensures the indentation of the first parameter in a method definition.
286
+ Layout/FirstParameterIndentation:
287
+ Enabled: true
288
+ EnforcedStyle: consistent
289
+
290
+ # When we write method arguments in next line, indent it.
291
+ Layout/FirstArgumentIndentation:
292
+ Enabled: true
293
+ EnforcedStyle: consistent
294
+
295
+ # Alignment of args from second argument onwards should be indented
296
+ # # bad
297
+ # json.extract! comment,
298
+ # :id,
299
+ # :content,
300
+ # :created_at
301
+ # # good
302
+ # json.extract! comment,
303
+ # :id,
304
+ # :content,
305
+ # :created_at
306
+ Layout/ArgumentAlignment:
307
+ Enabled: true
308
+ EnforcedStyle: with_fixed_indentation
309
+
310
+ # In a regular method definition, no empty lines around the body.
311
+ Layout/EmptyLinesAroundMethodBody:
312
+ Enabled: true
313
+
314
+ # ====================================================================================================
315
+ # All Hash related rules
316
+ # ====================================================================================================
317
+ # EnforcedColonStyle: key
318
+ # # bad
319
+ # {
320
+ # foo: bar,
321
+ # ba: baz
322
+ # }
323
+ # {
324
+ # foo: bar,
325
+ # ba: baz
326
+ # }
327
+ # # good
328
+ # {
329
+ # foo: bar,
330
+ # ba: baz
331
+ # }
332
+ # EnforcedLastArgumentHashStyle: always_inspect
333
+ # # bad
334
+ # do_something({foo: 1,
335
+ # bar: 2})
336
+ # # good
337
+ # do_something(foo: 1,
338
+ # bar: 2)
339
+ Layout/HashAlignment:
340
+ Enabled: true
341
+ EnforcedColonStyle: key
342
+ EnforcedLastArgumentHashStyle: always_inspect
343
+
344
+ # This cop checks for a line break before the first element in a multi-line hash.
345
+ # # bad
346
+ # { a: 1,
347
+ # b: 2}
348
+ # # good
349
+ # {
350
+ # a: 1,
351
+ # b: 2 }
352
+ Layout/FirstHashElementLineBreak:
353
+ Enabled: true
354
+
355
+ # When using the `new_line` style:
356
+ # The closing brace of a multi-line hash literal must be on
357
+ # the line after the last element of the hash.
358
+ Layout/MultilineHashBraceLayout:
359
+ Enabled: true
360
+ EnforcedStyle: new_line
361
+
362
+ # # bad
363
+ # hash = {
364
+ # key: :value
365
+ # }
366
+ # but_in_a_method_call({
367
+ # its_like: :this
368
+ # })
369
+ # # good
370
+ # hash = {
371
+ # key: :value
372
+ # }
373
+ # and_in_a_method_call({
374
+ # no: :difference
375
+ # })
376
+ Layout/FirstHashElementIndentation:
377
+ Enabled: true
378
+ EnforcedStyle: consistent
379
+
380
+ # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
381
+ Style/HashSyntax:
382
+ Enabled: true
383
+
384
+ # Use `{ a: 1 }` not `{a:1}`.
385
+ Layout/SpaceInsideHashLiteralBraces:
386
+ Enabled: true
387
+
388
+ # `no_comma`: Does not requires a comma after the last item in a hash
389
+ Style/TrailingCommaInHashLiteral:
390
+ Enabled: true
391
+
392
+ # ====================================================================================================
393
+ # All misc whitespace related rules
394
+ # ====================================================================================================
395
+ # bad
396
+ # def f(a:, b:2); {a:3}; end
397
+ # good
398
+ # def f(a:, b: 2); {a: 3}; end
399
+ Layout/SpaceAfterColon:
400
+ Enabled: true
401
+
402
+ # Ensures comma (,) is followed by some kind of space.
403
+ Layout/SpaceAfterComma:
404
+ Enabled: true
405
+
406
+ # Every ruby keyword should be surrounded by spaces
407
+ Layout/SpaceAroundKeyword:
408
+ Enabled: true
409
+
410
+ # Requires proper spacing around ruby operator symbols.
411
+ Layout/SpaceAroundOperators:
412
+ Enabled: true
413
+ ## Allows multiple spaces for keeping alignment
414
+ # {
415
+ # 1 => 2,
416
+ # 11 => 3
417
+ # }
418
+ AllowForAlignment: true
419
+
420
+ # Ensures comma symbol is not preceded by space
421
+ Layout/SpaceBeforeComma:
422
+ Enabled: true
423
+
424
+ # Use `foo {}` not `foo{}`.
425
+ Layout/SpaceBeforeBlockBraces:
426
+ Enabled: true
427
+
428
+ # Use `foo { bar }` not `foo {bar}`.
429
+ Layout/SpaceInsideBlockBraces:
430
+ Enabled: true
431
+
432
+ # enforces that parentheses do not have spaces
433
+ Layout/SpaceInsideParens:
434
+ Enabled: true
435
+
436
+ # No trailing whitespace.
437
+ Layout/TrailingWhitespace:
438
+ Enabled: true
439
+
440
+ # Require a space after comment
441
+ Layout/LeadingCommentSpace:
442
+ Enabled: true
443
+
444
+ # ====================================================================================================
445
+ # All empty lines related rules
446
+ # ====================================================================================================
447
+ # The `lf` style means that LF (Line Feed) is enforced on
448
+ # all platforms.
449
+ # # bad
450
+ # puts 'Hello' # Return character is CR+LF on all platfoms.
451
+ #
452
+ # # good
453
+ # puts 'Hello' # Return character is LF on all platfoms.
454
+ Layout/EndOfLine:
455
+ Enabled: true
456
+ EnforcedStyle: lf
457
+
458
+ # In a regular module definition, no empty lines around the body.
459
+ Layout/EmptyLinesAroundModuleBody:
460
+ Enabled: true
461
+
462
+ # # bad
463
+ # def foo
464
+ # return if need_return?
465
+ # bar
466
+ # end
467
+ #
468
+ # # good
469
+ # def foo
470
+ # return if need_return?
471
+ #
472
+ # bar
473
+ # end
474
+ Layout/EmptyLineAfterGuardClause:
475
+ Enabled: true
476
+
477
+ # Requires a single final blank line to the file.
478
+ # `final_blank_line` ensures a blank line before EOF.
479
+ # # bad
480
+ # class Foo; end # EOF
481
+ #
482
+ # # good
483
+ # class Foo; end
484
+ #
485
+ # # EOF
486
+ Layout/TrailingEmptyLines:
487
+ Enabled: true
488
+
489
+ # This cop checks for two or more consecutive blank lines.
490
+ # This rule is not same as TrailingEmptyLines, because:
491
+ # 1) It looks for empty lines throughout the file. Not just the end.
492
+ # # bad - It has two empty lines.
493
+ # some_method
494
+ # # one empty line
495
+ # # two empty lines
496
+ # some_method
497
+ #
498
+ # # good
499
+ # some_method
500
+ # # one empty line
501
+ # some_method
502
+ Layout/EmptyLines:
503
+ Enabled: true
504
+
505
+ # ====================================================================================================
506
+ # All naming convetion related rules for variables
507
+ # ====================================================================================================
508
+ # Refer: https://www.bigbinary.com/learn-rubyonrails-book/n+1-queries-and-memoization#bb-generated-p-id-44
509
+ # Sadly this cannot be auto-corrected.
510
+ Naming/MemoizedInstanceVariableName:
511
+ Enabled: true
512
+ EnforcedStyleForLeadingUnderscores: required
513
+
514
+ # ====================================================================================================
515
+ # All misc rules that don't fall into other categories
516
+ # ====================================================================================================
517
+ # Prefer &&/|| over and/or.
518
+ Style/AndOr:
519
+ Enabled: true
520
+
521
+ # Align `when` with `case`.
522
+ Layout/CaseIndentation:
523
+ Enabled: true
524
+
525
+ Layout/LineLength:
526
+ Enabled: true
527
+ Max: 120
528
+ AllowedPatterns: [
529
+ '^\s*#', # line that begins with comment
530
+ '^\s*"', # line that begins with double quote (long string literal)
531
+ '^\s*%{', # line that begins with percent literals (long string literal)
532
+ "^\\s*'", # line that begins with single quote (long string literal)
533
+ '"$', # line that ends with double quote (long string variable assignment)
534
+ "'$", # line that ends with single quote (long string variable assignment)
535
+ '}$', # line that ends with percent literals (long regex variable assignment)
536
+ '\/$', # line that ends with slash (long regex variable assignment)
537
+ ]
538
+
539
+ # Indent using two spaces
540
+ Layout/IndentationWidth:
541
+ Enabled: true
542
+ Width: 2
543
+
544
+ # Use spaces for indentation. Not tabs
545
+ Layout/IndentationStyle:
546
+ Enabled: true
547
+ EnforcedStyle: spaces
548
+
549
+ # Remove extra/unnecessary whitespace which's used for alignment.
550
+ # A developer shouldn't waste time indenting code with whitespaces.
551
+ Layout/ExtraSpacing:
552
+ Enabled: true
553
+ AllowForAlignment: false
554
+
555
+ # Helps in removing unwanted parentheses.
556
+ # # bad
557
+ # x += 1 while (x < 10)
558
+ # foo unless (bar || baz)
559
+ #
560
+ # if (x > 10)
561
+ # elsif (x < 3)
562
+ # end
563
+ #
564
+ # # good
565
+ # x += 1 while x < 10
566
+ # foo unless bar || baz
567
+ #
568
+ # if x > 10
569
+ # elsif x < 3
570
+ # end
571
+ Style/ParenthesesAroundCondition:
572
+ Enabled: true
573
+
574
+ # Enforce string literals to use double quotes everywhere
575
+ Style/StringLiterals:
576
+ Enabled: true
577
+ EnforcedStyle: double_quotes
578
+
579
+ # Use quotes for string literals when they are enough.
580
+ Style/RedundantPercentQ:
581
+ Enabled: true
582
+
583
+ # Align `end` with the matching keyword or starting expression except for
584
+ # assignments, where it should be aligned with the LHS.
585
+ Layout/EndAlignment:
586
+ Enabled: true
587
+ EnforcedStyleAlignWith: variable
588
+
589
+ # avoid lines terminated with a semicolon.
590
+ Style/Semicolon:
591
+ Enabled: true
592
+ # disallow multiple statements in a line
593
+ AllowAsExpressionSeparator: false
594
+
595
+ # Corrects usage of :true/:false to true/false
596
+ Lint/BooleanSymbol:
597
+ Enabled: true
598
+
599
+ # ====================================================================================================
600
+ # All flow(if/while/for/until) statements related
601
+ # ====================================================================================================
602
+ Lint/AssignmentInCondition:
603
+ Enabled: true
604
+ AllowSafeAssignment: true
605
+
606
+ # ====================================================================================================
607
+ # All Bundler cop rules
608
+ # ====================================================================================================
609
+ Bundler/OrderedGems:
610
+ Enabled: true
611
+ TreatCommentsAsGroupSeparators: true
612
+
613
+ # ====================================================================================================
614
+ # All Rails cop rules
615
+ # ====================================================================================================
616
+ # Enabled Rails cops for the command for VSCode linting and while running rubocop -a
617
+ Rails:
618
+ Enabled: false
619
+
620
+ # Correct usage of Date methods in Rails. Use Time.zone.today over Date.today
621
+ Rails/Date:
622
+ Enabled: true
623
+
624
+ # Correct usage of TimeZone methods in Rails
625
+ Rails/TimeZone:
626
+ Enabled: true
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.2.2
@@ -0,0 +1,32 @@
1
+ version: v1.0
2
+ name: cicheck
3
+ agent:
4
+ machine:
5
+ type: e1-standard-2
6
+ os_image: ubuntu2004
7
+ global_job_config:
8
+ prologue:
9
+ commands:
10
+ - checkout
11
+ - sem-version ruby 3.2.2
12
+ - sem-version node 18.12
13
+ - sem-service start postgres 13
14
+ - cp test/dummy/config/database.yml.ci test/dummy/config/database.yml
15
+ - bundle config set --local without 'development'
16
+ - bundle install --jobs 1
17
+ - bundle exec rake db:create db:schema:load --trace
18
+ - yarn install
19
+ blocks:
20
+ - name: Checks
21
+ task:
22
+ jobs:
23
+ - name: Linters
24
+ commands:
25
+ - bundle exec neeto-audit
26
+ - bundle exec rubocop
27
+ # For eslint not to read common_files configuration
28
+ - mv "lib/neeto_commons_backend/common_files/.eslintrc.js" "lib/neeto_commons_backend/common_files/eslintrc.js"
29
+ - mv "lib/neeto_commons_backend/common_files/.prettierrc.js" "lib/neeto_commons_backend/common_files/prettierrc.js"
30
+ - mv "lib/neeto_commons_backend/common_files/cypress-tests/.eslintrc.js" "lib/neeto_commons_backend/common_files/cypress-tests/eslintrc.js"
31
+ - lib/neeto_commons_backend/common_files/.semaphore/commands/run_eslint_on_modified_files.sh
32
+ - bundle exec rails test
@@ -0,0 +1,23 @@
1
+ version: v1.0
2
+ name: Heroku Staging deployment
3
+ agent:
4
+ machine:
5
+ type: e1-standard-2
6
+ os_image: ubuntu2004
7
+
8
+ blocks:
9
+ - name: Deployment to Staging
10
+ run:
11
+ when: "branch = 'main'"
12
+ task:
13
+ secrets:
14
+ - name: heroku-http
15
+ env_vars:
16
+ - name: HEROKU_APP_NAME
17
+ value: neeto-appname-web-staging # change appname to your neeto repo app name eg: neeto-auth-web-staging
18
+ jobs:
19
+ - name: Push code
20
+ commands:
21
+ - checkout --use-cache
22
+ - heroku git:remote -a $HEROKU_APP_NAME
23
+ - git push heroku -f $SEMAPHORE_GIT_BRANCH:main