neetob 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/.semaphore/semaphore.yml +3 -4
  3. data/CHANGELOG.md +14 -0
  4. data/Gemfile +10 -0
  5. data/Gemfile.lock +15 -2
  6. data/README.md +64 -36
  7. data/bookmarks.md +5 -0
  8. data/data/branch-protection-rules.json +1 -1
  9. data/data/github-labels.json +7 -2
  10. data/lib/neetob/cli/base.rb +22 -10
  11. data/lib/neetob/cli/fetchorupdate_repos/execute.rb +5 -3
  12. data/lib/neetob/cli/github/base.rb +7 -0
  13. data/lib/neetob/cli/github/commands.rb +6 -2
  14. data/lib/neetob/cli/github/labels/commands.rb +18 -10
  15. data/lib/neetob/cli/github/labels/delete.rb +5 -3
  16. data/lib/neetob/cli/github/labels/delete_all.rb +5 -3
  17. data/lib/neetob/cli/github/labels/list.rb +5 -3
  18. data/lib/neetob/cli/github/labels/show.rb +5 -3
  19. data/lib/neetob/cli/github/labels/update.rb +5 -3
  20. data/lib/neetob/cli/github/labels/upsert.rb +41 -7
  21. data/lib/neetob/cli/github/make_pr/base.rb +2 -1
  22. data/lib/neetob/cli/github/make_pr/commands.rb +4 -1
  23. data/lib/neetob/cli/github/make_pr/compliance_fix.rb +6 -1
  24. data/lib/neetob/cli/github/make_pr/script.rb +4 -3
  25. data/lib/neetob/cli/github/protect_branch.rb +5 -3
  26. data/lib/neetob/cli/heroku/config_vars/upsert.rb +6 -2
  27. data/lib/neetob/cli/heroku/execute.rb +2 -2
  28. data/lib/neetob/cli/users/commands.rb +3 -1
  29. data/lib/neetob/cli/users/commits.rb +71 -22
  30. data/lib/neetob/cli.rb +3 -1
  31. data/lib/neetob/version.rb +1 -1
  32. data/neetob.gemspec +1 -1
  33. metadata +7 -57
  34. data/LICENSE.txt +0 -21
  35. data/env.sample +0 -1
  36. data/neeto_compliance/lib/neeto_compliance/github_access.rb +0 -29
  37. data/neeto_compliance/lib/neeto_compliance/neeto_apps.rb +0 -35
  38. data/neeto_compliance/lib/neeto_compliance/neeto_commons.rb +0 -16
  39. data/neeto_compliance/lib/neeto_compliance/runner.rb +0 -35
  40. data/neeto_compliance/lib/neeto_compliance/skippable.rb +0 -19
  41. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_bin.rb +0 -32
  42. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_formatters.rb +0 -35
  43. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_husky.rb +0 -33
  44. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_misc.rb +0 -36
  45. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons/sync_test_support.rb +0 -38
  46. data/neeto_compliance/lib/neeto_compliance/sync_neeto_commons.rb +0 -36
  47. data/neeto_compliance/lib/neeto_compliance/verifiers/auto_update_prs_with_latest_master_verifier.rb +0 -25
  48. data/neeto_compliance/lib/neeto_compliance/verifiers/base.rb +0 -72
  49. data/neeto_compliance/lib/neeto_compliance/verifiers/bundler_version_verifier.rb +0 -53
  50. data/neeto_compliance/lib/neeto_compliance/verifiers/circleci_config_verifier.rb +0 -25
  51. data/neeto_compliance/lib/neeto_compliance/verifiers/common_gemfile_verifier.rb +0 -25
  52. data/neeto_compliance/lib/neeto_compliance/verifiers/common_initializers_verifier.rb +0 -25
  53. data/neeto_compliance/lib/neeto_compliance/verifiers/cypress_config_verifier.rb +0 -46
  54. data/neeto_compliance/lib/neeto_compliance/verifiers/cypress_plugins_index_verifier.rb +0 -25
  55. data/neeto_compliance/lib/neeto_compliance/verifiers/docker_file_dev_verifier.rb +0 -25
  56. data/neeto_compliance/lib/neeto_compliance/verifiers/environment_config_verifier.rb +0 -38
  57. data/neeto_compliance/lib/neeto_compliance/verifiers/gem_version_verifier.rb +0 -38
  58. data/neeto_compliance/lib/neeto_compliance/verifiers/gems_verifier_base.rb +0 -34
  59. data/neeto_compliance/lib/neeto_compliance/verifiers/gitignore_file_verifier.rb +0 -39
  60. data/neeto_compliance/lib/neeto_compliance/verifiers/jsconfig_verifier.rb +0 -100
  61. data/neeto_compliance/lib/neeto_compliance/verifiers/neeto_auth_gems_verifier.rb +0 -20
  62. data/neeto_compliance/lib/neeto_compliance/verifiers/neeto_commons_sync_verifier.rb +0 -42
  63. data/neeto_compliance/lib/neeto_compliance/verifiers/neeto_gems_version_verifier.rb +0 -24
  64. data/neeto_compliance/lib/neeto_compliance/verifiers/newrelic_verifier.rb +0 -25
  65. data/neeto_compliance/lib/neeto_compliance/verifiers/node_version_verifier.rb +0 -63
  66. data/neeto_compliance/lib/neeto_compliance/verifiers/package_dependencies_version_verifier.rb +0 -62
  67. data/neeto_compliance/lib/neeto_compliance/verifiers/package_json_verifier.rb +0 -39
  68. data/neeto_compliance/lib/neeto_compliance/verifiers/roles_verifier.rb +0 -22
  69. data/neeto_compliance/lib/neeto_compliance/verifiers/ruby_version_verifier.rb +0 -25
  70. data/neeto_compliance/lib/neeto_compliance/verifiers/semaphoreci_config_verifier.rb +0 -162
  71. data/neeto_compliance/lib/neeto_compliance/verifiers/sidekiq_queues_verifier.rb +0 -34
  72. data/neeto_compliance/lib/neeto_compliance/verifiers/simplecov_config_verifier.rb +0 -28
  73. data/neeto_compliance/lib/neeto_compliance/verifiers/sitemap_config_verifier.rb +0 -29
  74. data/neeto_compliance/lib/neeto_compliance/verifiers/slugignore_file_verifier.rb +0 -25
  75. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/bin_files_verifier.rb +0 -29
  76. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/formatter_files_verifier.rb +0 -29
  77. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/husky_files_verifier.rb +0 -29
  78. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/misc_files_verifier.rb +0 -29
  79. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier/test_support_files_verifier.rb +0 -28
  80. data/neeto_compliance/lib/neeto_compliance/verifiers/sync_neeto_commons_verifier.rb +0 -31
  81. data/neeto_compliance/lib/neeto_compliance/verifiers/webpack_configuration_verifier.rb +0 -44
  82. data/neeto_compliance/lib/neeto_compliance/verifiers/webpacker_config_verifier.rb +0 -29
  83. data/neeto_compliance/lib/neeto_compliance/verifiers_list.rb +0 -61
  84. data/neeto_compliance/lib/neeto_compliance/version.rb +0 -5
