use_packwerk 0.50.1 → 0.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb15c026447548ee39ac7e5b7ac49bcd1f21d37c92f1690aef7e2cfa278d1bf9
4
- data.tar.gz: e195eb9cbca25dccbd596335e84480570e7abd6272aff3b46b0a1adca3a91ca7
3
+ metadata.gz: f2b4528c3f2bf62833a4e6098e9f316e02ac3d26174738805c42da0461109415
4
+ data.tar.gz: 1d96176b9238a26ba97b82c5d231826f0a8485b8969bd9b74b13ed785cfbe917
5
5
  SHA512:
6
- metadata.gz: f5f2e2d7e0ad95a326fe8d83058db90822435922fd8756995529511c33e29ee5ae3e6c94c2b22a4572f8a39778d6a28d4a1e9eae06354a5f0e260b970f56b5be
7
- data.tar.gz: '0911b36eda7f8aeb187d70b0ae3cc66002984f5f9f0244400ad2a6a3a34147f370affe515094a8c65de2aeff0fd7f001f0d0c98ddd18392d257ca4b64c213c83'
6
+ metadata.gz: b2580a1e2bf19166f41e67ee0c6ad42052da9b49c3754251e9f898ba3839b41d29c68e97bc2a35ccd01b799078a6e6ebe2a00ec705e39b7e785c4b50169e35af
7
+ data.tar.gz: 923ebb508fcfc122d1a1e01c7a2a6e2849258bcfb99bc2d543bea3fecd43e7f64d9467c003034d167ba9f3c4e9f6b3091284915d7e0f98cbfbd8dd45d9dee940
@@ -9,6 +9,11 @@ module UsePackwerk
9
9
  const :destination_pathname, Pathname
10
10
  const :destination_pack, ParsePackwerk::Package
11
11
 
12
+ sig { returns(ParsePackwerk::Package) }
13
+ def origin_pack
14
+ T.must(ParsePackwerk.package_from_path(origin_pathname))
15
+ end
16
+
12
17
  sig { params(origin_pathname: Pathname, new_package_root: Pathname).returns(Pathname) }
13
18
  def self.destination_pathname_for_package_move(origin_pathname, new_package_root)
14
19
  parts = origin_pathname.to_s.split('/')
@@ -11,12 +11,38 @@ module UsePackwerk
11
11
  relative_path_to_destination = file_move_operation.destination_pathname
12
12
 
13
13
  rubocop_todo = Pathname.new('.rubocop_todo.yml')
14
- return if !rubocop_todo.exist?
15
- UsePackwerk.replace_in_file(
16
- file: rubocop_todo.to_s,
17
- find: relative_path_to_origin,
18
- replace_with: relative_path_to_destination,
19
- )
14
+ if rubocop_todo.exist?
15
+ UsePackwerk.replace_in_file(
16
+ file: rubocop_todo.to_s,
17
+ find: relative_path_to_origin,
18
+ replace_with: relative_path_to_destination,
19
+ )
20
+ end
21
+
22
+ if file_move_operation.origin_pack.name != ParsePackwerk::ROOT_PACKAGE_NAME && file_move_operation.destination_pack.name != ParsePackwerk::ROOT_PACKAGE_NAME
23
+ origin_rubocop_todo = file_move_operation.origin_pack.directory.join('.rubocop_todo.yml')
24
+ if origin_rubocop_todo.exist?
25
+ loaded_origin_rubocop_todo = YAML.load_file(origin_rubocop_todo)
26
+ new_origin_rubocop_todo = loaded_origin_rubocop_todo.dup
27
+
28
+ loaded_origin_rubocop_todo.each do |cop_name, cop_config|
29
+ if cop_config['Exclude'].include?(relative_path_to_origin.to_s)
30
+ new_origin_rubocop_todo[cop_name]['Exclude'] = cop_config['Exclude'] - [relative_path_to_origin.to_s]
31
+ origin_rubocop_todo.write(YAML.dump(new_origin_rubocop_todo))
32
+
33
+ destination_rubocop_todo = file_move_operation.destination_pack.directory.join('.rubocop_todo.yml')
34
+ if destination_rubocop_todo.exist?
35
+ new_destination_rubocop_todo = YAML.load_file(destination_rubocop_todo).dup
36
+ else
37
+ new_destination_rubocop_todo = { cop_name => { 'Exclude' => [] } }
38
+ end
39
+
40
+ new_destination_rubocop_todo[cop_name]['Exclude'] += [relative_path_to_destination.to_s]
41
+ destination_rubocop_todo.write(YAML.dump(new_destination_rubocop_todo))
42
+ end
43
+ end
44
+ end
45
+ end
20
46
  end
21
47
  end
22
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: use_packwerk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.50.1
4
+ version: 0.51.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-28 00:00:00.000000000 Z
11
+ date: 2022-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize