visualize_packwerk 0.0.1
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 +7 -0
- data/README.md +32 -0
- data/lib/visualize_packwerk/graph_interface.rb +17 -0
- data/lib/visualize_packwerk/node_interface.rb +29 -0
- data/lib/visualize_packwerk/package_graph.rb +48 -0
- data/lib/visualize_packwerk/package_node.rb +28 -0
- data/lib/visualize_packwerk/package_relationships.rb +158 -0
- data/lib/visualize_packwerk/railtie.rb +15 -0
- data/lib/visualize_packwerk/tasks/visualize_packwerk.rake +73 -0
- data/lib/visualize_packwerk/team_graph.rb +52 -0
- data/lib/visualize_packwerk/team_node.rb +27 -0
- data/lib/visualize_packwerk.rb +17 -0
- data/sorbet/config +2 -0
- data/sorbet/rbi/gems/activesupport@7.0.3.1.rbi +76 -0
- data/sorbet/rbi/gems/ast@2.4.2.rbi +522 -0
- data/sorbet/rbi/gems/code_ownership@1.28.0.rbi +411 -0
- data/sorbet/rbi/gems/code_teams@1.0.0.rbi +138 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +8 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +8 -0
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +866 -0
- data/sorbet/rbi/gems/i18n@1.12.0.rbi +8 -0
- data/sorbet/rbi/gems/json@2.6.2.rbi +1423 -0
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +8 -0
- data/sorbet/rbi/gems/minitest@5.16.2.rbi +9 -0
- data/sorbet/rbi/gems/package_protections@1.3.0.rbi +654 -0
- data/sorbet/rbi/gems/parallel@1.22.1.rbi +163 -0
- data/sorbet/rbi/gems/parse_packwerk@0.11.0.rbi +148 -0
- data/sorbet/rbi/gems/parser@3.1.2.0.rbi +4261 -0
- data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +8 -0
- data/sorbet/rbi/gems/rake@13.0.6.rbi +1854 -0
- data/sorbet/rbi/gems/rbi@0.0.15.rbi +2340 -0
- data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +8 -0
- data/sorbet/rbi/gems/rexml@3.2.5.rbi +8 -0
- data/sorbet/rbi/gems/rspec-core@3.11.0.rbi +7698 -0
- data/sorbet/rbi/gems/rspec-expectations@3.11.0.rbi +6201 -0
- data/sorbet/rbi/gems/rspec-mocks@3.11.1.rbi +3625 -0
- data/sorbet/rbi/gems/rspec-support@3.11.0.rbi +1176 -0
- data/sorbet/rbi/gems/rspec@3.11.0.rbi +40 -0
- data/sorbet/rbi/gems/rubocop-ast@1.19.1.rbi +8 -0
- data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +8 -0
- data/sorbet/rbi/gems/rubocop@1.33.0.rbi +8 -0
- data/sorbet/rbi/gems/ruby-graphviz@1.2.5.rbi +840 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +8 -0
- data/sorbet/rbi/gems/spoom@1.1.11.rbi +1600 -0
- data/sorbet/rbi/gems/tapioca@0.8.3.rbi +1978 -0
- data/sorbet/rbi/gems/thor@1.2.1.rbi +2921 -0
- data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +8 -0
- data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +8 -0
- data/sorbet/rbi/gems/unparser@0.6.5.rbi +8 -0
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +1802 -0
- data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +288 -0
- data/sorbet/rbi/gems/yard@0.9.28.rbi +12863 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +7 -0
- metadata +241 -0
@@ -0,0 +1,8 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `method_source` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem method_source`.
|
6
|
+
|
7
|
+
# THIS IS AN EMPTY RBI FILE.
|
8
|
+
# see https://github.com/Shopify/tapioca/wiki/Manual-Gem-Requires
|
@@ -0,0 +1,9 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `minitest` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem minitest`.
|
6
|
+
|
7
|
+
class Integer < ::Numeric
|
8
|
+
include ::JSON::Ext::Generator::GeneratorMethods::Integer
|
9
|
+
end
|
@@ -0,0 +1,654 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `package_protections` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem package_protections`.
|
6
|
+
|
7
|
+
# Welcome to PackageProtections!
|
8
|
+
# See https://github.com/rubyatscale/package_protections#readme for more info
|
9
|
+
#
|
10
|
+
# This file is a reference for the available API to `package_protections`, but all implementation details are private
|
11
|
+
# (which is why we delegate to `Private` for the actual implementation).
|
12
|
+
module PackageProtections
|
13
|
+
class << self
|
14
|
+
sig { returns(T::Array[::PackageProtections::ProtectionInterface]) }
|
15
|
+
def all; end
|
16
|
+
|
17
|
+
sig { void }
|
18
|
+
def bust_cache!; end
|
19
|
+
|
20
|
+
# @yield [Private.config]
|
21
|
+
sig { params(blk: T.proc.params(arg0: ::PackageProtections::Private::Configuration).void).void }
|
22
|
+
def configure(&blk); end
|
23
|
+
|
24
|
+
# This returns an array of a `Offense` which is how we represent the outcome of attempting to protect one or more packages,
|
25
|
+
# each of which is configured with different violation behaviors for each protection.
|
26
|
+
sig do
|
27
|
+
params(
|
28
|
+
packages: T::Array[::ParsePackwerk::Package],
|
29
|
+
new_violations: T::Array[::PackageProtections::PerFileViolation]
|
30
|
+
).returns(T::Array[::PackageProtections::Offense])
|
31
|
+
end
|
32
|
+
def get_offenses(packages:, new_violations:); end
|
33
|
+
|
34
|
+
sig do
|
35
|
+
params(
|
36
|
+
package_names: T::Array[::String],
|
37
|
+
all_packages: T::Array[::ParsePackwerk::Package]
|
38
|
+
).returns(T::Array[::ParsePackwerk::Package])
|
39
|
+
end
|
40
|
+
def packages_for_names(package_names, all_packages); end
|
41
|
+
|
42
|
+
# Do not use this method -- it's meant to be used by Rubocop cops to get directory-specific
|
43
|
+
# parameters without needing to have directory-specific .rubocop.yml files.
|
44
|
+
sig { params(identifier: ::String).returns(T::Hash[T.untyped, T.untyped]) }
|
45
|
+
def private_cop_config(identifier); end
|
46
|
+
|
47
|
+
# Why do we use Bundler.root here?
|
48
|
+
# The reason is that this function is evaluated in `.client_rubocop.yml`, so when rubocop evaluates the
|
49
|
+
# YML and parses the ERB, the working directory is inside this gem. We need to make sure it's at the root of the
|
50
|
+
# application so that we can find all of the packwerk packages.
|
51
|
+
# We use Bundler.root to get the root because:
|
52
|
+
# A) We expect it to be reliable
|
53
|
+
# B) We expect the client to be running bundle exec rubocop, which is typically done at the root, and also means
|
54
|
+
# the client already has this dependency.
|
55
|
+
sig { params(root_pathname: ::Pathname).returns(::String) }
|
56
|
+
def rubocop_yml(root_pathname: T.unsafe(nil)); end
|
57
|
+
|
58
|
+
# PackageProtections.set_defaults! sets any unset protections to their default enforcement
|
59
|
+
sig do
|
60
|
+
params(
|
61
|
+
packages: T::Array[::ParsePackwerk::Package],
|
62
|
+
protection_identifiers: T::Array[::String],
|
63
|
+
verbose: T::Boolean
|
64
|
+
).void
|
65
|
+
end
|
66
|
+
def set_defaults!(packages, protection_identifiers: T.unsafe(nil), verbose: T.unsafe(nil)); end
|
67
|
+
|
68
|
+
# This is a fast way to get a protection given an identifier
|
69
|
+
sig { params(identifier: ::String).returns(::PackageProtections::ProtectionInterface) }
|
70
|
+
def with_identifier(identifier); end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
PackageProtections::EXPECTED_PACK_DIRECTORIES = T.let(T.unsafe(nil), Array)
|
75
|
+
|
76
|
+
# A protection identifier is just a string that identifies the name of the protection within a `package.yml`
|
77
|
+
PackageProtections::Identifier = T.type_alias { ::String }
|
78
|
+
|
79
|
+
# This is currently the only handled exception that `PackageProtections` will throw.
|
80
|
+
class PackageProtections::IncorrectPublicApiUsageError < ::StandardError; end
|
81
|
+
|
82
|
+
class PackageProtections::Offense < ::T::Struct
|
83
|
+
const :file, ::String
|
84
|
+
const :message, ::String
|
85
|
+
const :package, ::ParsePackwerk::Package
|
86
|
+
const :violation_type, ::String
|
87
|
+
|
88
|
+
sig { returns(::String) }
|
89
|
+
def package_name; end
|
90
|
+
|
91
|
+
class << self
|
92
|
+
def inherited(s); end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
PackageProtections::PROTECTIONS_TODO_YML = T.let(T.unsafe(nil), String)
|
97
|
+
|
98
|
+
# Perhaps this should be in ParsePackwerk. For now, this is here to help us break down violations per file.
|
99
|
+
# This is analogous to `Packwerk::ReferenceOffense`
|
100
|
+
class PackageProtections::PerFileViolation < ::T::Struct
|
101
|
+
const :class_name, ::String
|
102
|
+
const :constant_source_package, ::String
|
103
|
+
const :filepath, ::String
|
104
|
+
const :reference_source_package, ::ParsePackwerk::Package
|
105
|
+
const :type, ::String
|
106
|
+
|
107
|
+
sig { returns(T::Boolean) }
|
108
|
+
def dependency?; end
|
109
|
+
|
110
|
+
sig { returns(T::Boolean) }
|
111
|
+
def privacy?; end
|
112
|
+
|
113
|
+
class << self
|
114
|
+
sig do
|
115
|
+
params(
|
116
|
+
violation: ::ParsePackwerk::Violation,
|
117
|
+
reference_source_package: ::ParsePackwerk::Package
|
118
|
+
).returns(T::Array[::PackageProtections::PerFileViolation])
|
119
|
+
end
|
120
|
+
def from(violation, reference_source_package); end
|
121
|
+
|
122
|
+
def inherited(s); end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
# This module cannot be accessed by clients of `PackageProtections` -- only within the `PackageProtections` module itself.
|
127
|
+
# All implementation details are in here to keep the main `PackageProtections` module easily scannable and to keep the private things private.
|
128
|
+
module PackageProtections::Private
|
129
|
+
class << self
|
130
|
+
sig { returns(T::Array[::PackageProtections::ProtectedPackage]) }
|
131
|
+
def all_protected_packages; end
|
132
|
+
|
133
|
+
sig { void }
|
134
|
+
def bust_cache!; end
|
135
|
+
|
136
|
+
sig { returns(::PackageProtections::Private::Configuration) }
|
137
|
+
def config; end
|
138
|
+
|
139
|
+
sig do
|
140
|
+
params(
|
141
|
+
packages: T::Array[::ParsePackwerk::Package],
|
142
|
+
new_violations: T::Array[::PackageProtections::PerFileViolation]
|
143
|
+
).returns(T::Array[::PackageProtections::Offense])
|
144
|
+
end
|
145
|
+
def get_offenses(packages:, new_violations:); end
|
146
|
+
|
147
|
+
sig { params(name: ::String).returns(::PackageProtections::ProtectedPackage) }
|
148
|
+
def get_package_with_name(name); end
|
149
|
+
|
150
|
+
sig do
|
151
|
+
params(
|
152
|
+
package_names: T::Array[::String],
|
153
|
+
all_packages: T::Array[::ParsePackwerk::Package]
|
154
|
+
).returns(T::Array[::ParsePackwerk::Package])
|
155
|
+
end
|
156
|
+
def packages_for_names(package_names, all_packages); end
|
157
|
+
|
158
|
+
sig { params(identifier: ::String).returns(T::Hash[T.untyped, T.untyped]) }
|
159
|
+
def private_cop_config(identifier); end
|
160
|
+
|
161
|
+
sig { params(root_pathname: ::Pathname).returns(::String) }
|
162
|
+
def rubocop_yml(root_pathname:); end
|
163
|
+
|
164
|
+
sig do
|
165
|
+
params(
|
166
|
+
packages: T::Array[::ParsePackwerk::Package],
|
167
|
+
protection_identifiers: T::Array[::String],
|
168
|
+
verbose: T::Boolean
|
169
|
+
).void
|
170
|
+
end
|
171
|
+
def set_defaults!(packages, protection_identifiers:, verbose:); end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
class PackageProtections::Private::ColorizedString
|
176
|
+
sig { params(original_string: ::String, color: ::PackageProtections::Private::ColorizedString::Color).void }
|
177
|
+
def initialize(original_string, color = T.unsafe(nil)); end
|
178
|
+
|
179
|
+
sig { returns(::PackageProtections::Private::ColorizedString) }
|
180
|
+
def blue; end
|
181
|
+
|
182
|
+
sig { returns(::String) }
|
183
|
+
def colorized_to_s; end
|
184
|
+
|
185
|
+
sig { returns(::PackageProtections::Private::ColorizedString) }
|
186
|
+
def green; end
|
187
|
+
|
188
|
+
sig { returns(::PackageProtections::Private::ColorizedString) }
|
189
|
+
def light_blue; end
|
190
|
+
|
191
|
+
sig { returns(::PackageProtections::Private::ColorizedString) }
|
192
|
+
def pink; end
|
193
|
+
|
194
|
+
sig { returns(::PackageProtections::Private::ColorizedString) }
|
195
|
+
def red; end
|
196
|
+
|
197
|
+
sig { returns(::String) }
|
198
|
+
def to_s; end
|
199
|
+
|
200
|
+
sig { returns(::PackageProtections::Private::ColorizedString) }
|
201
|
+
def white; end
|
202
|
+
|
203
|
+
sig { returns(::PackageProtections::Private::ColorizedString) }
|
204
|
+
def yellow; end
|
205
|
+
|
206
|
+
private
|
207
|
+
|
208
|
+
sig { returns(::Integer) }
|
209
|
+
def color_code; end
|
210
|
+
|
211
|
+
sig do
|
212
|
+
params(
|
213
|
+
color: ::PackageProtections::Private::ColorizedString::Color
|
214
|
+
).returns(::PackageProtections::Private::ColorizedString)
|
215
|
+
end
|
216
|
+
def colorize(color); end
|
217
|
+
end
|
218
|
+
|
219
|
+
class PackageProtections::Private::ColorizedString::Color < ::T::Enum
|
220
|
+
enums do
|
221
|
+
Black = new
|
222
|
+
Red = new
|
223
|
+
Green = new
|
224
|
+
Yellow = new
|
225
|
+
Blue = new
|
226
|
+
Pink = new
|
227
|
+
LightBlue = new
|
228
|
+
White = new
|
229
|
+
end
|
230
|
+
end
|
231
|
+
|
232
|
+
class PackageProtections::Private::Configuration
|
233
|
+
sig { void }
|
234
|
+
def initialize; end
|
235
|
+
|
236
|
+
sig { void }
|
237
|
+
def bust_cache!; end
|
238
|
+
|
239
|
+
sig { returns(T::Array[::PackageProtections::ProtectionInterface]) }
|
240
|
+
def default_protections; end
|
241
|
+
|
242
|
+
sig { returns(T::Array[::PackageProtections::ProtectionInterface]) }
|
243
|
+
def protections; end
|
244
|
+
|
245
|
+
sig { params(protections: T::Array[::PackageProtections::ProtectionInterface]).void }
|
246
|
+
def protections=(protections); end
|
247
|
+
end
|
248
|
+
|
249
|
+
class PackageProtections::Private::IncomingPrivacyProtection
|
250
|
+
include ::PackageProtections::ProtectionInterface
|
251
|
+
|
252
|
+
sig do
|
253
|
+
override
|
254
|
+
.params(
|
255
|
+
protected_packages: T::Array[::PackageProtections::ProtectedPackage]
|
256
|
+
).returns(T::Array[::PackageProtections::Offense])
|
257
|
+
end
|
258
|
+
def get_offenses_for_existing_violations(protected_packages); end
|
259
|
+
|
260
|
+
sig do
|
261
|
+
override
|
262
|
+
.params(
|
263
|
+
new_violations: T::Array[::PackageProtections::PerFileViolation]
|
264
|
+
).returns(T::Array[::PackageProtections::Offense])
|
265
|
+
end
|
266
|
+
def get_offenses_for_new_violations(new_violations); end
|
267
|
+
|
268
|
+
sig { override.returns(::String) }
|
269
|
+
def humanized_protection_description; end
|
270
|
+
|
271
|
+
sig { override.returns(::String) }
|
272
|
+
def humanized_protection_name; end
|
273
|
+
|
274
|
+
sig { override.returns(::String) }
|
275
|
+
def identifier; end
|
276
|
+
|
277
|
+
sig do
|
278
|
+
override
|
279
|
+
.params(
|
280
|
+
behavior: ::PackageProtections::ViolationBehavior,
|
281
|
+
package: ::ParsePackwerk::Package
|
282
|
+
).returns(T.nilable(::String))
|
283
|
+
end
|
284
|
+
def unmet_preconditions_for_behavior(behavior, package); end
|
285
|
+
|
286
|
+
private
|
287
|
+
|
288
|
+
sig { params(per_file_violation: ::PackageProtections::PerFileViolation).returns(::String) }
|
289
|
+
def message_for_fail_on_any(per_file_violation); end
|
290
|
+
|
291
|
+
sig { params(per_file_violation: ::PackageProtections::PerFileViolation).returns(::String) }
|
292
|
+
def message_for_fail_on_new(per_file_violation); end
|
293
|
+
end
|
294
|
+
|
295
|
+
PackageProtections::Private::IncomingPrivacyProtection::IDENTIFIER = T.let(T.unsafe(nil), String)
|
296
|
+
|
297
|
+
class PackageProtections::Private::MetadataModifiers
|
298
|
+
class << self
|
299
|
+
sig do
|
300
|
+
params(
|
301
|
+
package: ::ParsePackwerk::Package,
|
302
|
+
protection_identifier: ::String,
|
303
|
+
violation_behavior: ::PackageProtections::ViolationBehavior
|
304
|
+
).returns(::ParsePackwerk::Package)
|
305
|
+
end
|
306
|
+
def package_with_modified_protection(package, protection_identifier, violation_behavior); end
|
307
|
+
end
|
308
|
+
end
|
309
|
+
|
310
|
+
class PackageProtections::Private::OutgoingDependencyProtection
|
311
|
+
include ::PackageProtections::ProtectionInterface
|
312
|
+
|
313
|
+
sig do
|
314
|
+
override
|
315
|
+
.params(
|
316
|
+
protected_packages: T::Array[::PackageProtections::ProtectedPackage]
|
317
|
+
).returns(T::Array[::PackageProtections::Offense])
|
318
|
+
end
|
319
|
+
def get_offenses_for_existing_violations(protected_packages); end
|
320
|
+
|
321
|
+
sig do
|
322
|
+
override
|
323
|
+
.params(
|
324
|
+
new_violations: T::Array[::PackageProtections::PerFileViolation]
|
325
|
+
).returns(T::Array[::PackageProtections::Offense])
|
326
|
+
end
|
327
|
+
def get_offenses_for_new_violations(new_violations); end
|
328
|
+
|
329
|
+
sig { override.returns(::String) }
|
330
|
+
def humanized_protection_description; end
|
331
|
+
|
332
|
+
sig { override.returns(::String) }
|
333
|
+
def humanized_protection_name; end
|
334
|
+
|
335
|
+
sig { override.returns(::String) }
|
336
|
+
def identifier; end
|
337
|
+
|
338
|
+
sig do
|
339
|
+
override
|
340
|
+
.params(
|
341
|
+
behavior: ::PackageProtections::ViolationBehavior,
|
342
|
+
package: ::ParsePackwerk::Package
|
343
|
+
).returns(T.nilable(::String))
|
344
|
+
end
|
345
|
+
def unmet_preconditions_for_behavior(behavior, package); end
|
346
|
+
|
347
|
+
private
|
348
|
+
|
349
|
+
sig { params(per_file_violation: ::PackageProtections::PerFileViolation).returns(::String) }
|
350
|
+
def message_for_fail_on_any(per_file_violation); end
|
351
|
+
|
352
|
+
sig { params(per_file_violation: ::PackageProtections::PerFileViolation).returns(::String) }
|
353
|
+
def message_for_fail_on_new(per_file_violation); end
|
354
|
+
end
|
355
|
+
|
356
|
+
PackageProtections::Private::OutgoingDependencyProtection::IDENTIFIER = T.let(T.unsafe(nil), String)
|
357
|
+
|
358
|
+
class PackageProtections::Private::Output
|
359
|
+
class << self
|
360
|
+
sig { params(str: ::String).void }
|
361
|
+
def p(str); end
|
362
|
+
|
363
|
+
sig { params(str: ::PackageProtections::Private::ColorizedString, colorized: T::Boolean).void }
|
364
|
+
def p_colorized(str, colorized:); end
|
365
|
+
end
|
366
|
+
end
|
367
|
+
|
368
|
+
class PackageProtections::Private::VisibilityProtection
|
369
|
+
include ::PackageProtections::ProtectionInterface
|
370
|
+
|
371
|
+
# By default, this protection does not show up when creating a new package, and its default behavior is FailNever
|
372
|
+
# A package that uses this protection is not considered strictly better -- in general, we want to design packages that
|
373
|
+
# are consumable by all packages. Therefore, a package that is consumable by all packages is the happy path.
|
374
|
+
#
|
375
|
+
# If a user wants to turn on package visibility, they must do it explicitly.
|
376
|
+
sig { returns(::PackageProtections::ViolationBehavior) }
|
377
|
+
def default_behavior; end
|
378
|
+
|
379
|
+
sig do
|
380
|
+
override
|
381
|
+
.params(
|
382
|
+
protected_packages: T::Array[::PackageProtections::ProtectedPackage]
|
383
|
+
).returns(T::Array[::PackageProtections::Offense])
|
384
|
+
end
|
385
|
+
def get_offenses_for_existing_violations(protected_packages); end
|
386
|
+
|
387
|
+
sig do
|
388
|
+
override
|
389
|
+
.params(
|
390
|
+
new_violations: T::Array[::PackageProtections::PerFileViolation]
|
391
|
+
).returns(T::Array[::PackageProtections::Offense])
|
392
|
+
end
|
393
|
+
def get_offenses_for_new_violations(new_violations); end
|
394
|
+
|
395
|
+
sig { override.returns(::String) }
|
396
|
+
def humanized_protection_description; end
|
397
|
+
|
398
|
+
sig { override.returns(::String) }
|
399
|
+
def humanized_protection_name; end
|
400
|
+
|
401
|
+
sig { override.returns(::String) }
|
402
|
+
def identifier; end
|
403
|
+
|
404
|
+
sig do
|
405
|
+
override
|
406
|
+
.params(
|
407
|
+
behavior: ::PackageProtections::ViolationBehavior,
|
408
|
+
package: ::ParsePackwerk::Package
|
409
|
+
).returns(T.nilable(::String))
|
410
|
+
end
|
411
|
+
def unmet_preconditions_for_behavior(behavior, package); end
|
412
|
+
|
413
|
+
private
|
414
|
+
|
415
|
+
sig { params(per_file_violation: ::PackageProtections::PerFileViolation).returns(::String) }
|
416
|
+
def message_for_fail_on_any(per_file_violation); end
|
417
|
+
|
418
|
+
sig { params(per_file_violation: ::PackageProtections::PerFileViolation).returns(::String) }
|
419
|
+
def message_for_fail_on_new(per_file_violation); end
|
420
|
+
end
|
421
|
+
|
422
|
+
PackageProtections::Private::VisibilityProtection::IDENTIFIER = T.let(T.unsafe(nil), String)
|
423
|
+
|
424
|
+
class PackageProtections::ProtectedPackage < ::T::Struct
|
425
|
+
const :deprecated_references, ::ParsePackwerk::DeprecatedReferences
|
426
|
+
const :original_package, ::ParsePackwerk::Package
|
427
|
+
const :protections, T::Hash[::String, ::PackageProtections::ViolationBehavior]
|
428
|
+
|
429
|
+
sig { returns(T::Array[::String]) }
|
430
|
+
def dependencies; end
|
431
|
+
|
432
|
+
sig { returns(T::Hash[T.untyped, T.untyped]) }
|
433
|
+
def metadata; end
|
434
|
+
|
435
|
+
sig { returns(::String) }
|
436
|
+
def name; end
|
437
|
+
|
438
|
+
sig { params(key: ::String).returns(::PackageProtections::ViolationBehavior) }
|
439
|
+
def violation_behavior_for(key); end
|
440
|
+
|
441
|
+
sig { returns(T::Array[::ParsePackwerk::Violation]) }
|
442
|
+
def violations; end
|
443
|
+
|
444
|
+
sig { returns(T::Set[::String]) }
|
445
|
+
def visible_to; end
|
446
|
+
|
447
|
+
sig { returns(::Pathname) }
|
448
|
+
def yml; end
|
449
|
+
|
450
|
+
class << self
|
451
|
+
sig { params(original_package: ::ParsePackwerk::Package).returns(::PackageProtections::ProtectedPackage) }
|
452
|
+
def from(original_package); end
|
453
|
+
|
454
|
+
sig do
|
455
|
+
params(
|
456
|
+
protection: ::PackageProtections::ProtectionInterface,
|
457
|
+
metadata: T::Hash[T.untyped, T.untyped],
|
458
|
+
package: ::ParsePackwerk::Package
|
459
|
+
).returns(::PackageProtections::ViolationBehavior)
|
460
|
+
end
|
461
|
+
def get_violation_behavior(protection, metadata, package); end
|
462
|
+
|
463
|
+
def inherited(s); end
|
464
|
+
end
|
465
|
+
end
|
466
|
+
|
467
|
+
# @abstract Subclasses must implement the `abstract` methods below.
|
468
|
+
module PackageProtections::ProtectionInterface
|
469
|
+
requires_ancestor { Kernel }
|
470
|
+
|
471
|
+
abstract!
|
472
|
+
|
473
|
+
sig { returns(::PackageProtections::ViolationBehavior) }
|
474
|
+
def default_behavior; end
|
475
|
+
|
476
|
+
sig do
|
477
|
+
params(
|
478
|
+
protected_packages: T::Array[::PackageProtections::ProtectedPackage],
|
479
|
+
new_violations: T::Array[::PackageProtections::PerFileViolation]
|
480
|
+
).returns(T::Array[::PackageProtections::Offense])
|
481
|
+
end
|
482
|
+
def get_offenses(protected_packages, new_violations); end
|
483
|
+
|
484
|
+
# @abstract
|
485
|
+
sig do
|
486
|
+
abstract
|
487
|
+
.params(
|
488
|
+
protected_packages: T::Array[::PackageProtections::ProtectedPackage]
|
489
|
+
).returns(T::Array[::PackageProtections::Offense])
|
490
|
+
end
|
491
|
+
def get_offenses_for_existing_violations(protected_packages); end
|
492
|
+
|
493
|
+
# @abstract
|
494
|
+
sig do
|
495
|
+
abstract
|
496
|
+
.params(
|
497
|
+
new_violations: T::Array[::PackageProtections::PerFileViolation]
|
498
|
+
).returns(T::Array[::PackageProtections::Offense])
|
499
|
+
end
|
500
|
+
def get_offenses_for_new_violations(new_violations); end
|
501
|
+
|
502
|
+
# @abstract
|
503
|
+
sig { abstract.returns(::String) }
|
504
|
+
def humanized_protection_description; end
|
505
|
+
|
506
|
+
# @abstract
|
507
|
+
sig { abstract.returns(::String) }
|
508
|
+
def humanized_protection_name; end
|
509
|
+
|
510
|
+
# @abstract
|
511
|
+
sig { abstract.returns(::String) }
|
512
|
+
def identifier; end
|
513
|
+
|
514
|
+
sig do
|
515
|
+
params(
|
516
|
+
behavior: ::PackageProtections::ViolationBehavior,
|
517
|
+
package: ::ParsePackwerk::Package
|
518
|
+
).returns(T::Boolean)
|
519
|
+
end
|
520
|
+
def supports_violation_behavior?(behavior, package); end
|
521
|
+
|
522
|
+
# @abstract
|
523
|
+
sig do
|
524
|
+
abstract
|
525
|
+
.params(
|
526
|
+
behavior: ::PackageProtections::ViolationBehavior,
|
527
|
+
package: ::ParsePackwerk::Package
|
528
|
+
).returns(T.nilable(::String))
|
529
|
+
end
|
530
|
+
def unmet_preconditions_for_behavior(behavior, package); end
|
531
|
+
end
|
532
|
+
|
533
|
+
# @abstract Subclasses must implement the `abstract` methods below.
|
534
|
+
module PackageProtections::RubocopProtectionInterface
|
535
|
+
include ::PackageProtections::ProtectionInterface
|
536
|
+
|
537
|
+
abstract!
|
538
|
+
|
539
|
+
sig do
|
540
|
+
params(
|
541
|
+
packages: T::Array[::PackageProtections::ProtectedPackage]
|
542
|
+
).returns(T::Array[::PackageProtections::RubocopProtectionInterface::CopConfig])
|
543
|
+
end
|
544
|
+
def cop_configs(packages); end
|
545
|
+
|
546
|
+
# Abstract Methods: These are methods that the client needs to implement
|
547
|
+
#
|
548
|
+
# @abstract
|
549
|
+
sig { abstract.returns(::String) }
|
550
|
+
def cop_name; end
|
551
|
+
|
552
|
+
# Overriddable Methods: These are methods that the client can override,
|
553
|
+
# but a default is provided.
|
554
|
+
sig { params(package: ::PackageProtections::ProtectedPackage).returns(T::Hash[T.untyped, T.untyped]) }
|
555
|
+
def custom_cop_config(package); end
|
556
|
+
|
557
|
+
sig do
|
558
|
+
override
|
559
|
+
.params(
|
560
|
+
protected_packages: T::Array[::PackageProtections::ProtectedPackage]
|
561
|
+
).returns(T::Array[::PackageProtections::Offense])
|
562
|
+
end
|
563
|
+
def get_offenses_for_existing_violations(protected_packages); end
|
564
|
+
|
565
|
+
sig do
|
566
|
+
override
|
567
|
+
.params(
|
568
|
+
new_violations: T::Array[::PackageProtections::PerFileViolation]
|
569
|
+
).returns(T::Array[::PackageProtections::Offense])
|
570
|
+
end
|
571
|
+
def get_offenses_for_new_violations(new_violations); end
|
572
|
+
|
573
|
+
# @abstract
|
574
|
+
sig { abstract.returns(T::Array[::String]) }
|
575
|
+
def included_globs_for_pack; end
|
576
|
+
|
577
|
+
# @abstract
|
578
|
+
sig { abstract.params(file: ::String).returns(::String) }
|
579
|
+
def message_for_fail_on_any(file); end
|
580
|
+
|
581
|
+
sig do
|
582
|
+
override
|
583
|
+
.params(
|
584
|
+
behavior: ::PackageProtections::ViolationBehavior,
|
585
|
+
package: ::ParsePackwerk::Package
|
586
|
+
).returns(T.nilable(::String))
|
587
|
+
end
|
588
|
+
def unmet_preconditions_for_behavior(behavior, package); end
|
589
|
+
|
590
|
+
private
|
591
|
+
|
592
|
+
sig { params(rule: ::String).returns(T::Set[::String]) }
|
593
|
+
def exclude_for_rule(rule); end
|
594
|
+
|
595
|
+
class << self
|
596
|
+
sig { void }
|
597
|
+
def bust_rubocop_todo_yml_cache; end
|
598
|
+
|
599
|
+
sig { returns(T.untyped) }
|
600
|
+
def rubocop_todo_yml; end
|
601
|
+
end
|
602
|
+
end
|
603
|
+
|
604
|
+
class PackageProtections::RubocopProtectionInterface::CopConfig < ::T::Struct
|
605
|
+
const :enabled, T::Boolean, default: T.unsafe(nil)
|
606
|
+
const :exclude_paths, T::Array[::String], default: T.unsafe(nil)
|
607
|
+
const :include_paths, T::Array[::String], default: T.unsafe(nil)
|
608
|
+
const :name, ::String
|
609
|
+
|
610
|
+
sig { returns(::String) }
|
611
|
+
def to_rubocop_yml_compatible_format; end
|
612
|
+
|
613
|
+
class << self
|
614
|
+
def inherited(s); end
|
615
|
+
end
|
616
|
+
end
|
617
|
+
|
618
|
+
class PackageProtections::ViolationBehavior < ::T::Enum
|
619
|
+
enums do
|
620
|
+
FailOnAny = new
|
621
|
+
FailOnNew = new
|
622
|
+
FailNever = new
|
623
|
+
end
|
624
|
+
|
625
|
+
sig { returns(T::Boolean) }
|
626
|
+
def enabled?; end
|
627
|
+
|
628
|
+
sig { returns(T::Boolean) }
|
629
|
+
def fail_never?; end
|
630
|
+
|
631
|
+
sig { returns(T::Boolean) }
|
632
|
+
def fail_on_any?; end
|
633
|
+
|
634
|
+
sig { returns(T::Boolean) }
|
635
|
+
def fail_on_new?; end
|
636
|
+
|
637
|
+
class << self
|
638
|
+
sig { params(value: T.untyped).returns(::PackageProtections::ViolationBehavior) }
|
639
|
+
def from_raw_value(value); end
|
640
|
+
end
|
641
|
+
end
|
642
|
+
|
643
|
+
RuboCop::Cop::PackageProtections::NamespacedUnderPackageName::IDENTIFIER = T.let(T.unsafe(nil), String)
|
644
|
+
|
645
|
+
# This inherits from `Sorbet::StrictSigil` and doesn't change any behavior of it.
|
646
|
+
# The only reason we do this is so that configuration for this cop can live under a different cop namespace.
|
647
|
+
# This prevents this cop's configuration from clashing with other configurations for the same cop.
|
648
|
+
# A concrete example of this would be if a user is using this package protection to make sure public APIs are typed,
|
649
|
+
# and separately the application as a whole requiring strict typing in certain parts of the application.
|
650
|
+
#
|
651
|
+
# To prevent problems associated with needing to manage identical configurations for the same cop, we simply call it
|
652
|
+
# something else in the context of this protection.
|
653
|
+
#
|
654
|
+
# We can apply this same pattern if we want to use other cops in the context of package protections and prevent clashing.
|