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
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ class NeetoCommonsSyncVerifier < Base
5
+ def webpack_config_files
6
+ @_webpack_config_files ||= {
7
+ "config/webpack/development.js" => NeetoCompliance::NeetoCommons.path.join("webpack/development.js"),
8
+ "config/webpack/production.js" => NeetoCompliance::NeetoCommons.path.join("webpack/production.js"),
9
+ "config/webpack/staging.js" => NeetoCompliance::NeetoCommons.path.join("webpack/staging.js"),
10
+ "config/webpack/test.js" => NeetoCompliance::NeetoCommons.path.join("webpack/test.js")
11
+ }
12
+ end
13
+
14
+ def auto_correct!
15
+ @autofix_commands.each do |command|
16
+ puts command
17
+ system(command)
18
+ end
19
+ end
20
+
21
+ def autofix_suggestion
22
+ @autofix_commands.join("\n").yellow
23
+ end
24
+
25
+ def valid?
26
+ @autofix_commands = []
27
+
28
+ webpack_config_files.each_pair do |local_file, common_file|
29
+ unless same_file?(local_file, common_file)
30
+ @autofix_commands << "cp #{common_file.to_s} #{local_file}"
31
+ end
32
+ end
33
+
34
+ @autofix_commands.length == 0
35
+ end
36
+
37
+ def same_file?(local_file, common_file)
38
+ File.exist?(local_file) &&
39
+ `diff #{local_file} #{common_file.to_s}`.empty?
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ class NeetoGemsVerifier < GemsVerifierBase
5
+ def gems
6
+ [
7
+ { name: "neeto-team-members-engine", repo: "bigbinary/neeto-team-members-engine" },
8
+ { name: "neeto-integrations-engine", repo: "bigbinary/neeto-integrations-engine" },
9
+ { name: "neeto-ip-restrictions-engine", repo: "bigbinary/neeto-ip-restrictions-engine" },
10
+ { name: "neeto-github-engine", repo: "bigbinary/neeto-github-engine" },
11
+ { name: "neeto-form-engine", repo: "bigbinary/neeto-form-engine" },
12
+ { name: "neeto-approvals-engine", repo: "bigbinary/neeto-approvals-engine" },
13
+ { name: "neeto-filters-engine", repo: "bigbinary/neeto-filters-engine" },
14
+ { name: "neeto-invite-links-engine", repo: "bigbinary/neeto-invite-links-engine" },
15
+ { name: "neeto-slack-engine", repo: "bigbinary/neeto-slack-engine" },
16
+ { name: "neeto-rules-engine", repo: "bigbinary/neeto-rules-engine" },
17
+ { name: "neeto-custom-domains-engine", repo: "bigbinary/neeto-custom-domains-engine" },
18
+ { name: "neeto-payments-engine", repo: "bigbinary/neeto-payments-engine" },
19
+ { name: "neeto-notifications-engine", repo: "bigbinary/neeto-notifications-engine" },
20
+ { name: "neeto-area51-engine", repo: "bigbinary/neeto-area51-engine" },
21
+ { name: "neeto-tags-engine", repo: "bigbinary/neeto-tags-engine" },
22
+ { name: "neeto-emails", repo: "bigbinary/neeto-emails" },
23
+ { name: "neeto-compliance", repo: "bigbinary/neeto-compliance" },
24
+ { name: "neeto-monitor-ruby", repo: "bigbinary/neeto-monitor-ruby" },
25
+ { name: "neeto-bugtrap-ruby", repo: "bigbinary/neeto-bugtrap-ruby" },
26
+ { name: "neeto-sso", repo: "bigbinary/neeto-sso" },
27
+ { name: "neeto-commons-backend", repo: "bigbinary/neeto-commons-backend" },
28
+ { name: "neeto-mail-interceptor", repo: "bigbinary/neeto-mail-interceptor" },
29
+ { name: "neeto-email-prefixer", repo: "bigbinary/neeto-email-prefixer" },
30
+ { name: "neeto-org-incineration-engine", repo: "bigbinary/neeto-org-incineration-engine" },
31
+ { name: "neeto-webhooks-engine", repo: "bigbinary/neeto-webhooks-engine" },
32
+
33
+ ]
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ class NewrelicVerifier < Base
5
+ def local_copy
6
+ "config/newrelic.yml"
7
+ end
8
+
9
+ def commons_copy
10
+ NeetoCompliance::NeetoCommons.path.join "common_files/newrelic.yml"
11
+ end
12
+
13
+ def verify_command
14
+ "diff -N #{commons_copy} #{local_copy}"
15
+ end
16
+
17
+ def valid?
18
+ `#{verify_command}`.empty?
19
+ end
20
+
21
+ def autofix_command
22
+ "cp #{commons_copy} #{local_copy}"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ class NodeVersionVerifier < Base
5
+ def local_node_version
6
+ @_local_node_version ||= File.open(".node-version").read.chomp
7
+ end
8
+
9
+ def commons_node_version
10
+ @_commons_node_version ||= File.open(commons_node_version_copy).read.chomp
11
+ end
12
+
13
+ def local_package_json_engines
14
+ JSON.parse(open("package.json").read)["engines"]
15
+ end
16
+
17
+ def autofix_suggestion
18
+ @errors.join("\n").yellow
19
+ end
20
+
21
+ def valid?
22
+ @errors = []
23
+ unless updated_nvmrc_file?
24
+ @errors << "Update node version in .nvmrc to #{commons_node_version}"
25
+ end
26
+
27
+ unless updated_node_version_file?
28
+ @errors << "Update node version in .node-version to #{commons_node_version}"
29
+ end
30
+
31
+ unless check_node_step_added_to_semahore_config?
32
+ @errors << "Add node version to your semaphore.yml as shown below:
33
+ global_job_config:
34
+ prologue:
35
+ commands:
36
+ - checkout
37
+ - sem-version ruby 3.0.1
38
+ - sem-version node #{commons_node_version}
39
+ - sem-service start postgres 12.4
40
+ \n "
41
+ end
42
+
43
+ unless updated_package_file?
44
+ @errors << "Update node version in package.json to #{commons_node_version}"
45
+ end
46
+
47
+ @errors.length == 0
48
+ end
49
+
50
+ def updated_node_version_file?
51
+ commons_node_version == File.open(".node-version").read.chomp
52
+ end
53
+
54
+ def updated_nvmrc_file?
55
+ commons_node_version == File.open(".nvmrc").read.chomp
56
+ end
57
+
58
+ def check_node_step_added_to_semahore_config?
59
+ semaphore_config = YAML.load(File.open(".semaphore/semaphore.yml").read, aliases: true)
60
+ semaphore_command = "sem-version node #{commons_node_version}"
61
+ semaphore_config["global_job_config"]["prologue"]["commands"].include?(semaphore_command)
62
+ end
63
+
64
+ def updated_package_file?
65
+ commons_node_version == local_package_json_engines["node"]
66
+ end
67
+
68
+ def commons_node_version_copy
69
+ NeetoCompliance::NeetoCommons.path.join "common_files/.node-version"
70
+ end
71
+
72
+ def update_package_file
73
+ "perl -p -i -e 's/\"node\": \"#{local_node_version}\"/\"node\": \"#{commons_node_version}\"/g' package.json"
74
+ end
75
+
76
+ def update_semaphore_config_file
77
+ "perl -p -i -e 's/sem-version node #{local_node_version}/sem-version node #{commons_node_version}/g' .semaphore/semaphore.yml"
78
+ end
79
+
80
+ def autofix_command
81
+ "#{update_semaphore_config_file}\n#{update_package_file}"
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,59 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ module NeetoCompliance
6
+ class PackageDependenciesVersionVerifier < Base
7
+ def valid?
8
+ @common_package_json = load_json_file(common_packages_latest_file)
9
+ @project_package_json = load_json_file("package.json")
10
+
11
+ @incorrect_dependencies = {
12
+ dependencies: find_incorrect_dependencies(:dependencies),
13
+ devDependencies: find_incorrect_dependencies(:devDependencies)
14
+ }
15
+ @incorrect_dependencies[:misplacedDependencies] = find_misplaced_dependencies
16
+ @incorrect_dependencies.keys.all? { |key| @incorrect_dependencies[key].empty? }
17
+ end
18
+
19
+ def autofix_command
20
+ command = ""
21
+ command += "yarn remove #{@incorrect_dependencies[:misplacedDependencies]
22
+ .join(" ")}\n" unless @incorrect_dependencies[:misplacedDependencies].empty?
23
+ command += "yarn add #{@incorrect_dependencies[:dependencies]
24
+ .join(" ")}\n" unless @incorrect_dependencies[:dependencies].empty?
25
+ command += "yarn add -D #{@incorrect_dependencies[:devDependencies]
26
+ .join(" ")}\n" unless @incorrect_dependencies[:devDependencies].empty?
27
+ command
28
+ end
29
+
30
+ private
31
+
32
+ def common_packages_latest_file
33
+ NeetoCompliance::NeetoCommons.path.join "common_files/package-common.json"
34
+ end
35
+
36
+ def find_misplaced_dependencies
37
+ project_dependencies = @project_package_json[:dependencies]
38
+ @common_package_json[:devDependencies].inject([]) do |result, (package_name, latest_version)|
39
+ next result unless project_dependencies.key?(package_name)
40
+
41
+ @incorrect_dependencies[:devDependencies] |= ["\"#{package_name}@#{latest_version}\""]
42
+ result.push("#{package_name}")
43
+ end
44
+ end
45
+
46
+ def find_incorrect_dependencies(key)
47
+ project_dependencies = @project_package_json[key]
48
+ @common_package_json[key].inject([]) do |result, (package_name, latest_version)|
49
+ next result if project_dependencies[package_name] == latest_version
50
+
51
+ result.push("\"#{package_name}@#{latest_version}\"")
52
+ end
53
+ end
54
+
55
+ def load_json_file(url)
56
+ JSON.parse(open(url).read, symbolize_names: true)
57
+ end
58
+ end
59
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "json"
4
+
5
+ KEYS_TO_CHECK = %w[engines lint-staged].freeze
6
+
7
+ module NeetoCompliance
8
+ class PackageJsonVerifier < Base
9
+ def valid?
10
+ @common_lint_staged = JSON.parse(open(common_packages_latest_file).read)
11
+ project_lint_staged = JSON.parse(open("package.json").read)
12
+
13
+ @results = KEYS_TO_CHECK.map { |key| @common_lint_staged[key].to_json === project_lint_staged[key].to_json }
14
+ @results.all?
15
+ end
16
+
17
+ def autofix_command
18
+ "echo '#{updated_package.to_json}' > package.json"
19
+ end
20
+
21
+ def updated_package
22
+ package = JSON.parse(open("package.json").read)
23
+ KEYS_TO_CHECK.map { |key| package[key] = @common_lint_staged[key] }
24
+ package
25
+ end
26
+
27
+ def autofix_suggestion
28
+ return "" if @results.all?
29
+
30
+ command = ""
31
+ KEYS_TO_CHECK.each_with_index do |key, index|
32
+ next if @results[index]
33
+
34
+ command += "Replace the value of \"#{key}\" in package.json with:\n\n#{JSON.pretty_generate(@common_lint_staged[key])}\n\n"
35
+ end
36
+
37
+ command.yellow
38
+ end
39
+
40
+ private
41
+
42
+ def common_packages_latest_file
43
+ NeetoCompliance::NeetoCommons.path.join "common_files/package-common.json"
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ # To verify if the `roles.yml` file exist in the host application.
5
+ class RolesVerifier < Base
6
+ def local_copy
7
+ "config/roles.yml"
8
+ end
9
+
10
+ def commons_copy
11
+ NeetoCompliance::NeetoCommons.path.join "common_files/roles.yml"
12
+ end
13
+
14
+ def valid?
15
+ File.exist?(local_copy)
16
+ end
17
+
18
+ def autofix_command
19
+ "cp #{commons_copy} #{local_copy}"
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ class RubyVersionVerifier < Base
5
+ def local_copy
6
+ ".ruby-version"
7
+ end
8
+
9
+ def commons_copy
10
+ NeetoCompliance::NeetoCommons.path.join "common_files/.ruby-version"
11
+ end
12
+
13
+ def verify_command
14
+ "diff -N #{commons_copy} #{local_copy}"
15
+ end
16
+
17
+ def valid?
18
+ `#{verify_command}`.empty?
19
+ end
20
+
21
+ def autofix_command
22
+ "cp #{commons_copy} #{local_copy}"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "deep_merge"
4
+
5
+ module NeetoCompliance
6
+ class SemaphoreciConfigVerifier < Base
7
+ def local_copy
8
+ ".semaphore/semaphore.yml"
9
+ end
10
+
11
+ def commons_copy
12
+ NeetoCompliance::NeetoCommons.path.join "common_files/semaphore/semaphore.yml"
13
+ end
14
+
15
+ def semaphore_config_valid?
16
+ deep_hash_comp(local_semaphore_config, common_semaphore_config)
17
+ end
18
+
19
+ def autofix_command
20
+ "echo \"#{common_semaphore_config.to_yaml[4..-2]}\" > #{local_copy}"
21
+ end
22
+
23
+ def autofix_suggestion
24
+ "→ cp #{commons_copy} #{local_copy}\n→ And append the following configs\n #{app_specific_configs[app_name].to_yaml}".yellow
25
+ end
26
+
27
+ def valid?
28
+ semaphore_config_valid?
29
+ end
30
+
31
+ private
32
+
33
+ def local_semaphore_config
34
+ YAML.load(File.open(local_copy), aliases: true)
35
+ end
36
+
37
+ def common_semaphore_config
38
+ semaphore_config = YAML.load(File.open(commons_copy), aliases: true)
39
+ semaphore_config.deep_merge!(app_specific_configs[app_name] || {})
40
+ end
41
+
42
+ def app_specific_configs
43
+ {
44
+ "neeto-kb-web" => {
45
+ "global_job_config" => {
46
+ "prologue" => { "commands" => ["sem-service start elasticsearch 7.9"] }
47
+ }
48
+ }
49
+ }
50
+ end
51
+
52
+ def deep_hash_comp(hash1, hash2)
53
+ return false if hash1.size != hash2.size
54
+
55
+ hash1.all? do |key, value|
56
+ if hash2[key].nil?
57
+ false
58
+ elsif value.class == Array
59
+ array_comp(value.uniq, hash2[key]&.uniq)
60
+ elsif value.class == Hash
61
+ deep_hash_comp(value, hash2[key])
62
+ else
63
+ value == hash2[key]
64
+ end
65
+ end
66
+ end
67
+
68
+ def array_comp (array1, array2)
69
+ return false if array1.size != array2.size
70
+
71
+ array1.all? { |value| array2.include?(value) }
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ class SidekiqQueuesVerifier < Base
5
+ def local_copy
6
+ "config/sidekiq.yml"
7
+ end
8
+
9
+ def queues
10
+ @_queues ||= ["auth", "urgent", "default", "low"]
11
+ end
12
+
13
+ def valid?
14
+ @errors = []
15
+ @missing_queues = []
16
+ sidekiq_yml = YAML.load(File.open(local_copy), aliases: true)
17
+ local_queues = sidekiq_yml["queues"] || []
18
+ queues.map do |queue|
19
+ unless local_queues.include?(queue)
20
+ @missing_queues << queue
21
+ @errors << "Add #{queue} to queues in #{local_copy}"
22
+ end
23
+ end
24
+
25
+ @errors.length == 0
26
+ end
27
+
28
+ def autofix_suggestion
29
+ @errors.join("\n").yellow
30
+ end
31
+
32
+ def autofix_command
33
+ "perl -p -i -e 's/queues:/queues:\n - #{@missing_queues.join("\n - ")}/g' config/sidekiq.yml"
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ class SimplecovConfigVerifier < Base
5
+ def test_helper
6
+ "test/test_helper.rb"
7
+ end
8
+
9
+ def valid?
10
+ @errors = []
11
+
12
+ check_file = Set.new(File.readlines(test_helper).collect(&:chomp))
13
+
14
+ if check_file.include?("NeetoCommonsBackend.simplecov_config")
15
+ @errors << "Remove NeetoCommons.simplecov_config from #{test_helper}"
16
+ end
17
+
18
+ @errors.length == 0
19
+ end
20
+
21
+ def autofix_suggestion
22
+ @errors.join("\n").yellow
23
+ end
24
+
25
+ def autofix_command
26
+ "grep -v 'NeetoCommonsBackend.simplecov_config' #{test_helper} > tmpfile && mv tmpfile #{test_helper}"
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ class SitemapConfigVerifier < Base
5
+ def local_copy
6
+ "public/sitemap.xml"
7
+ end
8
+
9
+ def commons_copy
10
+ NeetoCompliance::NeetoCommons.path.join "common_files", "sitemap.xml"
11
+ end
12
+
13
+ def verify_command
14
+ "diff -N #{commons_copy} #{local_copy}"
15
+ end
16
+
17
+ def valid?
18
+ `#{verify_command}`.empty?
19
+ end
20
+
21
+ def autofix_command
22
+ "cp #{commons_copy} #{local_copy}"
23
+ end
24
+
25
+ def apps_exception_list
26
+ ["neeto-kb-web"]
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module NeetoCompliance
4
+ class SlugignoreFileVerifier < Base
5
+ def local_copy
6
+ ".slugignore"
7
+ end
8
+
9
+ def commons_copy
10
+ NeetoCompliance::NeetoCommons.path.join local_copy
11
+ end
12
+
13
+ def verify_command
14
+ "diff -N #{commons_copy} #{local_copy}"
15
+ end
16
+
17
+ def valid?
18
+ `#{verify_command}`.empty?
19
+ end
20
+
21
+ def autofix_command
22
+ "cp #{commons_copy} #{local_copy}"
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "yaml"
6
+
7
+ require "neeto_compliance/sync_neeto_commons"
8
+
9
+ module NeetoCompliance
10
+ class SyncNeetoCommonsVerifier < Base
11
+ class BinFilesVerifier
12
+ def process
13
+ non_complied_bin_files = find_non_complied_bin_files
14
+
15
+ return false if non_complied_bin_files.any?
16
+
17
+ true
18
+ end
19
+
20
+ private
21
+
22
+ def find_non_complied_bin_files
23
+ NeetoCompliance::SyncNeetoCommons::SyncBin.BIN_FILES.select do |file|
24
+ !system("cat #{NeetoCompliance::SyncNeetoCommons.neeto_commons_url}#{file} | diff #{file} - 1> /dev/null")
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "yaml"
6
+
7
+ require "neeto_compliance/sync_neeto_commons"
8
+
9
+ module NeetoCompliance
10
+ class SyncNeetoCommonsVerifier < Base
11
+ class FormatterFilesVerifier
12
+ def process
13
+ non_complied_formatter_files = find_non_complied_formatter_files
14
+
15
+ return false if non_complied_formatter_files.any?
16
+
17
+ true
18
+ end
19
+
20
+ private
21
+
22
+ def find_non_complied_formatter_files
23
+ NeetoCompliance::SyncNeetoCommons::SyncFormatters.CONFIG_FILES.select do |file|
24
+ !system("cat #{NeetoCompliance::SyncNeetoCommons.neeto_commons_url}#{file} | diff #{file} - 1> /dev/null")
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "yaml"
6
+
7
+ require "neeto_compliance/sync_neeto_commons"
8
+
9
+ module NeetoCompliance
10
+ class SyncNeetoCommonsVerifier < Base
11
+ class HuskyFilesVerifier
12
+ def process
13
+ non_complied_husky_files = find_non_complied_husky_files
14
+
15
+ return false if non_complied_husky_files.any?
16
+
17
+ true
18
+ end
19
+
20
+ private
21
+
22
+ def find_non_complied_husky_files
23
+ NeetoCompliance::SyncNeetoCommons::SyncHusky.HUSKY_FILES.select do |file|
24
+ !system("cat #{NeetoCompliance::SyncNeetoCommons.neeto_commons_url}#{file} | diff #{file} - 1> /dev/null")
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "json"
5
+ require "yaml"
6
+
7
+ require "neeto_compliance/sync_neeto_commons"
8
+
9
+ module NeetoCompliance
10
+ class SyncNeetoCommonsVerifier < Base
11
+ class MiscFilesVerifier
12
+ def process
13
+ non_complied_misc_files = find_non_complied_misc_files
14
+
15
+ return false if non_complied_misc_files.any?
16
+
17
+ true
18
+ end
19
+
20
+ private
21
+
22
+ def find_non_complied_misc_files
23
+ NeetoCompliance::SyncNeetoCommons::SyncMisc.MISC_FILES.select do |file|
24
+ !system("cat #{NeetoCompliance::SyncNeetoCommons.neeto_commons_url}#{file} | diff #{file} - 1> /dev/null")
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end