danger-packwerk 0.9.0 → 0.10.0

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: cf8895f7ae2e94e0b1d09e146176b6777ba8f952fe03381380071114fcec2bd4
4
- data.tar.gz: 2e68e2096375433cfad68d85ca8d5eac7855dcb542b34f79417a53b1e4c9eb1b
3
+ metadata.gz: 312a8c57ba777586f14b9464935701ec657c74537f5811e0cdd4d9484f6f1964
4
+ data.tar.gz: 6590f28585fc4e0b03c303fb968dfd8cb889348adf2aa2a71f9d901b9e8749d9
5
5
  SHA512:
6
- metadata.gz: bfbe7e86650ac170c89c014f7519d0d40abdb3d864b995d8cdb5ef2478ec3e4fe6f2e3afc4854dbc216e622a8adc99761bd7d9a420167553db6b70084446740f
7
- data.tar.gz: b6729e1b52a5f25ae5da573d706bb1f3fc4217c750976dcd51aafd7611a5c7f53b4851727e3fd20cb66065570d2a99b0c4a4c367572c84fc08fb6918dfdfeb6b
6
+ metadata.gz: ef0f83f1481c5e3362e03fd684dc8aa9a404cda136669b3146666cd1bb26dae15c3c0660033d9bbac52affd23a83005a218462223d623e97d8c73a6be563e2ba
7
+ data.tar.gz: 8cb95942be98ed171a421abd6008ed052803b3ec8502291e04201c5226b53f9a00dbd683c76618b25f3da5883d62bce1e6a9cdfbbe1d1c925feed404a6849890
@@ -47,7 +47,7 @@ module DangerPackwerk
47
47
 
48
48
  from_package = ParsePackwerk.package_from_path(package_todo_yml_pathname)
49
49
  from_package_name = from_package.name
50
- violations = Private::PackageTodo.from(package_todo_yml_pathname).violations
50
+ violations = ParsePackwerk::PackageTodo.from(package_todo_yml_pathname).violations
51
51
 
52
52
  # See the larger comment below for more information on why we need this information.
53
53
  # This is a small optimization that lets us find the location of referenced files within
@@ -19,18 +19,24 @@ module DangerPackwerk
19
19
  DEFAULT_MAX_COMMENTS = 5
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
+ DEFAULT_VIOLATION_TYPES = T.let([
23
+ DEPENDENCY_VIOLATION_TYPE,
24
+ PRIVACY_VIOLATION_TYPE
25
+ ], T::Array[String])
22
26
 
23
27
  sig do
24
28
  params(
25
29
  offenses_formatter: T.nilable(Update::OffensesFormatter),
26
30
  before_comment: BeforeComment,
27
- max_comments: Integer
31
+ max_comments: Integer,
32
+ violation_types: T::Array[String]
28
33
  ).void
29
34
  end
30
35
  def check(
31
36
  offenses_formatter: nil,
32
37
  before_comment: DEFAULT_BEFORE_COMMENT,
33
- max_comments: DEFAULT_MAX_COMMENTS
38
+ max_comments: DEFAULT_MAX_COMMENTS,
39
+ violation_types: DEFAULT_VIOLATION_TYPES
34
40
  )
35
41
  offenses_formatter ||= Update::DefaultFormatter.new
36
42
  repo_link = github.pr_json[:base][:repo][:html_url]
@@ -38,7 +44,7 @@ module DangerPackwerk
38
44
 
39
45
  changed_package_todo_ymls = (git.modified_files + git.added_files + git.deleted_files).grep(PACKAGE_TODO_PATTERN)
40
46
 
41
- violation_diff = get_violation_diff
47
+ violation_diff = get_violation_diff(violation_types)
42
48
 
