danger-packwerk 0.14.2 → 0.14.4

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: 11de71d95ae9ff78daff3f87835d184e206d6088ecece8608e03d7e42eaa0424
4
- data.tar.gz: 9386a9c42dbc1ef0fface734b0c6e1b9aa031629c46d3961364a37b1afda1b36
3
+ metadata.gz: f9961bce735a4a3e2ffd6e2f67719059652d08bcadcd06c8ab349b27452137e5
4
+ data.tar.gz: 3eca02e4593c388f7170036cc78fde2b4efa4b2fe616b3d1591acb68ecffe610
5
5
  SHA512:
6
- metadata.gz: 0114bf7aa642b184bd8ba990764eff04925bafd7defc7c3c77af8b4edcef5c576c8412471d5ab31e3150df4298582774b5f1943ad3106c04b3b0fa02c619fae6
7
- data.tar.gz: 05ec9637958c0f80a2f2ec0cd3d25578081fc015d98b9f1a7a5b296ef3a8c8e2304319ed6af8c3b4ceffb5a4e5e5f421596f92593ed1002690f60cbb465bd5f3
6
+ metadata.gz: 7167772693389751363dfd0c8e9956b30d7e2a237265d625f54de748453a3585a40b5e165e18bc6672d241344da08f216fd3614c031e9eea12b0e6eecca08c07
7
+ data.tar.gz: 0a8df0931b48669d9cb3d779824c6391622666c7614ca4fffa1cf03e83d1ba63ac891a7b621f736b1ddeeec0044694fc93c2ea15dbee4d633acd9cec52e1621c
@@ -88,8 +88,13 @@ module DangerPackwerk
88
88
  # the constant and only the constant.
89
89
  # Right now `packwerk` `package_todo.yml` files typically use double quotes, but sometimes folks linters change this to single quotes.
90
90
  # To be defensive, we match against either.
91
- class_name_with_quote_boundaries = /["|']#{violation.class_name}["|']:/
92
- line.match?(class_name_with_quote_boundaries)
91
+
92
+ patterns = [
93
+ /["|']#{violation.class_name}["|']:/,
94
+ /\? ["|']#{violation.class_name}["|']$/ # for keys that use explicit mapping syntax
95
+ ]
96
+
97
+ patterns.any? { |p| line.match?(p) }
93
98
  end
94
99
 
95
100
  if class_name_line_number.nil?
@@ -20,9 +20,9 @@ module DangerPackwerk
20
20
  BeforeComment = T.type_alias { T.proc.params(violation_diff: ViolationDiff, changed_package_todo_ymls: T::Array[String]).void }
21
21
  DEFAULT_BEFORE_COMMENT = T.let(->(violation_diff, changed_package_todo_ymls) {}, BeforeComment)
22
22
  DEFAULT_VIOLATION_TYPES = T.let([
23
- DEPENDENCY_VIOLATION_TYPE,
24
- PRIVACY_VIOLATION_TYPE
25
- ], T::Array[String])
23
+ DEPENDENCY_VIOLATION_TYPE,
24
+ PRIVACY_VIOLATION_TYPE
25
+ ].freeze, T::Array[String])
26
26
 
27
27
  sig do
28
28
  params(
@@ -47,7 +47,7 @@ module DangerPackwerk
47
47
  git_filesystem = Private::GitFilesystem.new(git: git, root: root_path || '')
48
48
  changed_package_todo_ymls = (git_filesystem.modified_files + git_filesystem.added_files + git_filesystem.deleted_files).grep(PACKAGE_TODO_PATTERN)
49
49
 
50
- violation_diff = get_violation_diff(violation_types, root_path: root_path)
50
+ violation_diff = DangerPackageTodoYmlChanges.get_violation_diff(violation_types, git: git, root_path: root_path)
51
51
 
52
52
  before_comment.call(
53
53
  violation_diff,
@@ -74,10 +74,11 @@ module DangerPackwerk
74
74
  sig do
75
75
  params(
76
76
  violation_types: T::Array[String],
77
+ git: Danger::DangerfileGitPlugin,
77
78
  root_path: T.nilable(String)
78
79
  ).returns(ViolationDiff)
79
80
  end
80
- def get_violation_diff(violation_types, root_path: nil)
81
+ def self.get_violation_diff(violation_types, git:, root_path: nil)
81
82
  git_filesystem = Private::GitFilesystem.new(git: git, root: root_path || '')
82
83
 
83
84
  added_violations, removed_violations = Private::TodoYmlChanges.get_reference_offenses(
@@ -23,9 +23,9 @@ module DangerPackwerk
23
23
  DEFAULT_FAIL = false
24
24
  DEFAULT_FAILURE_MESSAGE = 'Packwerk violations were detected! Please resolve them to unblock the build.'
25
25
  DEFAULT_VIOLATION_TYPES = T.let([
26
- DEPENDENCY_VIOLATION_TYPE,
27
- PRIVACY_VIOLATION_TYPE
28
- ], T::Array[String])
26
+ DEPENDENCY_VIOLATION_TYPE,
27
+ PRIVACY_VIOLATION_TYPE
28
+ ].freeze, T::Array[String])
29
29
 
30
30
  class CommentGroupingStrategy < ::T::Enum
31
31
  enums do
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module DangerPackwerk
5
- VERSION = '0.14.2'
5
+ VERSION = '0.14.4'
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-packwerk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.2
4
+ version: 0.14.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-01 00:00:00.000000000 Z
11
+ date: 2024-05-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: code_ownership
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: packs
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: packwerk
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -140,30 +154,30 @@ dependencies:
140
154
  name: rubocop
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - ">="
157
+ - - "~>"
144
158
  - !ruby/object:Gem::Version
145
- version: '0'
159
+ version: 1.26.0
146
160
  type: :development
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - ">="
164
+ - - "~>"
151
165
  - !ruby/object:Gem::Version
152
- version: '0'
166
+ version: 1.26.0
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: rubocop-sorbet
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
- - - ">="
171
+ - - "~>"
158
172
  - !ruby/object:Gem::Version
159
- version: '0'
173
+ version: 0.6.0
160
174
  type: :development
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
- - - ">="
178
+ - - "~>"
165
179
  - !ruby/object:Gem::Version
166
- version: '0'
180
+ version: 0.6.0
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: sorbet
169
183
  requirement: !ruby/object:Gem::Requirement
@@ -224,7 +238,7 @@ metadata:
224
238
  source_code_uri: https://github.com/rubyatscale/danger-packwerk
225
239
  changelog_uri: https://github.com/rubyatscale/danger-packwerk/releases
226
240
  allowed_push_host: https://rubygems.org
227
- post_install_message:
241
+ post_install_message:
228
242
  rdoc_options: []
229
243
  require_paths:
230
244
  - lib
@@ -239,8 +253,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
253
  - !ruby/object:Gem::Version
240
254
  version: '0'
241
255
  requirements: []
242
- rubygems_version: 3.1.6
243
- signing_key:
256
+ rubygems_version: 3.5.9
257
+ signing_key:
244
258
  specification_version: 4
245
259
  summary: Danger plugin for packwerk.
246
260
  test_files: []