neeto-compliance 1.0.58

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/.editorconfig +10 -0
  3. data/.husky/helpers/verify_neeto_audit.sh +18 -0
  4. data/.husky/pre-push +7 -0
  5. data/.neetoci/neetoci.yml +18 -0
  6. data/.overcommit.yml +47 -0
  7. data/.rubocop.yml +596 -0
  8. data/.ruby-version +1 -0
  9. data/.semaphore/semaphore.yml +33 -0
  10. data/CHANGELOG.md +375 -0
  11. data/Gemfile +36 -0
  12. data/Gemfile.lock +435 -0
  13. data/README.md +85 -0
  14. data/Rakefile +12 -0
  15. data/bin/console +15 -0
  16. data/bin/neeto-audit +11 -0
  17. data/bin/neeto_repos_verifier/client_config.json +7 -0
  18. data/bin/neeto_repos_verifier/list_verifier.rb +93 -0
  19. data/bin/setup +8 -0
  20. data/bin/sync-neeto-repos +5 -0
  21. data/bin/sync-with-neeto-commons +5 -0
  22. data/config/brakeman.ignore +604 -0
  23. data/data/neeto_repos.json +295 -0
  24. data/lib/neeto-compliance.rb +21 -0
  25. data/lib/neeto_compliance/github_access.rb +29 -0
  26. data/lib/neeto_compliance/neeto_commons.rb +16 -0
  27. data/lib/neeto_compliance/neeto_repos.rb +59 -0
  28. data/lib/neeto_compliance/runner.rb +43 -0
  29. data/lib/neeto_compliance/skippable.rb +19 -0
  30. data/lib/neeto_compliance/sync_neeto_commons/sync_bin.rb +32 -0
  31. data/lib/neeto_compliance/sync_neeto_commons/sync_formatters.rb +28 -0
  32. data/lib/neeto_compliance/sync_neeto_commons/sync_husky.rb +33 -0
  33. data/lib/neeto_compliance/sync_neeto_commons/sync_misc.rb +36 -0
  34. data/lib/neeto_compliance/sync_neeto_commons/sync_test_support.rb +38 -0
  35. data/lib/neeto_compliance/sync_neeto_commons.rb +36 -0
  36. data/lib/neeto_compliance/verifiers/auto_update_prs_with_latest_master_verifier.rb +25 -0
  37. data/lib/neeto_compliance/verifiers/base.rb +77 -0
  38. data/lib/neeto_compliance/verifiers/bump_version_with_pr_label_verifier.rb +25 -0
  39. data/lib/neeto_compliance/verifiers/bundler_version_verifier.rb +48 -0
  40. data/lib/neeto_compliance/verifiers/circleci_config_verifier.rb +25 -0
  41. data/lib/neeto_compliance/verifiers/common_gemfile_verifier.rb +25 -0
  42. data/lib/neeto_compliance/verifiers/common_initializers_verifier.rb +25 -0
  43. data/lib/neeto_compliance/verifiers/cypress_config_verifier.rb +46 -0
  44. data/lib/neeto_compliance/verifiers/cypress_plugins_index_verifier.rb +25 -0
  45. data/lib/neeto_compliance/verifiers/docker_file_dev_verifier.rb +25 -0
  46. data/lib/neeto_compliance/verifiers/environment_config_verifier.rb +38 -0
  47. data/lib/neeto_compliance/verifiers/gem_version_verifier.rb +33 -0
  48. data/lib/neeto_compliance/verifiers/gems_verifier_base.rb +44 -0
  49. data/lib/neeto_compliance/verifiers/gitignore_file_verifier.rb +37 -0
  50. data/lib/neeto_compliance/verifiers/jsconfig_verifier.rb +187 -0
  51. data/lib/neeto_compliance/verifiers/neeto_commons_sync_verifier.rb +42 -0
  52. data/lib/neeto_compliance/verifiers/neeto_gems_version_verifier.rb +36 -0
  53. data/lib/neeto_compliance/verifiers/newrelic_verifier.rb +25 -0
  54. data/lib/neeto_compliance/verifiers/node_version_verifier.rb +84 -0
  55. data/lib/neeto_compliance/verifiers/package_dependencies_version_verifier.rb +59 -0
  56. data/lib/neeto_compliance/verifiers/package_json_verifier.rb +46 -0
  57. data/lib/neeto_compliance/verifiers/roles_verifier.rb +22 -0
  58. data/lib/neeto_compliance/verifiers/ruby_version_verifier.rb +25 -0
  59. data/lib/neeto_compliance/verifiers/semaphoreci_config_verifier.rb +74 -0
  60. data/lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb +36 -0
  61. data/lib/neeto_compliance/verifiers/simplecov_config_verifier.rb +29 -0
  62. data/lib/neeto_compliance/verifiers/sitemap_config_verifier.rb +29 -0
  63. data/lib/neeto_compliance/verifiers/slugignore_file_verifier.rb +25 -0
  64. data/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/bin_files_verifier.rb +29 -0
  65. data/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/formatter_files_verifier.rb +29 -0
  66. data/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/husky_files_verifier.rb +29 -0
  67. data/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/misc_files_verifier.rb +29 -0
  68. data/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/test_support_files_verifier.rb +28 -0
  69. data/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier.rb +31 -0
  70. data/lib/neeto_compliance/verifiers/webpacker_config_verifier.rb +32 -0
  71. data/lib/neeto_compliance/verifiers_list.rb +55 -0
  72. data/lib/neeto_compliance/version.rb +5 -0
  73. data/neeto-compliance.gemspec +35 -0
  74. data/package.json +9 -0
  75. data/yarn.lock +8 -0
  76. metadata +177 -0
data/Gemfile.lock ADDED
@@ -0,0 +1,435 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ neeto-compliance (1.0.58)
5
+ colorize
6
+ deep_merge
7
+ hashdiff
8
+ json (~> 2.6.2)
9
+
10
+ GEM
11
+ remote: https://O6Ts9-SVDaUZpHMRs2CpJp22RwbETDE@gems.neeto.com/
12
+ specs:
13
+ neeto-commons-backend (1.0.86)
14
+ actionview
15
+ bullet
16
+ database_cleaner
17
+ honeybadger
18
+ kaminari
19
+ omniauth-google-oauth2
20
+ premailer-rails
21
+ pundit
22
+ rack-attack
23
+ rack-cors
24
+ rack-mini-profiler
25
+ rack-timeout
26
+ rails_email_preview
27
+ rake
28
+ redis
29
+ sidekiq
30
+ sidekiq-cron
31
+ sidekiq-failures
32
+ webmock
33
+
34
+ GEM
35
+ remote: https://rubygems.org/
36
+ specs:
37
+ actioncable (7.0.4.3)
38
+ actionpack (= 7.0.4.3)
39
+ activesupport (= 7.0.4.3)
40
+ nio4r (~> 2.0)
41
+ websocket-driver (>= 0.6.1)
42
+ actionmailbox (7.0.4.3)
43
+ actionpack (= 7.0.4.3)
44
+ activejob (= 7.0.4.3)
45
+ activerecord (= 7.0.4.3)
46
+ activestorage (= 7.0.4.3)
47
+ activesupport (= 7.0.4.3)
48
+ mail (>= 2.7.1)
49
+ net-imap
50
+ net-pop
51
+ net-smtp
52
+ actionmailer (7.0.4.3)
53
+ actionpack (= 7.0.4.3)
54
+ actionview (= 7.0.4.3)
55
+ activejob (= 7.0.4.3)
56
+ activesupport (= 7.0.4.3)
57
+ mail (~> 2.5, >= 2.5.4)
58
+ net-imap
59
+ net-pop
60
+ net-smtp
61
+ rails-dom-testing (~> 2.0)
62
+ actionpack (7.0.4.3)
63
+ actionview (= 7.0.4.3)
64
+ activesupport (= 7.0.4.3)
65
+ rack (~> 2.0, >= 2.2.0)
66
+ rack-test (>= 0.6.3)
67
+ rails-dom-testing (~> 2.0)
68
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
69
+ actiontext (7.0.4.3)
70
+ actionpack (= 7.0.4.3)
71
+ activerecord (= 7.0.4.3)
72
+ activestorage (= 7.0.4.3)
73
+ activesupport (= 7.0.4.3)
74
+ globalid (>= 0.6.0)
75
+ nokogiri (>= 1.8.5)
76
+ actionview (7.0.4.3)
77
+ activesupport (= 7.0.4.3)
78
+ builder (~> 3.1)
79
+ erubi (~> 1.4)
80
+ rails-dom-testing (~> 2.0)
81
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
82
+ activejob (7.0.4.3)
83
+ activesupport (= 7.0.4.3)
84
+ globalid (>= 0.3.6)
85
+ activemodel (7.0.4.3)
86
+ activesupport (= 7.0.4.3)
87
+ activerecord (7.0.4.3)
88
+ activemodel (= 7.0.4.3)
89
+ activesupport (= 7.0.4.3)
90
+ activestorage (7.0.4.3)
91
+ actionpack (= 7.0.4.3)
92
+ activejob (= 7.0.4.3)
93
+ activerecord (= 7.0.4.3)
94
+ activesupport (= 7.0.4.3)
95
+ marcel (~> 1.0)
96
+ mini_mime (>= 1.1.0)
97
+ activesupport (7.0.4.3)
98
+ concurrent-ruby (~> 1.0, >= 1.0.2)
99
+ i18n (>= 1.6, < 2)
100
+ minitest (>= 5.1)
101
+ tzinfo (~> 2.0)
102
+ addressable (2.8.4)
103
+ public_suffix (>= 2.0.2, < 6.0)
104
+ ansi (1.5.0)
105
+ ast (2.4.2)
106
+ builder (3.2.4)
107
+ bullet (7.0.7)
108
+ activesupport (>= 3.0.0)
109
+ uniform_notifier (~> 1.11)
110
+ byebug (11.1.3)
111
+ childprocess (4.1.0)
112
+ coderay (1.1.3)
113
+ colorize (0.8.1)
114
+ concurrent-ruby (1.2.2)
115
+ connection_pool (2.4.1)
116
+ crack (0.4.5)
117
+ rexml
118
+ crass (1.0.6)
119
+ css_parser (1.14.0)
120
+ addressable
121
+ database_cleaner (2.0.2)
122
+ database_cleaner-active_record (>= 2, < 3)
123
+ database_cleaner-active_record (2.1.0)
124
+ activerecord (>= 5.a)
125
+ database_cleaner-core (~> 2.0.0)
126
+ database_cleaner-core (2.0.1)
127
+ date (3.3.3)
128
+ declarative (0.0.20)
129
+ deep_merge (1.2.2)
130
+ docile (1.4.0)
131
+ erubi (1.12.0)
132
+ et-orbi (1.2.7)
133
+ tzinfo
134
+ faraday (2.7.4)
135
+ faraday-net_http (>= 2.0, < 3.1)
136
+ ruby2_keywords (>= 0.0.4)
137
+ faraday-net_http (3.0.2)
138
+ ffi (1.15.5)
139
+ fugit (1.8.1)
140
+ et-orbi (~> 1, >= 1.2.7)
141
+ raabro (~> 1.4)
142
+ gems (1.2.0)
143
+ globalid (1.1.0)
144
+ activesupport (>= 5.0)
145
+ google-api-client (0.53.0)
146
+ google-apis-core (~> 0.1)
147
+ google-apis-generator (~> 0.1)
148
+ google-apis-core (0.9.1)
149
+ addressable (~> 2.5, >= 2.5.1)
150
+ googleauth (>= 0.16.2, < 2.a)
151
+ httpclient (>= 2.8.1, < 3.a)
152
+ mini_mime (~> 1.0)
153
+ representable (~> 3.0)
154
+ retriable (>= 2.0, < 4.a)
155
+ rexml
156
+ webrick
157
+ google-apis-discovery_v1 (0.12.0)
158
+ google-apis-core (>= 0.9.0, < 2.a)
159
+ google-apis-generator (0.10.0)
160
+ activesupport (>= 5.0)
161
+ gems (~> 1.2)
162
+ google-apis-core (>= 0.9.0, < 2.a)
163
+ google-apis-discovery_v1 (~> 0.5)
164
+ thor (>= 0.20, < 2.a)
165
+ googleauth (1.3.0)
166
+ faraday (>= 0.17.3, < 3.a)
167
+ jwt (>= 1.4, < 3.0)
168
+ memoist (~> 0.16)
169
+ multi_json (~> 1.11)
170
+ os (>= 0.9, < 2.0)
171
+ signet (>= 0.16, < 2.a)
172
+ hashdiff (1.0.1)
173
+ hashie (5.0.0)
174
+ honeybadger (5.2.1)
175
+ htmlentities (4.3.4)
176
+ httpclient (2.8.3)
177
+ i18n (1.13.0)
178
+ concurrent-ruby (~> 1.0)
179
+ iniparse (1.5.0)
180
+ json (2.6.2)
181
+ jwt (2.7.0)
182
+ kaminari (1.2.2)
183
+ activesupport (>= 4.1.0)
184
+ kaminari-actionview (= 1.2.2)
185
+ kaminari-activerecord (= 1.2.2)
186
+ kaminari-core (= 1.2.2)
187
+ kaminari-actionview (1.2.2)
188
+ actionview
189
+ kaminari-core (= 1.2.2)
190
+ kaminari-activerecord (1.2.2)
191
+ activerecord
192
+ kaminari-core (= 1.2.2)
193
+ kaminari-core (1.2.2)
194
+ loofah (2.21.3)
195
+ crass (~> 1.0.2)
196
+ nokogiri (>= 1.12.0)
197
+ mail (2.8.1)
198
+ mini_mime (>= 0.1.1)
199
+ net-imap
200
+ net-pop
201
+ net-smtp
202
+ marcel (1.0.2)
203
+ memoist (0.16.2)
204
+ method_source (1.0.0)
205
+ mini_mime (1.1.2)
206
+ mini_portile2 (2.8.2)
207
+ minitest (5.18.0)
208
+ minitest-reporters (1.5.0)
209
+ ansi
210
+ builder
211
+ minitest (>= 5.0)
212
+ ruby-progressbar
213
+ mocha (2.0.2)
214
+ ruby2_keywords (>= 0.0.5)
215
+ multi_json (1.15.0)
216
+ multi_xml (0.6.0)
217
+ net-imap (0.3.4)
218
+ date
219
+ net-protocol
220
+ net-pop (0.1.2)
221
+ net-protocol
222
+ net-protocol (0.2.1)
223
+ timeout
224
+ net-smtp (0.3.3)
225
+ net-protocol
226
+ nio4r (2.5.9)
227
+ nokogiri (1.15.1)
228
+ mini_portile2 (~> 2.8.2)
229
+ racc (~> 1.4)
230
+ nokogiri (1.15.1-x86_64-darwin)
231
+ racc (~> 1.4)
232
+ nokogiri (1.15.1-x86_64-linux)
233
+ racc (~> 1.4)
234
+ oauth2 (2.0.9)
235
+ faraday (>= 0.17.3, < 3.0)
236
+ jwt (>= 1.0, < 3.0)
237
+ multi_xml (~> 0.5)
238
+ rack (>= 1.2, < 4)
239
+ snaky_hash (~> 2.0)
240
+ version_gem (~> 1.1)
241
+ omniauth (2.1.1)
242
+ hashie (>= 3.4.6)
243
+ rack (>= 2.2.3)
244
+ rack-protection
245
+ omniauth-google-oauth2 (1.1.1)
246
+ jwt (>= 2.0)
247
+ oauth2 (~> 2.0.6)
248
+ omniauth (~> 2.0)
249
+ omniauth-oauth2 (~> 1.8.0)
250
+ omniauth-oauth2 (1.8.0)
251
+ oauth2 (>= 1.4, < 3)
252
+ omniauth (~> 2.0)
253
+ os (1.1.4)
254
+ overcommit (0.59.1)
255
+ childprocess (>= 0.6.3, < 5)
256
+ iniparse (~> 1.4)
257
+ rexml (~> 3.2)
258
+ parallel (1.22.1)
259
+ parser (3.1.2.0)
260
+ ast (~> 2.4.1)
261
+ premailer (1.21.0)
262
+ addressable
263
+ css_parser (>= 1.12.0)
264
+ htmlentities (>= 4.0.0)
265
+ premailer-rails (1.12.0)
266
+ actionmailer (>= 3)
267
+ net-smtp
268
+ premailer (~> 1.7, >= 1.7.9)
269
+ pry (0.13.1)
270
+ coderay (~> 1.1)
271
+ method_source (~> 1.0)
272
+ pry-byebug (3.9.0)
273
+ byebug (~> 11.0)
274
+ pry (~> 0.13.0)
275
+ public_suffix (5.0.1)
276
+ pundit (2.3.0)
277
+ activesupport (>= 3.0.0)
278
+ raabro (1.4.0)
279
+ racc (1.6.2)
280
+ rack (2.2.7)
281
+ rack-attack (6.6.1)
282
+ rack (>= 1.0, < 3)
283
+ rack-cors (2.0.1)
284
+ rack (>= 2.0.0)
285
+ rack-mini-profiler (3.1.0)
286
+ rack (>= 1.2.0)
287
+ rack-protection (3.0.6)
288
+ rack
289
+ rack-test (2.1.0)
290
+ rack (>= 1.3)
291
+ rack-timeout (0.6.3)
292
+ rails (7.0.4.3)
293
+ actioncable (= 7.0.4.3)
294
+ actionmailbox (= 7.0.4.3)
295
+ actionmailer (= 7.0.4.3)
296
+ actionpack (= 7.0.4.3)
297
+ actiontext (= 7.0.4.3)
298
+ actionview (= 7.0.4.3)
299
+ activejob (= 7.0.4.3)
300
+ activemodel (= 7.0.4.3)
301
+ activerecord (= 7.0.4.3)
302
+ activestorage (= 7.0.4.3)
303
+ activesupport (= 7.0.4.3)
304
+ bundler (>= 1.15.0)
305
+ railties (= 7.0.4.3)
306
+ rails-dom-testing (2.0.3)
307
+ activesupport (>= 4.2.0)
308
+ nokogiri (>= 1.6)
309
+ rails-html-sanitizer (1.5.0)
310
+ loofah (~> 2.19, >= 2.19.1)
311
+ rails_email_preview (2.2.3)
312
+ rails (>= 4.2)
313
+ request_store
314
+ sassc-rails (>= 2.0.0)
315
+ turbolinks
316
+ railties (7.0.4.3)
317
+ actionpack (= 7.0.4.3)
318
+ activesupport (= 7.0.4.3)
319
+ method_source
320
+ rake (>= 12.2)
321
+ thor (~> 1.0)
322
+ zeitwerk (~> 2.5)
323
+ rainbow (3.1.1)
324
+ rake (13.0.6)
325
+ redis (5.0.6)
326
+ redis-client (>= 0.9.0)
327
+ redis-client (0.14.1)
328
+ connection_pool
329
+ regexp_parser (2.5.0)
330
+ representable (3.2.0)
331
+ declarative (< 0.1.0)
332
+ trailblazer-option (>= 0.1.1, < 0.2.0)
333
+ uber (< 0.2.0)
334
+ request_store (1.5.1)
335
+ rack (>= 1.4)
336
+ retriable (3.1.2)
337
+ rexml (3.2.5)
338
+ rubocop (1.32.0)
339
+ json (~> 2.3)
340
+ parallel (~> 1.10)
341
+ parser (>= 3.1.0.0)
342
+ rainbow (>= 2.2.2, < 4.0)
343
+ regexp_parser (>= 1.8, < 3.0)
344
+ rexml (>= 3.2.5, < 4.0)
345
+ rubocop-ast (>= 1.19.1, < 2.0)
346
+ ruby-progressbar (~> 1.7)
347
+ unicode-display_width (>= 1.4.0, < 3.0)
348
+ rubocop-ast (1.19.1)
349
+ parser (>= 3.1.1.0)
350
+ ruby-progressbar (1.11.0)
351
+ ruby2_keywords (0.0.5)
352
+ sassc (2.4.0)
353
+ ffi (~> 1.9)
354
+ sassc-rails (2.1.2)
355
+ railties (>= 4.0.0)
356
+ sassc (>= 2.0)
357
+ sprockets (> 3.0)
358
+ sprockets-rails
359
+ tilt
360
+ sidekiq (7.1.0)
361
+ concurrent-ruby (< 2)
362
+ connection_pool (>= 2.3.0)
363
+ rack (>= 2.2.4)
364
+ redis-client (>= 0.14.0)
365
+ sidekiq-cron (1.10.1)
366
+ fugit (~> 1.8)
367
+ globalid (>= 1.0.1)
368
+ sidekiq (>= 6)
369
+ sidekiq-failures (1.0.4)
370
+ sidekiq (>= 4.0.0)
371
+ signet (0.17.0)
372
+ addressable (~> 2.8)
373
+ faraday (>= 0.17.5, < 3.a)
374
+ jwt (>= 1.5, < 3.0)
375
+ multi_json (~> 1.10)
376
+ simplecov (0.21.2)
377
+ docile (~> 1.1)
378
+ simplecov-html (~> 0.11)
379
+ simplecov_json_formatter (~> 0.1)
380
+ simplecov-html (0.12.3)
381
+ simplecov_json_formatter (0.1.4)
382
+ snaky_hash (2.0.1)
383
+ hashie
384
+ version_gem (~> 1.1, >= 1.1.1)
385
+ sprockets (4.2.0)
386
+ concurrent-ruby (~> 1.0)
387
+ rack (>= 2.2.4, < 4)
388
+ sprockets-rails (3.4.2)
389
+ actionpack (>= 5.2)
390
+ activesupport (>= 5.2)
391
+ sprockets (>= 3.0.0)
392
+ thor (1.2.2)
393
+ tilt (2.1.0)
394
+ timeout (0.3.2)
395
+ trailblazer-option (0.1.2)
396
+ turbolinks (5.2.1)
397
+ turbolinks-source (~> 5.2)
398
+ turbolinks-source (5.2.0)
399
+ tzinfo (2.0.6)
400
+ concurrent-ruby (~> 1.0)
401
+ uber (0.1.0)
402
+ unicode-display_width (2.2.0)
403
+ uniform_notifier (1.16.0)
404
+ version_gem (1.1.2)
405
+ webmock (3.18.1)
406
+ addressable (>= 2.8.0)
407
+ crack (>= 0.3.2)
408
+ hashdiff (>= 0.4.0, < 2.0.0)
409
+ webrick (1.7.0)
410
+ websocket-driver (0.7.5)
411
+ websocket-extensions (>= 0.1.0)
412
+ websocket-extensions (0.1.5)
413
+ zeitwerk (2.6.8)
414
+
415
+ PLATFORMS
416
+ ruby
417
+ x86_64-darwin-19
418
+ x86_64-linux
419
+
420
+ DEPENDENCIES
421
+ colorize
422
+ google-api-client
423
+ minitest
424
+ minitest-reporters
425
+ mocha
426
+ neeto-commons-backend!
427
+ neeto-compliance!
428
+ overcommit (~> 0.59.1)
429
+ pry-byebug (~> 3.9.0)
430
+ rake (~> 13.0)
431
+ rubocop (~> 1.28)
432
+ simplecov
433
+
434
+ BUNDLED WITH
435
+ 2.4.6
data/README.md ADDED
@@ -0,0 +1,85 @@
1
+ # neetoCompliance
2
+
3
+ This gem would audit and check a repository for compliance with Neeto development guidelines.
4
+ [Release status](https://bigbinary.retool.com/embedded/public/0143517f-fd27-478e-9c6b-8e82372f3c5c)
5
+
6
+ # Getting Started
7
+
8
+ ## Installation
9
+
10
+ Add this line to your application's Gemfile:
11
+
12
+ ```ruby
13
+ gem "neeto-compliance", git: "https://github.com/bigbinary/neeto-compliance"
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle install
19
+
20
+ Also add a step into the CI process:
21
+
22
+ ```yaml
23
+
24
+ - name: Neeto Compliance
25
+ commands:
26
+ - bundle exec neeto-audit
27
+ ```
28
+
29
+ ## Run the compliance audit
30
+ ```sh
31
+ bundle exec neeto-audit
32
+ ```
33
+
34
+ ## Development
35
+
36
+ ### Verifying changes locally
37
+
38
+ Let's say that we are trying to add a new verifier for a common file maintained by neeto-commons-backend. In that case, once
39
+ the verifier and common file is added locally, we can do the following to verify the changes:
40
+
41
+ - Choose any neeto app, say like neeto-testify-web
42
+ - Open `Gemfile.common` from the neeto app, and update the paths of the following gems:
43
+ ```rb
44
+ # These paths will change relative to where you've placed your gems
45
+ gem "neeto-compliance", path: "../neeto-compliance"
46
+ gem "neeto-commons", path: "../neeto-commons"
47
+ ```
48
+ - Once that is done, you can install these local gems in the neeto app:
49
+ ```sh
50
+ bundle install
51
+ ```
52
+ - After that is done, you can verify the local verifiers by running:
53
+ ```sh
54
+ bundle exec neeto-audit
55
+ ```
56
+
57
+ **Note: Make sure to revert/clean the changes from the neeto app locally once you are done with the verification.**
58
+
59
+ ## Architecture
60
+ The process starts when the user calls the ruby script 'neeto-audit'. This can be called either with an argument '-a' or without it. When called with the argument '-a', the script tries to fix any audit failures automatically if possible.
61
+ Usually, we don't use the script with any arguments.
62
+ Once the [neeto-audit script](https://github.com/bigbinary/neeto-compliance/blob/master/bin/neeto-audit) is called, the neeto-compliance invoke either 'auto_correct' or 'process' method on the object of Runner class.
63
+
64
+ ### Runner class
65
+ Runner ([lib/neeto_compliance/runner.rb](https://github.com/bigbinary/neeto-compliance/blob/master/lib/neeto_compliance/runner.rb)) is a class defined in neeto-compliance gem which is responsible for running and printing the result of each verifiers (or checks in simple terms).
66
+
67
+ ### Verifiers
68
+ All the verifiers can be found in the location, '[lib/neeto_compliance/verifiers](https://github.com/bigbinary/neeto-compliance/tree/master/lib/neeto_compliance/verifiers)'.
69
+ Each verifier follows a common structure. All verifiers inherit a class called Base ([lib/neeto_compliance/verifiers/base.rb](https://github.com/bigbinary/neeto-compliance/blob/master/lib/neeto_compliance/verifiers/base.rb)) which is having the common methods used in all the verifiers.
70
+ The runner is responsible for invoking 'process' method of each verifiers.
71
+ The process method is inherited from the Base class and is responsible for invoke 'valid?' method of each verifier.
72
+ The logic inside the 'valid?' method will be different in each verifiers hence it resides inside the verifier class.
73
+
74
+ ### Verifiers list
75
+ Currently, we have two verifiers list ([lib/neeto_compliance/verifiers_list.rb](https://github.com/bigbinary/neeto-compliance/blob/master/lib/neeto_compliance/verifiers_list.rb)), One for neeto-auth-web and other for all others neeto applications. The reason for this is that neeto-auth-web is different from all other neeto applications and is only used for authentication purpose hence the architecture is slightly different from others.
76
+ There is a class called VerifierList which has two class methods, 'neeto_auth' and 'neeto_apps'. These two methods return a list of verifiers depending upon the neeto-application for which the audit script is being used.
77
+
78
+
79
+ ### Verifying common files
80
+ To verify the structure of any file, we need reference files. For the same reason, we have a copy of these files ([neeto-commons-backend/lib/neeto-commons-backend/common_files](https://github.com/bigbinary/neeto-commons/tree/master/lib/neeto-commons-backend/common_files)) in the neeto_common gems which we use for the comparison with the local file. To find the file in the neeto-common gem we need the path where the gems are installed for the specific ruby version. To find the same, we use info of the neeto_common gem. This can be retrieved using the shell command,
81
+ ```sh
82
+ bundle info neeto-commons-backend
83
+ ```
84
+ The above command prints the summary, homepage, source code and path of the neeto_common gem. We can extract the path from the output of this command to get the path of neeto_common gem and use it to find the common files we have in that gem for comparison with the local ones.
85
+ The path for the common files in neeto-commons-backend is, '[neeto-commons-backend/lib/neeto-commons-backend/common_files](https://github.com/bigbinary/neeto-commons/tree/master/lib/neeto-commons-backend/common_files)'.
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ task default: :test
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "neeto-compliance"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/neeto-audit ADDED
@@ -0,0 +1,11 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'neeto-compliance'
4
+
5
+ auto_correctable_option = ARGV.include?("-a")
6
+
7
+ if auto_correctable_option
8
+ NeetoCompliance::Runner.new.auto_correct
9
+ else
10
+ NeetoCompliance::Runner.new.process
11
+ end
@@ -0,0 +1,7 @@
1
+ {
2
+ "web": {
3
+ "client_id": "869390361994-qfqt92qaisplog0ttfh7ogpkhl577u2t.apps.googleusercontent.com",
4
+ "client_secret": "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",
5
+ "refresh_token": "1//0gz3uMzV5oy2LCgYIARAAGBASNwF-L9IrUtwyZrI-KLmBYYilhWwhkLprn8g7Kneiq4fxMYSSP087n3YH23m-jUPVf8aNZ9xaSkg"
6
+ }
7
+ }
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "google/api_client/client_secrets"
4
+
5
+ module NeetoReposVerfier
6
+ class ListVerfier
7
+
8
+ NEETO_REPOS_SHEET_LINK = "https://docs.google.com/spreadsheets/d/1QaYz_s0j7wX8kmp8_JQPYXqFGs18helJRORS-8edsyQ/edit#gid=0"
9
+ NEETO_REPOS_SHEET_QUERY = "https://sheets.googleapis.com/v4/spreadsheets/1QaYz_s0j7wX8kmp8_JQPYXqFGs18helJRORS-8edsyQ/values/products!B2:B?access_token="
10
+
11
+ def process
12
+ print_verifier_name
13
+ valid? ? print_success_message : print_failure_message
14
+ end
15
+
16
+ private
17
+
18
+ def local_list
19
+ @_local_list ||= fetch_local_lists
20
+ end
21
+
22
+ def fetch_local_lists
23
+ NeetoCompliance::NeetoRepos::products.keys +
24
+ NeetoCompliance::NeetoRepos::nanos +
25
+ NeetoCompliance::NeetoRepos::widgets +
26
+ NeetoCompliance::NeetoRepos::chrome_extensions +
27
+ NeetoCompliance::NeetoRepos::helper_packages +
28
+ NeetoCompliance::NeetoRepos::electron_apps +
29
+ NeetoCompliance::NeetoRepos::executables +
30
+ NeetoCompliance::NeetoRepos::mobile_apps +
31
+ NeetoCompliance::NeetoRepos::other_repos +
32
+ NeetoCompliance::NeetoRepos::nanos_mono_repos
33
+ end
34
+
35
+ def actual_list
36
+ @_actual_list ||= build_app_list
37
+ end
38
+
39
+ def fetch_actual_list
40
+ uri = URI("#{NEETO_REPOS_SHEET_QUERY}#{access_token}")
41
+ response = JSON.parse(Net::HTTP.get(uri))
42
+ print_error_message(response["error"]["message"]) if response["error"]
43
+ response["values"]
44
+ end
45
+
46
+ def build_app_list
47
+ filter_and_clean_app_list(fetch_actual_list.flatten)
48
+ end
49
+
50
+ def filter_and_clean_app_list(apps)
51
+ apps.filter { |app| !app.match?(/ |[A-Z]/) }
52
+ end
53
+
54
+ def valid?
55
+ @unwanted_apps = local_list - actual_list
56
+ @missing_apps = actual_list - local_list
57
+ @unwanted_apps.size == 0 && @missing_apps.size == 0
58
+ end
59
+
60
+ def print_verifier_name
61
+ print self.class.name
62
+ end
63
+
64
+ def print_success_message
65
+ puts "[PASS]".green
66
+ end
67
+
68
+ def print_failure_message
69
+ puts "[FAIL]".red
70
+ puts "The Neeto repos list that is \"data/neeto_repos.json\" file must be in sync with #{NEETO_REPOS_SHEET_LINK}".yellow
71
+ unless @unwanted_apps.nil? || @unwanted_apps.empty?
72
+ puts "The following apps must be removed from the \"data/neeto_repos.json\" file: \n#{@unwanted_apps.to_s.red}\n"
73
+ end
74
+ unless @missing_apps.nil? || @missing_apps.empty?
75
+ puts "The following apps must be added to the \"data/neeto_repos.json\" file: \n#{@missing_apps.to_s.green}"
76
+ end
77
+ exit(1)
78
+ end
79
+
80
+ def print_error_message(message)
81
+ puts "[ERROR]".red
82
+ puts message.red
83
+ exit(1)
84
+ end
85
+
86
+ def access_token
87
+ client_secrets = Google::APIClient::ClientSecrets.load("bin/neeto_repos_verifier/client_config.json")
88
+ auth_client = client_secrets.to_authorization
89
+ auth_client.fetch_access_token!
90
+ auth_client.access_token
91
+ end
92
+ end
93
+ end
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'neeto-compliance'
4
+ require_relative 'neeto_repos_verifier/list_verifier'
5
+ NeetoReposVerfier::ListVerfier.new.process
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'neeto_compliance/sync_neeto_commons'
4
+
5
+ NeetoCompliance::SyncNeetoCommons.new.process