43
49
  before_comment.call(
44
50
  violation_diff,
@@ -62,8 +68,8 @@ module DangerPackwerk
62
68
  end
63
69
  end
64
70
 
65
- sig { returns(ViolationDiff) }
66
- def get_violation_diff # rubocop:disable Naming/AccessorMethodName
71
+ sig { params(violation_types: T::Array[String]).returns(ViolationDiff) }
72
+ def get_violation_diff(violation_types)
67
73
  added_violations = T.let([], T::Array[BasicReferenceOffense])
68
74
  removed_violations = T.let([], T::Array[BasicReferenceOffense])
69
75
 
@@ -117,12 +123,18 @@ module DangerPackwerk
117
123
  end
118
124
 
119
125
  relevant_added_violations = added_violations.reject do |violation|
120
- renamed_files_after.include?(violation.file) || renamed_constants.include?(violation.class_name)
126
+ renamed_files_after.include?(violation.file) ||
127
+ renamed_constants.include?(violation.class_name) ||
128
+ !violation_types.include?(violation.type)
129
+ end
130
+
131
+ relevant_removed_violations = removed_violations.select do |violation|
132
+ violation_types.include?(violation.type)
121
133
  end
122
134
 
123
135
  ViolationDiff.new(
124
136
  added_violations: relevant_added_violations,
125
- removed_violations: removed_violations
137
+ removed_violations: relevant_removed_violations
126
138
  )
127
139
  end
128
140
 
@@ -21,6 +21,10 @@ module DangerPackwerk
21
21
  DEFAULT_ON_FAILURE = T.let(->(offenses) {}, OnFailure)
22
22
  DEFAULT_FAIL = false
23
23
  DEFAULT_FAILURE_MESSAGE = 'Packwerk violations were detected! Please resolve them to unblock the build.'
24
+ DEFAULT_VIOLATION_TYPES = T.let([
25
+ DEPENDENCY_VIOLATION_TYPE,
26
+ PRIVACY_VIOLATION_TYPE
27
+ ], T::Array[String])
24
28
 
25
29
  class CommentGroupingStrategy < ::T::Enum
26
30
  enums do
@@ -38,6 +42,7 @@ module DangerPackwerk
38
42
  fail_build: T::Boolean,
39
43
  failure_message: String,
40
44
  on_failure: OnFailure,
45
+ violation_types: T::Array[String],
41
46
  grouping_strategy: CommentGroupingStrategy
42
47
  ).void
43
48
  end
@@ -47,6 +52,7 @@ module DangerPackwerk
47
52
  fail_build: DEFAULT_FAIL,
48
53
  failure_message: DEFAULT_FAILURE_MESSAGE,
49
54
  on_failure: DEFAULT_ON_FAILURE,
55
+ violation_types: DEFAULT_VIOLATION_TYPES,
50
56
  grouping_strategy: CommentGroupingStrategy::PerConstantPerLocation
51
57
  )
52
58
  offenses_formatter ||= Check::DefaultFormatter.new
@@ -88,11 +94,13 @@ module DangerPackwerk
88
94
 
89
95
  renamed_files = git.renamed_files.map { |before_after_file| before_after_file[:after] }
90
96
 
91
- # Ignore references that have been renamed
92
97
  packwerk_reference_offenses_to_care_about = packwerk_reference_offenses.reject do |packwerk_reference_offense|
93
98
  constant_name = packwerk_reference_offense.reference.constant.name
94
99
  filepath_that_defines_this_constant = Private.constant_resolver.resolve(constant_name)&.location
95
- renamed_files.include?(filepath_that_defines_this_constant)
100
+ # Ignore references that have been renamed
101
+ renamed_files.include?(filepath_that_defines_this_constant) ||
102
+ # Ignore violations that are not in the allow-list of violation types to leave comments for
103
+ !violation_types.include?(packwerk_reference_offense.violation_type)
96
104
  end
97
105
 
98
106
  # We group by the constant name, line number, and reference path. Any offenses with these same values should only differ on what type of violation
@@ -1,6 +1,5 @@
1
1
  # typed: strict
2
2
 
3
- require 'danger-packwerk/private/package_todo'
4
3
  require 'danger-packwerk/private/ownership_information'
5
4
  require 'constant_resolver'
