packwerk 1.1.2 → 1.3.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +17 -8
  3. data/.ruby-version +1 -1
  4. data/Gemfile +1 -1
  5. data/Gemfile.lock +129 -111
  6. data/README.md +9 -2
  7. data/TROUBLESHOOT.md +2 -2
  8. data/USAGE.md +30 -30
  9. data/bin/m +29 -0
  10. data/bin/rake +29 -0
  11. data/bin/rubocop +29 -0
  12. data/bin/srb +29 -0
  13. data/bin/tapioca +29 -0
  14. data/dev.yml +7 -7
  15. data/gemfiles/Gemfile-rails-6-0 +22 -0
  16. data/lib/packwerk.rb +72 -36
  17. data/lib/packwerk/application_load_paths.rb +18 -8
  18. data/lib/packwerk/application_validator.rb +26 -27
  19. data/lib/packwerk/association_inspector.rb +0 -3
  20. data/lib/packwerk/checker.rb +2 -8
  21. data/lib/packwerk/cli.rb +29 -109
  22. data/lib/packwerk/configuration.rb +5 -0
  23. data/lib/packwerk/const_node_inspector.rb +0 -2
  24. data/lib/packwerk/constant_discovery.rb +2 -0
  25. data/lib/packwerk/constant_name_inspector.rb +0 -1
  26. data/lib/packwerk/dependency_checker.rb +2 -15
  27. data/lib/packwerk/deprecated_references.rb +5 -11
  28. data/lib/packwerk/file_processor.rb +0 -4
  29. data/lib/packwerk/formatters/offenses_formatter.rb +13 -9
  30. data/lib/packwerk/formatters/progress_formatter.rb +5 -4
  31. data/lib/packwerk/generators/configuration_file.rb +0 -1
  32. data/lib/packwerk/inflector.rb +0 -2
  33. data/lib/packwerk/node.rb +1 -0
  34. data/lib/packwerk/node_processor.rb +15 -32
  35. data/lib/packwerk/node_processor_factory.rb +0 -5
  36. data/lib/packwerk/node_visitor.rb +1 -4
  37. data/lib/packwerk/offense.rb +0 -4
  38. data/lib/packwerk/offense_collection.rb +84 -0
  39. data/lib/packwerk/offenses_formatter.rb +19 -0
  40. data/lib/packwerk/package.rb +17 -1
  41. data/lib/packwerk/package_set.rb +0 -2
  42. data/lib/packwerk/parse_run.rb +106 -0
  43. data/lib/packwerk/parsed_constant_definitions.rb +0 -2
  44. data/lib/packwerk/parsers.rb +0 -2
  45. data/lib/packwerk/parsers/erb.rb +0 -2
  46. data/lib/packwerk/parsers/factory.rb +0 -2
  47. data/lib/packwerk/privacy_checker.rb +2 -15
  48. data/lib/packwerk/reference_extractor.rb +0 -8
  49. data/lib/packwerk/reference_offense.rb +49 -0
  50. data/lib/packwerk/result.rb +9 -0
  51. data/lib/packwerk/run_context.rb +4 -21
  52. data/lib/packwerk/sanity_checker.rb +0 -2
  53. data/lib/packwerk/version.rb +1 -1
  54. data/lib/packwerk/violation_type.rb +0 -2
  55. data/library.yml +1 -1
  56. data/packwerk.gemspec +1 -0
  57. data/service.yml +1 -4
  58. data/shipit.rubygems.yml +5 -1
  59. data/sorbet/rbi/gems/{actioncable@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → actioncable@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +56 -36
  60. data/sorbet/rbi/gems/{actionmailbox@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → actionmailbox@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +25 -28
  61. data/sorbet/rbi/gems/{actionmailer@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → actionmailer@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +43 -24
  62. data/sorbet/rbi/gems/{actionpack@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → actionpack@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +382 -284
  63. data/sorbet/rbi/gems/{actiontext@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → actiontext@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +76 -40
  64. data/sorbet/rbi/gems/{actionview@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → actionview@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +206 -195
  65. data/sorbet/rbi/gems/{activejob@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → activejob@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +64 -75
  66. data/sorbet/rbi/gems/{activemodel@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → activemodel@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +103 -56
  67. data/sorbet/rbi/gems/{activerecord@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → activerecord@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +1250 -898
  68. data/sorbet/rbi/gems/{activestorage@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → activestorage@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +92 -120
  69. data/sorbet/rbi/gems/{activesupport@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → activesupport@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +292 -193
  70. data/sorbet/rbi/gems/{ast@2.4.1.rbi → ast@2.4.2.rbi} +2 -1
  71. data/sorbet/rbi/gems/{better_html@1.0.15.rbi → better_html@1.0.16.rbi} +2 -2
  72. data/sorbet/rbi/gems/{concurrent-ruby@1.1.6.rbi → concurrent-ruby@1.1.8.rbi} +12 -9
  73. data/sorbet/rbi/gems/{erubi@1.9.0.rbi → erubi@1.10.0.rbi} +3 -1
  74. data/sorbet/rbi/gems/{i18n@1.8.2.rbi → i18n@1.8.10.rbi} +19 -52
  75. data/sorbet/rbi/gems/{loofah@2.5.0.rbi → loofah@2.9.0.rbi} +3 -1
  76. data/sorbet/rbi/gems/marcel@1.0.0.rbi +70 -0
  77. data/sorbet/rbi/gems/{mini_mime@1.0.2.rbi → mini_mime@1.0.3.rbi} +6 -6
  78. data/sorbet/rbi/gems/{mini_portile2@2.4.0.rbi → minitest-focus@1.2.1.rbi} +2 -2
  79. data/sorbet/rbi/gems/{minitest@5.14.0.rbi → minitest@5.14.4.rbi} +31 -29
  80. data/sorbet/rbi/gems/{mocha@1.11.2.rbi → mocha@1.12.0.rbi} +25 -36
  81. data/sorbet/rbi/gems/{nio4r@2.5.2.rbi → nio4r@2.5.7.rbi} +21 -20
  82. data/sorbet/rbi/gems/{nokogiri@1.10.9.rbi → nokogiri@1.11.2.rbi} +193 -154
  83. data/sorbet/rbi/gems/parallel@1.20.1.rbi +117 -0
  84. data/sorbet/rbi/gems/parlour@6.0.0.rbi +1272 -0
  85. data/sorbet/rbi/gems/{parser@2.7.1.4.rbi → parser@3.0.0.0.rbi} +287 -174
  86. data/sorbet/rbi/gems/{pry@0.13.1.rbi → pry@0.14.0.rbi} +1 -1
  87. data/sorbet/rbi/gems/racc@1.5.2.rbi +57 -0
  88. data/sorbet/rbi/gems/{rack@2.2.2.rbi → rack@2.2.3.rbi} +23 -35
  89. data/sorbet/rbi/gems/{rails@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → rails@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +1 -1
  90. data/sorbet/rbi/gems/{railties@6.1.0.alpha-d80c18a391e33552ae2d943e68af56946f883f65.rbi → railties@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi} +132 -121
  91. data/sorbet/rbi/gems/{rake@13.0.1.rbi → rake@13.0.3.rbi} +16 -20
  92. data/sorbet/rbi/gems/{parallel@1.19.1.rbi → regexp_parser@2.1.1.rbi} +2 -2
  93. data/sorbet/rbi/gems/rubocop-ast@1.4.1.rbi +8 -0
  94. data/sorbet/rbi/gems/{rubocop-performance@1.5.2.rbi → rubocop-performance@1.10.2.rbi} +1 -1
  95. data/sorbet/rbi/gems/{rubocop-shopify@1.0.2.rbi → rubocop-shopify@2.0.1.rbi} +1 -1
  96. data/sorbet/rbi/gems/{rubocop-sorbet@0.3.7.rbi → rubocop-sorbet@0.6.1.rbi} +1 -1
  97. data/sorbet/rbi/gems/{rubocop@0.82.0.rbi → rubocop@1.12.0.rbi} +1 -1
  98. data/sorbet/rbi/gems/{ruby-progressbar@1.10.1.rbi → ruby-progressbar@1.11.0.rbi} +1 -1
  99. data/sorbet/rbi/gems/spoom@1.1.0.rbi +1061 -0
  100. data/sorbet/rbi/gems/{spring@2.1.0.rbi → spring@2.1.1.rbi} +7 -7
  101. data/sorbet/rbi/gems/{sprockets-rails@3.2.1.rbi → sprockets-rails@3.2.2.rbi} +88 -68
  102. data/sorbet/rbi/gems/{sprockets@4.0.0.rbi → sprockets@4.0.2.rbi} +8 -7
  103. data/sorbet/rbi/gems/{tapioca@0.4.5.rbi → tapioca@0.4.19.rbi} +109 -24
  104. data/sorbet/rbi/gems/{thor@1.0.1.rbi → thor@1.1.0.rbi} +16 -15
  105. data/sorbet/rbi/gems/{tzinfo@2.0.2.rbi → tzinfo@2.0.4.rbi} +21 -2
  106. data/sorbet/rbi/gems/{unicode-display_width@1.7.0.rbi → unicode-display_width@2.0.0.rbi} +1 -1
  107. data/sorbet/rbi/gems/{websocket-driver@0.7.1.rbi → websocket-driver@0.7.3.rbi} +29 -29
  108. data/sorbet/rbi/gems/{websocket-extensions@0.1.4.rbi → websocket-extensions@0.1.5.rbi} +2 -2
  109. data/sorbet/rbi/gems/zeitwerk@2.4.2.rbi +177 -0
  110. data/sorbet/tapioca/require.rb +1 -0
  111. metadata +79 -66
  112. data/lib/packwerk/cache_deprecated_references.rb +0 -55
  113. data/lib/packwerk/checking_deprecated_references.rb +0 -43
  114. data/lib/packwerk/commands/detect_stale_violations_command.rb +0 -60
  115. data/lib/packwerk/commands/offense_progress_marker.rb +0 -24
  116. data/lib/packwerk/commands/result.rb +0 -13
  117. data/lib/packwerk/commands/update_deprecations_command.rb +0 -81
  118. data/lib/packwerk/detect_stale_deprecated_references.rb +0 -14
  119. data/lib/packwerk/generators/application_validation.rb +0 -62
  120. data/lib/packwerk/generators/templates/packwerk +0 -23
  121. data/lib/packwerk/generators/templates/packwerk_validator_test.rb +0 -11
  122. data/lib/packwerk/reference_lister.rb +0 -23
  123. data/lib/packwerk/spring_command.rb +0 -28
  124. data/lib/packwerk/updating_deprecated_references.rb +0 -14
  125. data/sorbet/rbi/gems/jaro_winkler@1.5.4.rbi +0 -8
  126. data/sorbet/rbi/gems/marcel@0.3.3.rbi +0 -30
  127. data/sorbet/rbi/gems/mimemagic@0.3.5.rbi +0 -47
  128. data/sorbet/rbi/gems/parlour@4.0.1.rbi +0 -561
  129. data/sorbet/rbi/gems/spoom@1.0.4.rbi +0 -418
  130. data/sorbet/rbi/gems/zeitwerk@2.3.0.rbi +0 -8
@@ -0,0 +1,106 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ require "benchmark"
5
+ require "parallel"
6
+
7
+ module Packwerk
8
+ class ParseRun
9
+ extend T::Sig
10
+
11
+ def initialize(
12
+ files:,
13
+ configuration:,
14
+ progress_formatter: Formatters::ProgressFormatter.new(StringIO.new),
15
+ offenses_formatter: Formatters::OffensesFormatter.new
16
+ )
17
+ @configuration = configuration
18
+ @progress_formatter = progress_formatter
19
+ @offenses_formatter = offenses_formatter
20
+ @files = files
21
+ end
22
+
23
+ def detect_stale_violations
24
+ offense_collection = find_offenses
25
+
26
+ result_status = !offense_collection.stale_violations?
27
+ message = @offenses_formatter.show_stale_violations(offense_collection)
28
+
29
+ Result.new(message: message, status: result_status)
30
+ end
31
+
32
+ def update_deprecations
33
+ offense_collection = find_offenses
34
+ offense_collection.dump_deprecated_references_files
35
+
36
+ message = <<~EOS
37
+ #{@offenses_formatter.show_offenses(offense_collection.errors)}
38
+ ✅ `deprecated_references.yml` has been updated.
39
+ EOS
40
+
41
+ Result.new(message: message, status: offense_collection.errors.empty?)
42
+ end
43
+
44
+ def check
45
+ offense_collection = find_offenses(show_errors: true)
46
+
47
+ messages = [
48
+ @offenses_formatter.show_offenses(offense_collection.outstanding_offenses),
49
+ @offenses_formatter.show_stale_violations(offense_collection),
50
+ ]
51
+ result_status = offense_collection.outstanding_offenses.empty? && !offense_collection.stale_violations?
52
+
53
+ Result.new(message: messages.join("\n") + "\n", status: result_status)
54
+ end
55
+
56
+ private
57
+
58
+ def find_offenses(show_errors: false)
59
+ offense_collection = OffenseCollection.new(@configuration.root_path)
60
+ @progress_formatter.started(@files)
61
+
62
+ run_context = Packwerk::RunContext.from_configuration(@configuration)
63
+ all_offenses = T.let([], T.untyped)
64
+
65
+ process_file = -> (path) do
66
+ run_context.process_file(file: path).tap do |offenses|
67
+ failed = show_errors && offenses.any? { |offense| !offense_collection.listed?(offense) }
68
+ update_progress(failed: failed)
69
+ end
70
+ end
71
+
72
+ execution_time = Benchmark.realtime do
73
+ all_offenses = if @configuration.parallel?
74
+ Parallel.flat_map(@files, &process_file)
75
+ else
76
+ serial_find_offenses(&process_file)
77
+ end
78
+ end
79
+
80
+ @progress_formatter.finished(execution_time)
81
+
82
+ all_offenses.each { |offense| offense_collection.add_offense(offense) }
83
+ offense_collection
84
+ end
85
+
86
+ def serial_find_offenses
87
+ all_offenses = T.let([], T.untyped)
88
+ @files.each do |path|
89
+ offenses = yield path
90
+ all_offenses.concat(offenses)
91
+ end
92
+ all_offenses
93
+ rescue Interrupt
94
+ @progress_formatter.interrupted
95
+ all_offenses
96
+ end
97
+
98
+ def update_progress(failed: false)
99
+ if failed
100
+ @progress_formatter.mark_as_failed
101
+ else
102
+ @progress_formatter.mark_as_inspected
103
+ end
104
+ end
105
+ end
106
+ end
@@ -3,8 +3,6 @@
3
3
 
4
4
  require "ast/node"
5
5
 
6
- require "packwerk/node"
7
-
8
6
  module Packwerk
9
7
  class ParsedConstantDefinitions
10
8
  def initialize(root_node:)
@@ -1,8 +1,6 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
- require "packwerk/offense"
5
-
6
4
  module Packwerk
7
5
  module Parsers
8
6
  autoload :Erb, "packwerk/parsers/erb"
@@ -6,8 +6,6 @@ require "better_html"
6
6
  require "better_html/parser"
7
7
  require "parser/source/buffer"
8
8
 
9
- require "packwerk/parsers"
10
-
11
9
  module Packwerk
12
10
  module Parsers
13
11
  class Erb
@@ -3,8 +3,6 @@
3
3
 
4
4
  require "singleton"
5
5
 
6
- require "packwerk/parsers"
7
-
8
6
  module Packwerk
9
7
  module Parsers
10
8
  class Factory
@@ -1,9 +1,6 @@
1
1
  # typed: strict
2
2
  # frozen_string_literal: true
3
3
 
4
- require "packwerk/violation_type"
5
- require "packwerk/checker"
6
-
7
4
  module Packwerk
8
5
  class PrivacyChecker
9
6
  extend T::Sig
@@ -16,10 +13,10 @@ module Packwerk
16
13
 
17
14
  sig do
18
15
  override
19
- .params(reference: Packwerk::Reference, reference_lister: Packwerk::ReferenceLister)
16
+ .params(reference: Packwerk::Reference)
20
17
  .returns(T::Boolean)
21
18
  end
22
- def invalid_reference?(reference, reference_lister)
19
+ def invalid_reference?(reference)
23
20
  return false if reference.constant.public?
24
21
 
25
22
  privacy_option = reference.constant.package.enforce_privacy
@@ -28,19 +25,9 @@ module Packwerk
28
25
  return false unless privacy_option == true ||
29
26
  explicitly_private_constant?(reference.constant, explicitly_private_constants: privacy_option)
30
27
 
31
- return false if reference_lister.listed?(reference, violation_type: violation_type)
32
-
33
28
  true
34
29
  end
35
30
 
36
- sig { override.params(reference: Packwerk::Reference).returns(String) }
37
- def message_for(reference)
38
- source_desc = reference.source_package ? "'#{reference.source_package}'" : "here"
39
- "Privacy violation: '#{reference.constant.name}' is private to '#{reference.constant.package}' but " \
40
- "referenced from #{source_desc}.\n" \
41
- "Is there a public entrypoint in '#{reference.constant.package.public_path}' that you can use instead?"
42
- end
43
-
44
31
  private
45
32
 
46
33
  sig do
@@ -1,14 +1,6 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
- require "sorbet-runtime"
5
-
6
- require "packwerk/constant_discovery"
7
- require "packwerk/constant_name_inspector"
8
- require "packwerk/node"
9
- require "packwerk/parsed_constant_definitions"
10
- require "packwerk/reference"
11
-
12
4
  module Packwerk
13
5
  # extracts a possible constant reference from a given AST node
14
6
  class ReferenceExtractor
@@ -0,0 +1,49 @@
1
+ # typed: true
2
+ # frozen_string_literal: true
3
+
4
+ module Packwerk
5
+ class ReferenceOffense < Offense
6
+ extend T::Sig
7
+ extend T::Helpers
8
+
9
+ attr_reader :reference, :violation_type
10
+
11
+ sig do
12
+ params(
13
+ reference: Packwerk::Reference,
14
+ violation_type: Packwerk::ViolationType,
15
+ location: T.nilable(Node::Location)
16
+ )
17
+ .void
18
+ end
19
+ def initialize(reference:, violation_type:, location: nil)
20
+ super(file: reference.relative_path, message: build_message(reference, violation_type), location: location)
21
+ @reference = reference
22
+ @violation_type = violation_type
23
+ end
24
+
25
+ private
26
+
27
+ def build_message(reference, violation_type)
28
+ violation_message = case violation_type
29
+ when ViolationType::Privacy
30
+ source_desc = reference.source_package ? "'#{reference.source_package}'" : "here"
31
+ "Privacy violation: '#{reference.constant.name}' is private to '#{reference.constant.package}' but " \
32
+ "referenced from #{source_desc}.\n" \
33
+ "Is there a public entrypoint in '#{reference.constant.package.public_path}' that you can use instead?"
34
+ when ViolationType::Dependency
35
+ "Dependency violation: #{reference.constant.name} belongs to '#{reference.constant.package}', but " \
36
+ "'#{reference.source_package}' does not specify a dependency on " \
37
+ "'#{reference.constant.package}'.\n" \
38
+ "Are we missing an abstraction?\n" \
39
+ "Is the code making the reference, and the referenced constant, in the right packages?\n"
40
+ end
41
+
42
+ <<~EOS
43
+ #{violation_message}
44
+ Inference details: this is a reference to #{reference.constant.name} which seems to be defined in #{reference.constant.location}.
45
+ To receive help interpreting or resolving this error message, see: https://github.com/Shopify/packwerk/blob/main/TROUBLESHOOT.md#Troubleshooting-violations
46
+ EOS
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,9 @@
1
+ # typed: strict
2
+ # frozen_string_literal: true
3
+
4
+ module Packwerk
5
+ class Result < T::Struct
6
+ prop :message, String
7
+ prop :status, T::Boolean
8
+ end
9
+ end
@@ -3,17 +3,6 @@
3
3
 
4
4
  require "constant_resolver"
5
5
 
6
- require "packwerk/association_inspector"
7
- require "packwerk/constant_discovery"
8
- require "packwerk/const_node_inspector"
9
- require "packwerk/dependency_checker"
10
- require "packwerk/file_processor"
11
- require "packwerk/inflector"
12
- require "packwerk/package_set"
13
- require "packwerk/privacy_checker"
14
- require "packwerk/reference_extractor"
15
- require "packwerk/node_processor_factory"
16
-
17
6
  module Packwerk
18
7
  class RunContext
19
8
  extend T::Sig
@@ -27,23 +16,20 @@ module Packwerk
27
16
  :checker_classes,
28
17
  )
29
18
 
30
- attr_accessor :reference_lister
31
-
32
19
  DEFAULT_CHECKERS = [
33
20
  ::Packwerk::DependencyChecker,
34
21
  ::Packwerk::PrivacyChecker,
35
22
  ]
36
23
 
37
24
  class << self
38
- def from_configuration(configuration, reference_lister:)
25
+ def from_configuration(configuration)
39
26
  inflector = ::Packwerk::Inflector.from_file(configuration.inflections_file)
40
27
  new(
41
28
  root_path: configuration.root_path,
42
29
  load_paths: configuration.load_paths,
43
30
  package_paths: configuration.package_paths,
44
31
  inflector: inflector,
45
- custom_associations: configuration.custom_associations,
46
- reference_lister: reference_lister,
32
+ custom_associations: configuration.custom_associations
47
33
  )
48
34
  end
49
35
  end
@@ -54,8 +40,7 @@ module Packwerk
54
40
  package_paths: nil,
55
41
  inflector: nil,
56
42
  custom_associations: [],
57
- checker_classes: DEFAULT_CHECKERS,
58
- reference_lister:
43
+ checker_classes: DEFAULT_CHECKERS
59
44
  )
60
45
  @root_path = root_path
61
46
  @load_paths = load_paths
@@ -63,7 +48,6 @@ module Packwerk
63
48
  @inflector = inflector
64
49
  @custom_associations = custom_associations
65
50
  @checker_classes = checker_classes
66
- @reference_lister = reference_lister
67
51
  end
68
52
 
69
53
  sig { params(file: String).returns(T::Array[T.nilable(::Packwerk::Offense)]) }
@@ -84,8 +68,7 @@ module Packwerk
84
68
  context_provider: context_provider,
85
69
  checkers: checkers,
86
70
  root_path: root_path,
87
- constant_name_inspectors: constant_name_inspectors,
88
- reference_lister: reference_lister
71
+ constant_name_inspectors: constant_name_inspectors
89
72
  )
90
73
  end
91
74
 
@@ -1,8 +1,6 @@
1
1
  # typed: false
2
2
  # frozen_string_literal: true
3
3
 
4
- require "packwerk/application_validator"
5
-
6
4
  module Packwerk
7
5
  # To do: This alias and file should be removed as it is deprecated
8
6
  warn("DEPRECATION WARNING: Packwerk::SanityChecker is deprecated, use Packwerk::ApplicationValidator instead.")
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Packwerk
5
- VERSION = "1.1.2"
5
+ VERSION = "1.3.1"
6
6
  end
@@ -1,8 +1,6 @@
1
1
  # typed: true
2
2
  # frozen_string_literal: true
3
3
 
4
- require "sorbet-runtime"
5
-
6
4
  module Packwerk
7
5
  class ViolationType < T::Enum
8
6
  enums do
data/library.yml CHANGED
@@ -3,4 +3,4 @@ name: Packwerk
3
3
  stewards:
4
4
  - "@Shopify/kernel-architecture-patterns"
5
5
  slack_channels:
6
- - architecture-patterns
6
+ - code-foundations
data/packwerk.gemspec CHANGED
@@ -42,6 +42,7 @@ Gem::Specification.new do |spec|
42
42
 
43
43
  spec.add_dependency("activesupport", ">= 5.2")
44
44
  spec.add_dependency("constant_resolver")
45
+ spec.add_dependency("parallel")
45
46
  spec.add_dependency("sorbet-runtime")
46
47
 
47
48
  spec.add_development_dependency("bundler")
data/service.yml CHANGED
@@ -1,6 +1,3 @@
1
- # https://services.shopify.io/services/packwerk/production
2
- org_line: Kernel
3
- owners: Shopify/kernel-architecture-patterns
4
1
  classification: library
5
2
  slack_channels:
6
- - architecture-patterns
3
+ - core-stewardship
data/shipit.rubygems.yml CHANGED
@@ -1 +1,5 @@
1
- # default configs
1
+ dependencies:
2
+ override: []
3
+ deploy:
4
+ override:
5
+ - release-gem packwerk.gemspec rake release
@@ -1,6 +1,6 @@
1
1
  # DO NOT EDIT MANUALLY
2
2
  # This is an autogenerated file for types exported from the `actioncable` gem.
3
- # Please instead update this file by running `dev typecheck update`.
3
+ # Please instead update this file by running `bin/tapioca sync`.
4
4
 
5
5
  # typed: true
6
6
 
@@ -49,12 +49,12 @@ class ActionCable::Channel::Base
49
49
  def _unsubscribe_callbacks; end
50
50
  def connection; end
51
51
  def identifier; end
52
- def logger(*args, &block); end
52
+ def logger(*_arg0, &_arg1); end
53
53
  def params; end
54
54
  def perform_action(data); end
55
- def periodic_timers=(_); end
55
+ def periodic_timers=(_arg0); end
56
56
  def rescue_handlers; end
57
- def rescue_handlers=(_); end
57
+ def rescue_handlers=(_arg0); end
58
58
  def rescue_handlers?; end
59
59
  def subscribe_to_channel; end
60
60
  def unsubscribe_from_channel; end
@@ -107,8 +107,8 @@ module ActionCable::Channel::Broadcasting
107
107
 
108
108
  mixes_in_class_methods(::ActionCable::Channel::Broadcasting::ClassMethods)
109
109
 
110
- def broadcast_to(*args, &block); end
111
- def broadcasting_for(*args, &block); end
110
+ def broadcast_to(*_arg0, &_arg1); end
111
+ def broadcasting_for(*_arg0, &_arg1); end
112
112
  end
113
113
 
114
114
  module ActionCable::Channel::Broadcasting::ClassMethods
@@ -139,7 +139,7 @@ module ActionCable::Channel::Naming
139
139
 
140
140
  mixes_in_class_methods(::ActionCable::Channel::Naming::ClassMethods)
141
141
 
142
- def channel_name(*args, &block); end
142
+ def channel_name(*_arg0, &_arg1); end
143
143
  end
144
144
 
145
145
  module ActionCable::Channel::Naming::ClassMethods
@@ -167,13 +167,13 @@ end
167
167
  module ActionCable::Channel::Streams
168
168
  extend(::ActiveSupport::Concern)
169
169
 
170
- def pubsub(*args, &block); end
170
+ def pubsub(*_arg0, &_arg1); end
171
171
  def stop_all_streams; end
172
172
  def stop_stream_for(model); end
173
173
  def stop_stream_from(broadcasting); end
174
174
  def stream_for(model, callback = T.unsafe(nil), coder: T.unsafe(nil), &block); end
175
175
  def stream_from(broadcasting, callback = T.unsafe(nil), coder: T.unsafe(nil), &block); end
176
- def stream_or_reject_for(record); end
176
+ def stream_or_reject_for(model); end
177
177
 
178
178
  private
179
179
 
@@ -194,7 +194,7 @@ class ActionCable::Channel::TestCase < ::ActiveSupport::TestCase
194
194
  extend(::ActionCable::Channel::TestCase::Behavior::ClassMethods)
195
195
 
196
196
  def _channel_class; end
197
- def _channel_class=(_); end
197
+ def _channel_class=(_arg0); end
198
198
  def _channel_class?; end
199
199
  def connection; end
200
200
  def subscription; end
@@ -264,9 +264,9 @@ class ActionCable::Connection::Base
264
264
  def close(reason: T.unsafe(nil), reconnect: T.unsafe(nil)); end
265
265
  def dispatch_websocket_message(websocket_message); end
266
266
  def env; end
267
- def event_loop(*args, &block); end
267
+ def event_loop(*_arg0, &_arg1); end
268
268
  def identifiers; end
269
- def identifiers=(_); end
269
+ def identifiers=(_arg0); end
270
270
  def identifiers?; end
271
271
  def logger; end
272
272
  def on_close(reason, code); end
@@ -275,10 +275,10 @@ class ActionCable::Connection::Base
275
275
  def on_open; end
276
276
  def process; end
277
277
  def protocol; end
278
- def pubsub(*args, &block); end
278
+ def pubsub(*_arg0, &_arg1); end
279
279
  def receive(websocket_message); end
280
280
  def rescue_handlers; end
281
- def rescue_handlers=(_); end
281
+ def rescue_handlers=(_arg0); end
282
282
  def rescue_handlers?; end
283
283
  def send_async(method, *arguments); end
284
284
  def server; end
@@ -438,7 +438,7 @@ class ActionCable::Connection::Subscriptions
438
438
  def add(data); end
439
439
  def execute_command(data); end
440
440
  def identifiers; end
441
- def logger(*args, &block); end
441
+ def logger(*_arg0, &_arg1); end
442
442
  def perform_action(data); end
443
443
  def remove(data); end
444
444
  def remove_subscription(subscription); end
@@ -477,7 +477,7 @@ class ActionCable::Connection::TestCase < ::ActiveSupport::TestCase
477
477
  extend(::ActionCable::Connection::TestCase::Behavior::ClassMethods)
478
478
 
479
479
  def _connection_class; end
480
- def _connection_class=(_); end
480
+ def _connection_class=(_arg0); end
481
481
  def _connection_class?; end
482
482
  def connection; end
483
483
 
@@ -556,7 +556,7 @@ class ActionCable::RemoteConnections::RemoteConnection
556
556
 
557
557
  def disconnect; end
558
558
  def identifiers; end
559
- def identifiers=(_); end
559
+ def identifiers=(_arg0); end
560
560
  def identifiers?; end
561
561
 
562
562
  protected
@@ -593,7 +593,7 @@ class ActionCable::Server::Base
593
593
  def connection_identifiers; end
594
594
  def disconnect(identifiers); end
595
595
  def event_loop; end
596
- def logger(*args, &block); end
596
+ def logger(*_arg0, &_arg1); end
597
597
  def mutex; end
598
598
  def pubsub; end
599
599
  def remote_connections; end
@@ -625,26 +625,26 @@ class ActionCable::Server::Configuration
625
625
  def initialize; end
626
626
 
627
627
  def allow_same_origin_as_host; end
628
- def allow_same_origin_as_host=(_); end
628
+ def allow_same_origin_as_host=(_arg0); end
629
629
  def allowed_request_origins; end
630
- def allowed_request_origins=(_); end
630
+ def allowed_request_origins=(_arg0); end
631
631
  def cable; end
632
- def cable=(_); end
632
+ def cable=(_arg0); end
633
633
  def connection_class; end
634
- def connection_class=(_); end
634
+ def connection_class=(_arg0); end
635
635
  def disable_request_forgery_protection; end
636
- def disable_request_forgery_protection=(_); end
636
+ def disable_request_forgery_protection=(_arg0); end
637
637
  def log_tags; end
638
- def log_tags=(_); end
638
+ def log_tags=(_arg0); end
639
639
  def logger; end
640
- def logger=(_); end
640
+ def logger=(_arg0); end
641
641
  def mount_path; end
642
- def mount_path=(_); end
642
+ def mount_path=(_arg0); end
643
643
  def pubsub_adapter; end
644
644
  def url; end
645
- def url=(_); end
645
+ def url=(_arg0); end
646
646
  def worker_pool_size; end
647
- def worker_pool_size=(_); end
647
+ def worker_pool_size=(_arg0); end
648
648
  end
649
649
 
650
650
  module ActionCable::Server::Connections
@@ -659,15 +659,29 @@ ActionCable::Server::Connections::BEAT_INTERVAL = T.let(T.unsafe(nil), Integer)
659
659
 
660
660
  class ActionCable::Server::Worker
661
661
  include(::ActiveSupport::Callbacks)
662
+ include(::ActionCable::Server::Worker::ActiveRecordConnectionManagement)
662
663
  extend(::ActiveSupport::Callbacks::ClassMethods)
663
664
  extend(::ActiveSupport::DescendantsTracker)
664
665
 
666
+ def initialize(max_size: T.unsafe(nil)); end
667
+
665
668
  def __callbacks; end
666
669
  def __callbacks?; end
667
670
  def _run_work_callbacks(&block); end
668
671
  def _work_callbacks; end
672
+ def async_exec(receiver, *args, connection:, &block); end
673
+ def async_invoke(receiver, method, *args, connection: T.unsafe(nil), &block); end
669
674
  def connection; end
670
675
  def connection=(obj); end
676
+ def executor; end
677
+ def halt; end
678
+ def invoke(receiver, method, *args, connection:, &block); end
679
+ def stopping?; end
680
+ def work(connection); end
681
+
682
+ private
683
+
684
+ def logger; end
671
685
 
672
686
  class << self
673
687
  def __callbacks; end
@@ -680,6 +694,12 @@ class ActionCable::Server::Worker
680
694
  end
681
695
  end
682
696
 
697
+ module ActionCable::Server::Worker::ActiveRecordConnectionManagement
698
+ extend(::ActiveSupport::Concern)
699
+
700
+ def with_database_connections; end
701
+ end
702
+
683
703
  module ActionCable::SubscriptionAdapter
684
704
  extend(::ActiveSupport::Autoload)
685
705
  end
@@ -738,8 +758,8 @@ module ActionCable::TestHelper
738
758
  def assert_broadcasts(stream, number, &block); end
739
759
  def assert_no_broadcasts(stream, &block); end
740
760
  def before_setup; end
741
- def broadcasts(*args, &block); end
742
- def clear_messages(*args, &block); end
761
+ def broadcasts(*_arg0, &_arg1); end
762
+ def clear_messages(*_arg0, &_arg1); end
743
763
  def pubsub_adapter; end
744
764
 
745
765
  private
@@ -766,7 +786,7 @@ module ActionCable::Channel::ChannelStub
766
786
  def start_periodic_timers; end
767
787
  def stop_all_streams; end
768
788
  def stop_periodic_timers; end
769
- def stream_from(broadcasting, *_); end
789
+ def stream_from(broadcasting, *_arg1); end
770
790
  def streams; end
771
791
  end
772
792
 
@@ -806,9 +826,9 @@ end
806
826
 
807
827
  class ActionCable::Connection::TestRequest < ::ActionDispatch::TestRequest
808
828
  def cookie_jar; end
809
- def cookie_jar=(_); end
829
+ def cookie_jar=(_arg0); end
810
830
  def session; end
811
- def session=(_); end
831
+ def session=(_arg0); end
812
832
  end
813
833
 
814
834
  class ActionCable::SubscriptionAdapter::Async < ::ActionCable::SubscriptionAdapter::Inline
@@ -821,12 +841,12 @@ end
821
841
  class ActionCable::SubscriptionAdapter::Async::AsyncSubscriberMap < ::ActionCable::SubscriptionAdapter::SubscriberMap
822
842
  def initialize(event_loop); end
823
843
 
824
- def add_subscriber(*_); end
825
- def invoke_callback(*_); end
844
+ def add_subscriber(*_arg0); end
845
+ def invoke_callback(*_arg0); end
826
846
  end
827
847
 
828
848
  class ActionCable::SubscriptionAdapter::Inline < ::ActionCable::SubscriptionAdapter::Base
829
- def initialize(*_); end
849
+ def initialize(*_arg0); end
830
850
 
831
851
  def broadcast(channel, payload); end
832
852
  def shutdown; end