@@ -1,38 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class GemVersionVerifier
5
- attr_reader :gem_name, :repo_name, :latest_version
6
-
7
- def initialize(gem_name, repo_name, latest_version)
8
- @gem_name = gem_name
9
- @repo_name = repo_name
10
- @latest_version = latest_version
11
- end
12
-
13
- def current_version
14
- bundler_specs.find { |s| s.name == gem_name }.extension_dir.split("-").last rescue nil
15
- end
16
-
17
- def bundler_specs
18
- Bundler.definition.specs
19
- end
20
-
21
- # def latest_version
22
- # uri = "https://api.github.com/repos/#{repo_name}/commits/master"
23
- # GithubAccess.latest_commit_sha(uri)
24
- # end
25
-
26
- def gem_installed?
27
- !current_version.nil?
28
- end
29
-
30
- def latest_version_installed?
31
- current_version.to_s[0..6] == latest_version.to_s[0..6]
32
- end
33
-
34
- def valid?
35
- gem_installed? && latest_version_installed?
36
- end
37
- end
38
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class GemsVerifierBase < Base
5
- def gems
6
- []
7
- end
8
-
9
- def latest_versions
10
- @_latest_versions ||= _latest_versions
11
- end
12
-
13
- def _latest_versions
14
- JSON.parse(Net::HTTP.get_response(URI("https://neeto-library-stable-versions.herokuapp.com/versions")).body)
15
- end
16
-
17
- def valid?
18
- @failed_gems = []
19
-
20
- gems.map do |gem|
21
- gv = GemVersionVerifier.new(gem[:name], gem[:repo], latest_versions[gem[:repo]])
22
- unless gv.valid?
23
- @failed_gems << gem[:name]
24
- end
25
- end
26
-
27
- @failed_gems.empty?
28
- end
29
-
30
- def autofix_command
31
- "bundle update #{@failed_gems.join(' ')}"
32
- end
33
- end
34
- end
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class GitignoreFileVerifier < Base
5
- def local_copy
6
- ".gitignore"
7
- end
8
-
9
- def commons_copy
10
- NeetoCompliance::NeetoCommons.path.join "common_files", local_copy
11
- end
12
-
13
- def verify_command
14
- "diff #{commons_copy} #{local_copy}"
15
- end
16
-
17
- def valid?
18
- local_gitignore = process_data File.read(local_copy)
19
- common_gitignore = process_data File.read(NeetoCompliance::GitignoreFileVerifier.new.commons_copy)
20
- common_gitignore.map { |line| return false unless local_gitignore.include?(line) }
21
- true
22
- end
23
-
24
- def process_data(gitignore_data)
25
- gitignore_data.split("\n").map { |line| line.gsub(/^#.*/, "") }
26
- end
27
-
28
- def autofix_command
29
- "cp #{commons_copy} #{local_copy}"
30
- end
31
-
32
- def auto_correct!
33
- end
34
-
35
- def autofix_suggestion
36
- "Make sure #{local_copy} contains all lines from #{commons_copy.to_s}".yellow
37
- end
38
- end
39
- end
@@ -1,100 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "hashdiff"
4
-
5
- module NeetoCompliance
6
- class JsconfigVerifier < Base
7
- attr_accessor :diff
8
-
9
- def initialize
10
- @diff = []
11
- end
12
-
13
- def local_copy
14
- "app/javascript/jsconfig.json"
15
- end
16
-
17
- def commons_copy
18
- NeetoCompliance::NeetoCommons.path.join "common_files", "app", "javascript", "jsconfig.json"
19
- end
20
-
21
- def local_jsconfig_data
22
- @_local_jsconfig_data ||= JSON.parse(File.read(local_copy))
23
- end
24
-
25
- def required_jsconfig_data
26
- @_required_jsconfig_data ||= JSON.parse(File.read(commons_copy))
27
- end
28
-
29
- def verify_command
30
- self.diff = Hashdiff.best_diff(required_jsconfig_data, local_jsconfig_data)
31
- removed_symbol = "\-"
32
- modified_symbol = "\~"
33
- symbol_index = 0
34
- self.diff.any? { |p| /#{removed_symbol}|#{modified_symbol}/.match?(p[symbol_index]) }
35
- end
36
-
37
- def local_file_exists?
38
- File.file?(local_copy)
39
- end
40
-
41
- def valid?
42
- return false unless local_file_exists?
43
-
44
- is_modified_or_removed = verify_command
45
- !is_modified_or_removed
46
- end
47
-
48
- def autofix_command
49
- "cp #{commons_copy} #{local_copy}"
50
- end
51
-
52
- def upstream_copy
53
- "https://github.com/bigbinary/neeto-commons-backend/blob/stable/lib/neeto-commons-backend/common_files/app/javascript/jsconfig.json"
54
- end
55
-
56
- def autofix_suggestion
57
- base_message = %{
58
- Your jsconfig.json content doesn't match with the expected neeto-commons content.
59
-
60
- The following is the recommended jsconfig.json content in neeto ecosystem:
61
- 1) View #{upstream_copy}
62
- 2) Or open #{commons_copy}
63
-
64
- To fix, start by fully replacing app/javascript/jsconfig.json
65
- of your app with above mentioned content, by running the following:
66
- #{autofix_command.yellow}
67
- }
68
-
69
- # The following is an example diff:
70
- # [["-", "compilerOptions.moduleResolution", "NodeNext"],
71
- # ["~", "compilerOptions.module", "ESNext", "ESNex"],
72
- # ["+", "compilerOptions.paths.neetou", ["../../node_modules/@bigbinary/neetoui/**"]],
73
- # For the above diff, we only need to get the newly added items marked by "+"
74
- # and also check whether it's a "path" that has been added.
75
- capture_addition_into_paths_key = "(?=.*\+)(?=.*compilerOptions.paths)"
76
- new_paths = self.diff.select { |p| p.join =~ /#{capture_addition_into_paths_key}.*/ }
77
- if new_paths.empty?
78
- return base_message
79
- end
80
-
81
- custom_paths = Hash.new
82
- new_paths.each do |path|
83
- k = path[1].split(".").last
84
- v = path[2]
85
- custom_paths[k] = v
86
- end
87
-
88
- message = %{
89
- #{base_message}
90
- ==================================================
91
- It seems that you've also added some custom paths in your jsconfig. You can cherry pick and
92
- append the custom paths to app/javascript/jsconfig.json, if need be, after running above mentioned copy command.
93
- Refer the comments in #{upstream_copy}
94
- to see how to add custom paths.
95
- The following are the custom paths that we have detected in your app/javascript/jsconfig.json:
96
- #{JSON.pretty_generate(custom_paths).yellow}
97
- }
98
- end
99
- end
100
- end
@@ -1,20 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class NeetoAuthGemsVerifier < GemsVerifierBase
5
- def gems
6
- [
7
- { name: "neeto-commons-backend", repo: "bigbinary/neeto-commons-backend" },
8
- { name: "neeto-compliance", repo: "bigbinary/neeto-compliance" },
9
- { name: "neeto-area51-engine", repo: "bigbinary/neeto-area51-engine" },
10
- { name: "neeto-team-members-engine", repo: "bigbinary/neeto-team-members-engine" },
11
- { name: "neeto-org-incineration-engine", repo: "bigbinary/neeto-org-incineration-engine" },
12
- # { name: "neeto-emails", repo: "bigbinary/neeto-emails" },
13
- { name: "neeto-email-prefixer", repo: "bigbinary/neeto-email-prefixer" },
14
- { name: "neeto-mail-interceptor", repo: "bigbinary/neeto-mail-interceptor" },
15
- { name: "neeto-filters-engine", repo: "bigbinary/neeto-filters-engine" },
16
- { name: "neeto-custom-domains-engine", repo: "bigbinary/neeto-custom-domains-engine" },
17
- ]
18
- end
19
- end
20
- end
@@ -1,42 +0,0 @@
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
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class NeetoGemsVerifier < GemsVerifierBase
5
- def gems
6
- [
7
- { name: "neeto-commons-backend", repo: "bigbinary/neeto-commons-backend" },
8
- { name: "neeto-compliance", repo: "bigbinary/neeto-compliance" },
9
- { name: "neeto-area51-engine", repo: "bigbinary/neeto-area51-engine" },
10
- { name: "neeto-sso", repo: "bigbinary/neeto-sso" },
11
- { name: "neeto-team-members-engine", repo: "bigbinary/neeto-team-members-engine" },
12
- { name: "neeto-org-incineration-engine", repo: "bigbinary/neeto-org-incineration-engine" },
13
- # { name: "neeto-emails", repo: "bigbinary/neeto-emails" },
14
- { name: "neeto-email-prefixer", repo: "bigbinary/neeto-email-prefixer" },
15
- { name: "neeto-mail-interceptor", repo: "bigbinary/neeto-mail-interceptor" },
16
- { name: "neeto-payments-engine", repo: "bigbinary/neeto-payments-engine" },
17
- { name: "neeto-notifications-engine", repo: "bigbinary/neeto-notifications-engine" },
18
- { name: "neeto-tags-engine", repo: "bigbinary/neeto-tags-engine" },
19
- { name: "neeto-filters-engine", repo: "bigbinary/neeto-filters-engine" },
20
- { name: "neeto-custom-domains-engine", repo: "bigbinary/neeto-custom-domains-engine" },
21
- ]
22
- end
23
- end
24
- end
@@ -1,25 +0,0 @@
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
@@ -1,63 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module NeetoCompliance
4
- class NodeVersionVerifier < Base
5
- def node_version
6
- JSON.parse(open(common_packages_latest_file).read)["engines"]["node"]
7
- end
8
-
9
- def package_json_engines
10
- JSON.parse(open("package.json").read)["engines"]
11
- end
12
-
13
- def auto_correct!
14
- end
15
-
16
- def autofix_suggestion
17
- @errors.join("\n").yellow
18
- end
19
-
20
- def valid?
21
- @errors = []
22
- unless updated_nvmrc_file?
23
- @errors << "Update node version in .nvmrc to #{node_version}"
24
- end
25
-
26
- unless updated_node_version_file?
27
- @errors << "Update node version in .node-version to #{node_version}"
28
- end
29
-
30
- unless check_node_step_added_to_semahore_config?
31
- @errors << "Add node version to your semaphore.yml as shown below:
32
- global_job_config:
33
- prologue:
34
- commands:
35
- - checkout
36
- - sem-version ruby 3.0.1
37
- - sem-version node #{node_version}
38
- - sem-service start postgres 12.4
39
- \n "
40
- end
41
-
42
- @errors.length == 0
43
- end
44
-
45
- def updated_node_version_file?
46
- node_version == File.open(".node-version").read.chomp
47
- end
48
-
49
- def updated_nvmrc_file?
50
- node_version == File.open(".nvmrc").read.chomp
51
- end
52
-
53
- def check_node_step_added_to_semahore_config?
54
- semaphore_config = YAML.load(File.open(".semaphore/semaphore.yml").read, aliases: true)
55
- semaphore_command = "sem-version node #{node_version}"
56
- semaphore_config["global_job_config"]["prologue"]["commands"].include?(semaphore_command)
57
- end
58
-
59
- def common_packages_latest_file
60
- NeetoCompliance::NeetoCommons.path.join "common_files/package-common.json"
61
- end
62
- end
63
- end
@@ -1,62 +0,0 @@
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 auto_correct!
20
- end
21
-
22
- def autofix_command
23
- command = ""
24
- command += "yarn remove #{@incorrect_dependencies[:misplacedDependencies]
25
- .join(" ")}\n" unless @incorrect_dependencies[:misplacedDependencies].empty?
26
- command += "yarn add #{@incorrect_dependencies[:dependencies]
27
- .join(" ")}\n" unless @incorrect_dependencies[:dependencies].empty?
28
- command += "yarn add -D #{@incorrect_dependencies[:devDependencies]
29
- .join(" ")}\n" unless @incorrect_dependencies[:devDependencies].empty?
30
- command
31
- end
32
-
33
- private
34
-
35
- def common_packages_latest_file
36
- NeetoCompliance::NeetoCommons.path.join "common_files/package-common.json"
37
- end
38
-
39
- def find_misplaced_dependencies
40
- project_dependencies = @project_package_json[:dependencies]
41
- @common_package_json[:devDependencies].inject([]) do |result, (package_name, latest_version)|
42
- next result unless project_dependencies.key?(package_name)
43
-
44
- @incorrect_dependencies[:devDependencies] |= ["\"#{package_name}@#{latest_version}\""]
45
- result.push("#{package_name}")
46
- end
47
- end
48
-
49
- def find_incorrect_dependencies(key)
50
- project_dependencies = @project_package_json[key]
51
- @common_package_json[key].inject([]) do |result, (package_name, latest_version)|
52
- next result if project_dependencies[package_name] == latest_version
53
-
54
- result.push("\"#{package_name}@#{latest_version}\"")
55
- end
56
- end
57
-
58
- def load_json_file(url)
59
- JSON.parse(open(url).read, symbolize_names: true)
60
- end
61
- end
62
- end
@@ -1,39 +0,0 @@
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 auto_correct!
18
- end
19
-
20
- def autofix_command
21
- return "" if @results.all?
22
-
23
- command = ""
24
- KEYS_TO_CHECK.each_with_index do |key, index|
25
- next if @results[index]
26
-
27
- command += "Replace the value of \"#{key}\" in package.json with:\n\n#{JSON.pretty_generate(@common_lint_staged[key])}\n\n"
28
- end
29
-
30
- command
31
- end
32
-
33
- private
34
-
35
- def common_packages_latest_file
36
- NeetoCompliance::NeetoCommons.path.join "common_files/package-common.json"
37
- end
38
- end
39
- end
@@ -1,22 +0,0 @@
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
@@ -1,25 +0,0 @@
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