use_packs 0.0.20 → 0.0.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e5ff298c66cd0240894575bbcd27229d27370a946f59578c21f650de6fbb699
4
- data.tar.gz: 8863e9d1fd26bbbe3fa512b06f3338e05d0de0d552febd207989d229f07f76c6
3
+ metadata.gz: edbbbd952d5fb5bf816ed8fb6b00602294b56eb69066711f538f0f8814468835
4
+ data.tar.gz: ee055d83a864cf30dad3010a852e5c354d5efc2c0c08e841ebe8c7ce928226ec
5
5
  SHA512:
6
- metadata.gz: aa284550c2ffe844c552568ec06985b5d8bf95ebab863b7ceafbad9b28b84604eec045fc9ea56c9c0c73608507406c20eed4c1d1cd932b3c05855eb963eb7359
7
- data.tar.gz: 8a186d4871ea6860535dba32a427d9a62c09b0bb92597d168a009d8c49def298877ac5437d7b979f9818b671ffa31dee806c738f7c7afe759734eb5d96347d44
6
+ metadata.gz: adb834a9132aeebe36016a423b51ac7103f72a9ee7262f1bf8b5ac7c6447e31f0088e4d331e6fbbbf923a043c6696993455cd7ad21cca445784cea29bfc9bc5b
7
+ data.tar.gz: 6adc850cc9d58a0f12c2eb7f6cae80f7d871d1beb725ff14c64198c0647865042bd0bf9bd0169cb50033e0bfe8f8e854662c7ae1ac4793ebfd4e1adebc5922b2
data/README.md CHANGED
@@ -70,9 +70,6 @@ Make sure there are no spaces between the comma-separated list of paths of direc
70
70
  ## Run bin/packwerk update-todo
71
71
  `bin/packs update`
72
72
 
73
- ## Regenerate packs/*/package_rubocop_todo.yml for one or more packs
74
- `bin/packs regenerate_rubocop_todo [ packs/my_pack packs/my_other_pack ]`
75
-
76
73
  ## Get info about size and violations for packs
77
74
  `bin/packs get_info [ packs/my_pack packs/my_other_pack ]`
78
75
 
data/lib/use_packs/cli.rb CHANGED
@@ -123,12 +123,6 @@ module UsePacks
123
123
  system('bin/packwerk update-todo')
124
124
  end
125
125
 
126
- desc 'regenerate_rubocop_todo [ packs/my_pack packs/my_other_pack ]', "Regenerate packs/*/#{RuboCop::Packs::PACK_LEVEL_RUBOCOP_TODO_YML} for one or more packs"
127
- sig { params(pack_names: String).void }
128
- def regenerate_rubocop_todo(*pack_names)
129
- RuboCop::Packs.regenerate_todo(packs: parse_pack_names(pack_names))
130
- end
131
-
132
126
  desc 'get_info [ packs/my_pack packs/my_other_pack ]', 'Get info about size and violations for packs'
133
127
  sig { params(pack_names: String).void }
134
128
  def get_info(*pack_names)
@@ -18,7 +18,6 @@ require 'use_packs/private/interactive_cli/use_cases/rename'
18
18
  require 'use_packs/private/interactive_cli/use_cases/check'
19
19
  require 'use_packs/private/interactive_cli/use_cases/update'
20
20
  require 'use_packs/private/interactive_cli/use_cases/validate'
21
- require 'use_packs/private/interactive_cli/use_cases/regenerate_rubocop_todo'
22
21
  require 'use_packs/private/interactive_cli/use_cases/lint_package_yml_files'
23
22
  require 'use_packs/private/interactive_cli/use_cases/visualize'
24
23
 
@@ -388,8 +388,6 @@ module UsePacks
388
388
  )
389
389
 
390
390
  ParsePackwerk.write_package_yml!(package)
391
- pack = Packs.find(package.name)
392
- RuboCop::Packs.set_default_rubocop_yml(packs: [pack].compact)
393
391
 
394
392
  current_contents = package.yml.read
395
393
  new_contents = current_contents.gsub('MyTeam', 'MyTeam # specify your team here, or delete this key if this package is not owned by one team')
@@ -592,10 +590,7 @@ module UsePacks
592
590
 
593
591
  sig { params(packs: T::Array[Packs::Pack]).void }
594
592
  def self.visualize(packs: Packs.all)
595
- packwerk_packages = packs.map do |pack|
596
- T.must(ParsePackwerk.find(pack.name))
597
- end
598
- VisualizePackwerk.package_graph!(packwerk_packages)
593
+ VisualizePackwerk.package_graph!(packs)
599
594
  end
600
595
 
601
596
  sig { returns(String) }