6
5
 
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module DangerPackwerk
5
- VERSION = '0.9.0'
5
+ VERSION = '0.10.0'
6
6
  end
@@ -0,0 +1,224 @@
1
+ # typed: true
2
+
3
+ # DO NOT EDIT MANUALLY
4
+ # This is an autogenerated file for types exported from the `parse_packwerk` gem.
5
+ # Please instead update this file by running `bin/tapioca gem parse_packwerk`.
6
+
7
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#3
8
+ module ParsePackwerk
9
+ class << self
10
+ # source://parse_packwerk//lib/parse_packwerk.rb#28
11
+ sig { returns(T::Array[::ParsePackwerk::Package]) }
12
+ def all; end
13
+
14
+ # source://parse_packwerk//lib/parse_packwerk.rb#112
15
+ sig { void }
16
+ def bust_cache!; end
17
+
18
+ # source://parse_packwerk//lib/parse_packwerk.rb#33
19
+ sig { params(name: ::String).returns(T.nilable(::ParsePackwerk::Package)) }
20
+ def find(name); end
21
+
22
+ # source://parse_packwerk//lib/parse_packwerk.rb#43
23
+ sig { params(file_path: T.any(::Pathname, ::String)).returns(::ParsePackwerk::Package) }
24
+ def package_from_path(file_path); end
25
+
26
+ # source://parse_packwerk//lib/parse_packwerk.rb#54
27
+ sig { params(package: ::ParsePackwerk::Package).void }
28
+ def write_package_yml!(package); end
29
+
30
+ # source://parse_packwerk//lib/parse_packwerk.rb#38
31
+ sig { returns(::ParsePackwerk::Configuration) }
32
+ def yml; end
33
+
34
+ private
35
+
36
+ # We memoize packages_by_name for fast lookup.
37
+ # Since Graph is an immutable value object, we can create indexes and general caching mechanisms safely.
38
+ #
39
+ # source://parse_packwerk//lib/parse_packwerk.rb#100
40
+ sig { returns(T::Hash[::String, ::ParsePackwerk::Package]) }
41
+ def packages_by_name; end
42
+ end
43
+ end
44
+
45
+ # source://parse_packwerk//lib/parse_packwerk/configuration.rb#4
46
+ class ParsePackwerk::Configuration < ::T::Struct
47
+ const :exclude, T::Array[::String]
48
+ const :package_paths, T::Array[::String]
49
+
50
+ class << self
51
+ # source://parse_packwerk//lib/parse_packwerk/configuration.rb#28
52
+ sig { params(config_hash: T::Hash[T.untyped, T.untyped]).returns(T::Array[::String]) }
53
+ def excludes(config_hash); end
54
+
55
+ # source://parse_packwerk//lib/parse_packwerk/configuration.rb#11
56
+ sig { returns(::ParsePackwerk::Configuration) }
57
+ def fetch; end
58
+
59
+ # source://sorbet-runtime/0.5.10588/lib/types/struct.rb#13
60
+ def inherited(s); end
61
+
62
+ # source://parse_packwerk//lib/parse_packwerk/configuration.rb#40
63
+ sig { params(config_hash: T::Hash[T.untyped, T.untyped]).returns(T::Array[::String]) }
64
+ def package_paths(config_hash); end
65
+ end
66
+ end
67
+
68
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#22
69
+ ParsePackwerk::DEFAULT_EXCLUDE_GLOBS = T.let(T.unsafe(nil), Array)
70
+
71
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#23
72
+ ParsePackwerk::DEFAULT_PACKAGE_PATHS = T.let(T.unsafe(nil), Array)
73
+
74
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#24
75
+ ParsePackwerk::DEFAULT_PUBLIC_PATH = T.let(T.unsafe(nil), String)
76
+
77
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#14
78
+ ParsePackwerk::DEPENDENCIES = T.let(T.unsafe(nil), String)
79
+
80
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#10
81
+ ParsePackwerk::DEPENDENCY_VIOLATION_TYPE = T.let(T.unsafe(nil), String)
82
+
83
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#8
84
+ ParsePackwerk::ENFORCE_DEPENDENCIES = T.let(T.unsafe(nil), String)
85
+
86
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#9
87
+ ParsePackwerk::ENFORCE_PRIVACY = T.let(T.unsafe(nil), String)
88
+
89
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#13
90
+ ParsePackwerk::METADATA = T.let(T.unsafe(nil), String)
91
+
92
+ # Since this metadata is unstructured YAML, it could be any type. We leave it to clients of `ParsePackwerk::Package`
93
+ # to add types based on their known usage of metadata.
94
+ #
95
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#18
96
+ ParsePackwerk::MetadataYmlType = T.type_alias { T::Hash[T.untyped, T.untyped] }
97
+
98
+ # source://parse_packwerk//lib/parse_packwerk.rb#14
99
+ class ParsePackwerk::MissingConfiguration < ::StandardError
100
+ # source://parse_packwerk//lib/parse_packwerk.rb#18
101
+ sig { params(packwerk_file_name: ::Pathname).void }
102
+ def initialize(packwerk_file_name); end
103
+ end
104
+
105
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#7
106
+ ParsePackwerk::PACKAGE_TODO_YML_NAME = T.let(T.unsafe(nil), String)
107
+
108
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#5
109
+ ParsePackwerk::PACKAGE_YML_NAME = T.let(T.unsafe(nil), String)
110
+
111
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#6
112
+ ParsePackwerk::PACKWERK_YML_NAME = T.let(T.unsafe(nil), String)
113
+
114
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#11
115
+ ParsePackwerk::PRIVACY_VIOLATION_TYPE = T.let(T.unsafe(nil), String)
116
+
117
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#12
118
+ ParsePackwerk::PUBLIC_PATH = T.let(T.unsafe(nil), String)
119
+
120
+ # source://parse_packwerk//lib/parse_packwerk/package.rb#4
121
+ class ParsePackwerk::Package < ::T::Struct
122
+ const :name, ::String
123
+ const :enforce_dependencies, T::Boolean
124
+ const :enforce_privacy, T::Boolean
125
+ const :public_path, ::String, default: T.unsafe(nil)
126
+ const :metadata, T::Hash[T.untyped, T.untyped]
127
+ const :dependencies, T::Array[::String]
128
+
129
+ # source://parse_packwerk//lib/parse_packwerk/package.rb#35
130
+ sig { returns(::Pathname) }
131
+ def directory; end
132
+
133
+ # source://parse_packwerk//lib/parse_packwerk/package.rb#45
134
+ sig { returns(T::Boolean) }
135
+ def enforces_dependencies?; end
136
+
137
+ # source://parse_packwerk//lib/parse_packwerk/package.rb#50
138
+ sig { returns(T::Boolean) }
139
+ def enforces_privacy?; end
140
+
141
+ # source://parse_packwerk//lib/parse_packwerk/package.rb#40
142
+ sig { returns(::Pathname) }
143
+ def public_directory; end
144
+
145
+ # source://parse_packwerk//lib/parse_packwerk/package.rb#55
146
+ sig { returns(T::Array[::ParsePackwerk::Violation]) }
147
+ def violations; end
148
+
149
+ # source://parse_packwerk//lib/parse_packwerk/package.rb#30
150
+ sig { returns(::Pathname) }
151
+ def yml; end
152
+
153
+ class << self
154
+ # source://parse_packwerk//lib/parse_packwerk/package.rb#15
155
+ sig { params(pathname: ::Pathname).returns(::ParsePackwerk::Package) }
156
+ def from(pathname); end
157
+
158
+ # source://sorbet-runtime/0.5.10588/lib/types/struct.rb#13
159
+ def inherited(s); end
160
+ end
161
+ end
162
+
163
+ # source://parse_packwerk//lib/parse_packwerk/package_set.rb#8
164
+ class ParsePackwerk::PackageSet
165
+ class << self
166
+ # source://parse_packwerk//lib/parse_packwerk/package_set.rb#12
167
+ sig do
168
+ params(
169
+ package_pathspec: T::Array[::String],
170
+ exclude_pathspec: T::Array[::String]
171
+ ).returns(T::Array[::ParsePackwerk::Package])
172
+ end
173
+ def from(package_pathspec:, exclude_pathspec:); end
174
+
175
+ private
176
+
177
+ # source://parse_packwerk//lib/parse_packwerk/package_set.rb#28
178
+ sig { params(globs: T::Array[::String], path: ::Pathname).returns(T::Boolean) }
179
+ def exclude_path?(globs, path); end
180
+ end
181
+ end
182
+
183
+ # source://parse_packwerk//lib/parse_packwerk/package_todo.rb#4
184
+ class ParsePackwerk::PackageTodo < ::T::Struct
185
+ const :pathname, ::Pathname
186
+ const :violations, T::Array[::ParsePackwerk::Violation]
187
+
188
+ class << self
189
+ # source://parse_packwerk//lib/parse_packwerk/package_todo.rb#11
190
+ sig { params(package: ::ParsePackwerk::Package).returns(::ParsePackwerk::PackageTodo) }
191
+ def for(package); end
192
+
193
+ # source://parse_packwerk//lib/parse_packwerk/package_todo.rb#17
194
+ sig { params(pathname: ::Pathname).returns(::ParsePackwerk::PackageTodo) }
195
+ def from(pathname); end
196
+
197
+ # source://sorbet-runtime/0.5.10588/lib/types/struct.rb#13
198
+ def inherited(s); end
199
+ end
200
+ end
201
+
202
+ # source://parse_packwerk//lib/parse_packwerk/constants.rb#4
203
+ ParsePackwerk::ROOT_PACKAGE_NAME = T.let(T.unsafe(nil), String)
204
+
205
+ # source://parse_packwerk//lib/parse_packwerk/violation.rb#4
206
+ class ParsePackwerk::Violation < ::T::Struct
207
+ const :type, ::String
208
+ const :to_package_name, ::String
209
+ const :class_name, ::String
210
+ const :files, T::Array[::String]
211
+
212
+ # source://parse_packwerk//lib/parse_packwerk/violation.rb#13
213
+ sig { returns(T::Boolean) }
214
+ def dependency?; end
215
+
216
+ # source://parse_packwerk//lib/parse_packwerk/violation.rb#18
217
+ sig { returns(T::Boolean) }
218
+ def privacy?; end
219
+
220
+ class << self
221
+ # source://sorbet-runtime/0.5.10588/lib/types/struct.rb#13
222
+ def inherited(s); end
223
+ end
224
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-packwerk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers
@@ -209,7 +209,6 @@ files:
209
209
  - lib/danger-packwerk/packwerk_wrapper.rb