@@ -20,52 +20,6 @@ module UsePacks
20
20
  replace_with: relative_path_to_destination
21
21
  )
22
22
  end
23
-
24
- if file_move_operation.origin_pack.name != ParsePackwerk::ROOT_PACKAGE_NAME && file_move_operation.destination_pack.name != ParsePackwerk::ROOT_PACKAGE_NAME
25
- origin_rubocop_todo = file_move_operation.origin_pack.directory.join(RuboCop::Packs::PACK_LEVEL_RUBOCOP_TODO_YML)
26
- # If there were TODOs for this file in the origin pack's pack-based rubocop, we want to move it to the destination
27
- if origin_rubocop_todo.exist?
28
- loaded_origin_rubocop_todo = YAML.load_file(origin_rubocop_todo)
29
- new_origin_rubocop_todo = loaded_origin_rubocop_todo.dup
30
-
31
- loaded_origin_rubocop_todo.each do |cop_name, cop_config|
32
- next unless cop_config['Exclude'].include?(relative_path_to_origin.to_s)
33
-
34
- new_origin_rubocop_todo[cop_name]['Exclude'] = cop_config['Exclude'] - [relative_path_to_origin.to_s]
35
- origin_rubocop_todo.write(YAML.dump(new_origin_rubocop_todo))
36
-
37
- destination_rubocop_todo = file_move_operation.destination_pack.directory.join(RuboCop::Packs::PACK_LEVEL_RUBOCOP_TODO_YML)
38
- if destination_rubocop_todo.exist?
39
- new_destination_rubocop_todo = YAML.load_file(destination_rubocop_todo).dup
40
- else
41
- new_destination_rubocop_todo = {}
42
- end
43
-
44
- new_destination_rubocop_todo[cop_name] ||= { 'Exclude' => [] }
45
-
46
- new_destination_rubocop_todo[cop_name]['Exclude'] += [relative_path_to_destination.to_s]
47
- destination_rubocop_todo.write(YAML.dump(new_destination_rubocop_todo))
48
- end
49
- end
50
- end
51
- end
52
-
53
- sig { params(file_move_operations: T::Array[Private::FileMoveOperation]).void }
54
- def after_move_files!(file_move_operations)
55
- return unless rubocop_enabled?
56
-
57
- # There could also be no TODOs for this file, but moving it produced TODOs. This could happen if:
58
- # 1) The origin pack did not enforce a rubocop, such as typed public APIs
59
- # 2) The file satisfied the cop in the origin pack, such as the Packs/RootNamespaceIsPackName, but the desired
60
- # namespace changed once the file was moved to a different pack.
61
- files = []
62
- file_move_operations.each do |file_move_operation|
63
- if file_move_operation.destination_pathname.exist?
64
- files << file_move_operation.destination_pathname.to_s
65
- end
66
- end
67
-
68
- RuboCop::Packs.regenerate_todo(files: files)
69
23
  end
70
24
 
71
25
  sig { returns(T::Boolean) }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: use_packs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-05-17 00:00:00.000000000 Z
11
+ date: 2023-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: code_ownership
@@ -326,7 +326,6 @@ files:
326
326
  - lib/use_packs/private/interactive_cli/use_cases/move.rb
327
327
  - lib/use_packs/private/interactive_cli/use_cases/move_to_parent.rb
328
328
  - lib/use_packs/private/interactive_cli/use_cases/query.rb
329
- - lib/use_packs/private/interactive_cli/use_cases/regenerate_rubocop_todo.rb
330
329
  - lib/use_packs/private/interactive_cli/use_cases/rename.rb
331
330
  - lib/use_packs/private/interactive_cli/use_cases/update.rb
332
331
  - lib/use_packs/private/interactive_cli/use_cases/validate.rb
@@ -1,26 +0,0 @@
1
- # typed: strict
2
-
3
- module UsePacks
4
- module Private
5
- module InteractiveCli
6
- module UseCases
7
- class RegenerateRubocopTodo
8
- extend T::Sig
9
- extend T::Helpers
10
- include Interface
11
-
12
- sig { override.params(prompt: TTY::Prompt).void }
13
- def perform!(prompt)
14
- packs = PackSelector.single_or_all_pack_multi_select(prompt, question_text: "Please select the packs you want to regenerate `#{RuboCop::Packs::PACK_LEVEL_RUBOCOP_TODO_YML}` for")
15
- RuboCop::Packs.regenerate_todo(packs: packs)
16
- end
17
-
18
- sig { override.returns(String) }
19
- def user_facing_name
20
- "Regenerate packs/*/#{RuboCop::Packs::PACK_LEVEL_RUBOCOP_TODO_YML} for one or more packs"
21
- end
22
- end
23
- end
24
- end
25
- end
26
- end