210
210
  - lib/danger-packwerk/private.rb
211
211
  - lib/danger-packwerk/private/ownership_information.rb
212
- - lib/danger-packwerk/private/package_todo.rb
213
212
  - lib/danger-packwerk/update/default_formatter.rb
214
213
  - lib/danger-packwerk/update/offenses_formatter.rb
215
214
  - lib/danger-packwerk/version.rb
@@ -263,7 +262,7 @@ files:
263
262
  - sorbet/rbi/gems/open4@1.3.4.rbi
264
263
  - sorbet/rbi/gems/packwerk@2.2.1-7e8e7a50705833b41fe40c201eadb85ff9a1a422.rbi
265
264
  - sorbet/rbi/gems/parallel@1.22.1.rbi
266
- - sorbet/rbi/gems/parse_packwerk@0.12.1.rbi
265
+ - sorbet/rbi/gems/parse_packwerk@0.16.0.rbi
267
266
  - sorbet/rbi/gems/parser@3.1.2.1.rbi
268
267
  - sorbet/rbi/gems/pry@0.14.1.rbi
269
268
  - sorbet/rbi/gems/public_suffix@5.0.0.rbi
@@ -1,65 +0,0 @@
1
- # typed: strict
2
-
3
- module DangerPackwerk
4
- module Private
5
- #
6
- # The `Violation` and `PackageTodo` classes come from Gusto's private `ParsePackwerk` gem.
7
- # Until we decide to open source that gem, we inline these as a private implementation detail of `DangerPackwerk` for now.
8
- #
9
- class Violation < T::Struct
10
- extend T::Sig
11
-
12
- const :type, String
13
- const :to_package_name, String
14
- const :class_name, String
15
- const :files, T::Array[String]
16
-
17
- sig { returns(T::Boolean) }
18
- def dependency?
19
- type == 'dependency'
20
- end
21
-
22
- sig { returns(T::Boolean) }
23
- def privacy?
24
- type == 'privacy'
25
- end
26
- end
27
-
28
- class PackageTodo < T::Struct
29
- extend T::Sig
30
-
31
- const :pathname, Pathname
32
- const :violations, T::Array[Violation]
33
-
34
- sig { params(pathname: Pathname).returns(PackageTodo) }
35
- def self.from(pathname)
36
- if pathname.exist?
37
- package_todo_loaded_yml = YAML.load_file(pathname)
38
-
39
- all_violations = []
40
- package_todo_loaded_yml&.each_key do |to_package_name|
41
- package_todo_per_package = package_todo_loaded_yml[to_package_name]
42
- package_todo_per_package.each_key do |class_name|
43
- symbol_usage = package_todo_per_package[class_name]
44
- files = symbol_usage['files']
45
- violations = symbol_usage['violations']
46
- all_violations << Violation.new(type: 'dependency', to_package_name: to_package_name, class_name: class_name, files: files) if violations.include? 'dependency'
47
-
48
- all_violations << Violation.new(type: 'privacy', to_package_name: to_package_name, class_name: class_name, files: files) if violations.include? 'privacy'
49
- end
50
- end
51
-
52
- new(
53
- pathname: pathname.cleanpath,
54
- violations: all_violations
55
- )
56
- else
57
- new(
58
- pathname: pathname.cleanpath,
59
- violations: []
60
- )
61
- end
62
- end
63
- end
64
- end
65
- end
@@ -1,146 +0,0 @@
1
- # typed: true
2
-
3
- # DO NOT EDIT MANUALLY
4
- # This is an autogenerated file for types exported from the `parse_packwerk` gem.
5
- # Please instead update this file by running `bin/tapioca gem parse_packwerk`.
6
-
7
- module ParsePackwerk
8
- class << self
9
- sig { returns(T::Array[::ParsePackwerk::Package]) }
10
- def all; end
11
-
12
- sig { void }
13
- def bust_cache!; end
14
-
15
- sig { params(name: ::String).returns(T.nilable(::ParsePackwerk::Package)) }
16
- def find(name); end
17
-
18
- sig { params(file_path: T.any(::Pathname, ::String)).returns(::ParsePackwerk::Package) }
19
- def package_from_path(file_path); end
20
-
21
- sig { params(package: ::ParsePackwerk::Package).void }
22
- def write_package_yml!(package); end
23
-
24
- sig { returns(::ParsePackwerk::Configuration) }
25
- def yml; end
26
-
27
- private
28
-
29
- sig { returns(T::Hash[::String, ::ParsePackwerk::Package]) }
30
- def packages_by_name; end
31
- end
32
- end
33
-
34
- class ParsePackwerk::Configuration < ::T::Struct
35
- const :exclude, T::Array[::String]
36
- const :package_paths, T::Array[::String]
37
-
38
- class << self
39
- sig { params(config_hash: T::Hash[T.untyped, T.untyped]).returns(T::Array[::String]) }
40
- def excludes(config_hash); end
41
-
42
- sig { returns(::ParsePackwerk::Configuration) }
43
- def fetch; end
44
-
45
- def inherited(s); end
46
-
47
- sig { params(config_hash: T::Hash[T.untyped, T.untyped]).returns(T::Array[::String]) }
48
- def package_paths(config_hash); end
49
- end
50
- end
51
-
52
- ParsePackwerk::DEFAULT_EXCLUDE_GLOBS = T.let(T.unsafe(nil), Array)
53
- ParsePackwerk::DEFAULT_PACKAGE_PATHS = T.let(T.unsafe(nil), Array)
54
- ParsePackwerk::DEPENDENCIES = T.let(T.unsafe(nil), String)
55
- ParsePackwerk::DEPRECATED_REFERENCES_YML_NAME = T.let(T.unsafe(nil), String)
56
-
57
- class ParsePackwerk::DeprecatedReferences < ::T::Struct
58
- const :pathname, ::Pathname
59
- const :violations, T::Array[::ParsePackwerk::Violation]
60
-
61
- class << self
62
- sig { params(package: ::ParsePackwerk::Package).returns(::ParsePackwerk::DeprecatedReferences) }
63
- def for(package); end
64
-
65
- sig { params(pathname: ::Pathname).returns(::ParsePackwerk::DeprecatedReferences) }
66
- def from(pathname); end
67
-
68
- def inherited(s); end
69
- end
70
- end
71
-
72
- ParsePackwerk::ENFORCE_DEPENDENCIES = T.let(T.unsafe(nil), String)
73
- ParsePackwerk::ENFORCE_PRIVACY = T.let(T.unsafe(nil), String)
74
- ParsePackwerk::METADATA = T.let(T.unsafe(nil), String)
75
- ParsePackwerk::MetadataYmlType = T.type_alias { T::Hash[T.untyped, T.untyped] }
76
-
77
- class ParsePackwerk::MissingConfiguration < ::StandardError
78
- sig { params(packwerk_file_name: ::Pathname).void }
79
- def initialize(packwerk_file_name); end
80
- end
81
-
82
- ParsePackwerk::PACKAGE_YML_NAME = T.let(T.unsafe(nil), String)
83
- ParsePackwerk::PACKWERK_YML_NAME = T.let(T.unsafe(nil), String)
84
-
85
- class ParsePackwerk::Package < ::T::Struct
86
- const :dependencies, T::Array[::String]
87
- const :enforce_dependencies, T::Boolean
88
- const :enforce_privacy, T::Boolean
89
- const :metadata, T::Hash[T.untyped, T.untyped]
90
- const :name, ::String
91
-
92
- sig { returns(::Pathname) }
93
- def directory; end
94
-
95
- sig { returns(T::Boolean) }
96
- def enforces_dependencies?; end
97
-
98
- sig { returns(T::Boolean) }
99
- def enforces_privacy?; end
100
-
101
- sig { returns(::Pathname) }
102
- def yml; end
103
-
104
- class << self
105
- sig { params(pathname: ::Pathname).returns(::ParsePackwerk::Package) }
106
- def from(pathname); end
107
-
108
- def inherited(s); end
109
- end
110
- end
111
-
112
- class ParsePackwerk::PackageSet
113
- class << self
114
- sig do
115
- params(
116
- package_pathspec: T::Array[::String],
117
- exclude_pathspec: T::Array[::String]
118
- ).returns(T::Array[::ParsePackwerk::Package])
119
- end
120
- def from(package_pathspec:, exclude_pathspec:); end
121
-
122
- private
123
-
124
- sig { params(globs: T::Array[::String], path: ::Pathname).returns(T::Boolean) }
125
- def exclude_path?(globs, path); end
126
- end
127
- end
128
-
129
- ParsePackwerk::ROOT_PACKAGE_NAME = T.let(T.unsafe(nil), String)
130
-
131
- class ParsePackwerk::Violation < ::T::Struct
132
- const :class_name, ::String
133
- const :files, T::Array[::String]
134
- const :to_package_name, ::String
135
- const :type, ::String
136
-
137
- sig { returns(T::Boolean) }
138
- def dependency?; end
139
-
140
- sig { returns(T::Boolean) }
141
- def privacy?; end
142
-
143
- class << self
144
- def inherited(s); end
145
- end
146
- end