packwerk 2.1.1 → 2.2.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.
Files changed (189) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +29 -20
  3. data/.github/workflows/cla.yml +22 -0
  4. data/.rubocop.yml +48 -19
  5. data/Gemfile +7 -2
  6. data/Gemfile.lock +204 -177
  7. data/README.md +7 -2
  8. data/RESOLVING_VIOLATIONS.md +81 -0
  9. data/Rakefile +1 -1
  10. data/USAGE.md +14 -5
  11. data/bin/m +1 -1
  12. data/bin/rake +1 -1
  13. data/bin/rubocop +1 -1
  14. data/bin/srb +1 -1
  15. data/bin/tapioca +1 -1
  16. data/gemfiles/Gemfile-rails-6-0 +1 -1
  17. data/gemfiles/Gemfile-rails-6-1 +22 -0
  18. data/lib/packwerk/application_load_paths.rb +12 -18
  19. data/lib/packwerk/application_validator.rb +7 -6
  20. data/lib/packwerk/association_inspector.rb +17 -15
  21. data/lib/packwerk/cache.rb +36 -29
  22. data/lib/packwerk/cli.rb +14 -8
  23. data/lib/packwerk/const_node_inspector.rb +8 -7
  24. data/lib/packwerk/constant_name_inspector.rb +2 -2
  25. data/lib/packwerk/deprecated_references.rb +34 -19
  26. data/lib/packwerk/file_processor.rb +25 -23
  27. data/lib/packwerk/files_for_processing.rb +33 -35
  28. data/lib/packwerk/formatters/offenses_formatter.rb +3 -3
  29. data/lib/packwerk/formatters/progress_formatter.rb +2 -2
  30. data/lib/packwerk/node.rb +1 -294
  31. data/lib/packwerk/node_helpers.rb +335 -0
  32. data/lib/packwerk/node_processor.rb +6 -5
  33. data/lib/packwerk/node_processor_factory.rb +3 -3
  34. data/lib/packwerk/node_visitor.rb +1 -1
  35. data/lib/packwerk/offense_collection.rb +6 -3
  36. data/lib/packwerk/offenses_formatter.rb +2 -2
  37. data/lib/packwerk/package.rb +3 -0
  38. data/lib/packwerk/package_set.rb +3 -1
  39. data/lib/packwerk/parse_run.rb +15 -13
  40. data/lib/packwerk/parsed_constant_definitions.rb +23 -20
  41. data/lib/packwerk/parsers/erb.rb +3 -3
  42. data/lib/packwerk/parsers/parser_interface.rb +2 -0
  43. data/lib/packwerk/reference_checking/checkers/checker.rb +16 -3
  44. data/lib/packwerk/reference_checking/checkers/dependency_checker.rb +16 -0
  45. data/lib/packwerk/reference_checking/checkers/privacy_checker.rb +18 -0
  46. data/lib/packwerk/reference_checking/reference_checker.rb +4 -4
  47. data/lib/packwerk/reference_extractor.rb +51 -54
  48. data/lib/packwerk/reference_offense.rb +3 -27
  49. data/lib/packwerk/run_context.rb +9 -7
  50. data/lib/packwerk/spring_command.rb +1 -1
  51. data/lib/packwerk/version.rb +1 -1
  52. data/lib/packwerk.rb +1 -0
  53. data/packwerk.gemspec +4 -11
  54. data/sorbet/rbi/gems/actioncable@7.0.3.1.rbi +2754 -0
  55. data/sorbet/rbi/gems/actionmailbox@7.0.3.1.rbi +1496 -0
  56. data/sorbet/rbi/gems/actionmailer@7.0.3.1.rbi +2362 -0
  57. data/sorbet/rbi/gems/actionpack@7.0.3.1.rbi +19397 -0
  58. data/sorbet/rbi/gems/actiontext@7.0.3.1.rbi +1569 -0
  59. data/sorbet/rbi/gems/actionview@7.0.3.1.rbi +14907 -0
  60. data/sorbet/rbi/gems/activejob@7.0.3.1.rbi +2553 -0
  61. data/sorbet/rbi/gems/activemodel@7.0.3.1.rbi +5999 -0
  62. data/sorbet/rbi/gems/activerecord@7.0.3.1.rbi +37832 -0
  63. data/sorbet/rbi/gems/activestorage@7.0.3.1.rbi +2321 -0
  64. data/sorbet/rbi/gems/activesupport@7.0.3.1.rbi +18818 -0
  65. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +11722 -0
  66. data/sorbet/rbi/gems/constant_resolver@0.2.0.rbi +90 -0
  67. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +1079 -0
  68. data/sorbet/rbi/gems/digest@3.1.0.rbi +189 -0
  69. data/sorbet/rbi/gems/erubi@1.11.0.rbi +140 -0
  70. data/sorbet/rbi/gems/globalid@1.0.0.rbi +572 -0
  71. data/sorbet/rbi/gems/i18n@1.12.0.rbi +2296 -0
  72. data/sorbet/rbi/gems/json@2.6.2.rbi +1548 -0
  73. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +8 -0
  74. data/sorbet/rbi/gems/loofah@2.18.0.rbi +877 -0
  75. data/sorbet/rbi/gems/m@1.6.0.rbi +257 -0
  76. data/sorbet/rbi/gems/marcel@1.0.2.rbi +220 -0
  77. data/sorbet/rbi/gems/mini_mime@1.1.2.rbi +170 -0
  78. data/sorbet/rbi/gems/mini_portile2@2.8.0.rbi +8 -0
  79. data/sorbet/rbi/gems/minitest-focus@1.3.1.rbi +104 -0
  80. data/sorbet/rbi/gems/minitest@5.16.2.rbi +2136 -0
  81. data/sorbet/rbi/gems/mocha@1.14.0.rbi +4177 -0
  82. data/sorbet/rbi/gems/net-imap@0.2.3.rbi +2147 -0
  83. data/sorbet/rbi/gems/net-pop@0.1.1.rbi +926 -0
  84. data/sorbet/rbi/gems/net-protocol@0.1.3.rbi +11 -0
  85. data/sorbet/rbi/gems/net-smtp@0.3.1.rbi +1108 -0
  86. data/sorbet/rbi/gems/netrc@0.11.0.rbi +153 -0
  87. data/sorbet/rbi/gems/nio4r@2.5.8.rbi +292 -0
  88. data/sorbet/rbi/gems/nokogiri@1.13.8.rbi +6478 -0
  89. data/sorbet/rbi/gems/parallel@1.22.1.rbi +277 -0
  90. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +9029 -0
  91. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +8 -0
  92. data/sorbet/rbi/gems/pry@0.14.1.rbi +8 -0
  93. data/sorbet/rbi/gems/racc@1.6.0.rbi +152 -0
  94. data/sorbet/rbi/gems/rack-test@2.0.2.rbi +953 -0
  95. data/sorbet/rbi/gems/rack@2.2.4.rbi +5636 -0
  96. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +688 -0
  97. data/sorbet/rbi/gems/rails@7.0.3.1.rbi +8 -0
  98. data/sorbet/rbi/gems/railties@7.0.3.1.rbi +3507 -0
  99. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +392 -0
  100. data/sorbet/rbi/gems/rake@13.0.6.rbi +2924 -0
  101. data/sorbet/rbi/gems/rbi@0.0.15.rbi +3007 -0
  102. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +3383 -0
  103. data/sorbet/rbi/gems/rexml@3.2.5.rbi +4714 -0
  104. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +6961 -0
  105. data/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi +2986 -0
  106. data/sorbet/rbi/gems/{rubocop-shopify@2.0.1.rbi → rubocop-shopify@2.9.0.rbi} +4 -4
  107. data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +992 -0
  108. data/sorbet/rbi/gems/rubocop@1.34.1.rbi +51820 -0
  109. data/sorbet/rbi/gems/ruby-lsp@0.2.1.rbi +11 -0
  110. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +474 -0
  111. data/sorbet/rbi/gems/spoom@1.1.11.rbi +2181 -0
  112. data/sorbet/rbi/gems/spring@4.0.0.rbi +411 -0
  113. data/sorbet/rbi/gems/strscan@3.0.4.rbi +8 -0
  114. data/sorbet/rbi/gems/syntax_tree@3.3.0.rbi +8 -0
  115. data/sorbet/rbi/gems/tapioca@0.9.2.rbi +3181 -0
  116. data/sorbet/rbi/gems/thor@1.2.1.rbi +3956 -0
  117. data/sorbet/rbi/gems/timeout@0.3.0.rbi +142 -0
  118. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +5896 -0
  119. data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +48 -0
  120. data/sorbet/rbi/gems/unparser@0.6.5.rbi +4529 -0
  121. data/sorbet/rbi/gems/webrick@1.7.0.rbi +2582 -0
  122. data/sorbet/rbi/gems/websocket-driver@0.7.5.rbi +993 -0
  123. data/sorbet/rbi/gems/yard-sorbet@0.6.1.rbi +388 -0
  124. data/sorbet/rbi/gems/yard@0.9.28.rbi +18242 -0
  125. data/sorbet/rbi/gems/zeitwerk@2.6.0.rbi +867 -0
  126. data/sorbet/rbi/shims/psych.rbi +5 -0
  127. data/sorbet/tapioca/require.rb +2 -3
  128. metadata +88 -143
  129. data/.github/probots.yml +0 -2
  130. data/library.yml +0 -6
  131. data/service.yml +0 -1
  132. data/sorbet/rbi/gems/actioncable@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -860
  133. data/sorbet/rbi/gems/actionmailbox@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -568
  134. data/sorbet/rbi/gems/actionmailer@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -587
  135. data/sorbet/rbi/gems/actionpack@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -5314
  136. data/sorbet/rbi/gems/actiontext@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -699
  137. data/sorbet/rbi/gems/actionview@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -2515
  138. data/sorbet/rbi/gems/activejob@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -624
  139. data/sorbet/rbi/gems/activemodel@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -1248
  140. data/sorbet/rbi/gems/activerecord@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -8363
  141. data/sorbet/rbi/gems/activestorage@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -876
  142. data/sorbet/rbi/gems/activesupport@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -3987
  143. data/sorbet/rbi/gems/colorize@0.8.1.rbi +0 -40
  144. data/sorbet/rbi/gems/commander@4.5.2.rbi +0 -8
  145. data/sorbet/rbi/gems/concurrent-ruby@1.1.8.rbi +0 -1969
  146. data/sorbet/rbi/gems/constant_resolver@0.1.5.rbi +0 -26
  147. data/sorbet/rbi/gems/erubi@1.10.0.rbi +0 -41
  148. data/sorbet/rbi/gems/globalid@0.4.2.rbi +0 -178
  149. data/sorbet/rbi/gems/highline@2.0.3.rbi +0 -8
  150. data/sorbet/rbi/gems/i18n@1.8.10.rbi +0 -600
  151. data/sorbet/rbi/gems/loofah@2.9.0.rbi +0 -274
  152. data/sorbet/rbi/gems/m@1.5.1.rbi +0 -108
  153. data/sorbet/rbi/gems/marcel@1.0.0.rbi +0 -70
  154. data/sorbet/rbi/gems/mini_mime@1.0.3.rbi +0 -71
  155. data/sorbet/rbi/gems/minitest-focus@1.2.1.rbi +0 -8
  156. data/sorbet/rbi/gems/minitest@5.14.4.rbi +0 -544
  157. data/sorbet/rbi/gems/mocha@1.12.0.rbi +0 -953
  158. data/sorbet/rbi/gems/nio4r@2.5.7.rbi +0 -90
  159. data/sorbet/rbi/gems/nokogiri@1.11.2.rbi +0 -1647
  160. data/sorbet/rbi/gems/parallel@1.20.1.rbi +0 -117
  161. data/sorbet/rbi/gems/parlour@6.0.0.rbi +0 -1272
  162. data/sorbet/rbi/gems/parser@3.0.0.0.rbi +0 -1745
  163. data/sorbet/rbi/gems/pry@0.14.0.rbi +0 -8
  164. data/sorbet/rbi/gems/psych@3.3.2.rbi +0 -24
  165. data/sorbet/rbi/gems/racc@1.5.2.rbi +0 -57
  166. data/sorbet/rbi/gems/rack-test@1.1.0.rbi +0 -335
  167. data/sorbet/rbi/gems/rack@2.2.3.rbi +0 -1718
  168. data/sorbet/rbi/gems/rails-html-sanitizer@1.3.0.rbi +0 -213
  169. data/sorbet/rbi/gems/rails@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -8
  170. data/sorbet/rbi/gems/railties@7.0.0.alpha-d612542336d9a61381311c95a27d801bb4094779.rbi +0 -880
  171. data/sorbet/rbi/gems/rainbow@3.0.0.rbi +0 -155
  172. data/sorbet/rbi/gems/rake@13.0.3.rbi +0 -837
  173. data/sorbet/rbi/gems/regexp_parser@2.1.1.rbi +0 -8
  174. data/sorbet/rbi/gems/rexml@3.2.4.rbi +0 -8
  175. data/sorbet/rbi/gems/rubocop-ast@1.4.1.rbi +0 -8
  176. data/sorbet/rbi/gems/rubocop-performance@1.10.2.rbi +0 -8
  177. data/sorbet/rbi/gems/rubocop-sorbet@0.6.1.rbi +0 -8
  178. data/sorbet/rbi/gems/rubocop@1.12.0.rbi +0 -8
  179. data/sorbet/rbi/gems/smart_properties@1.15.0.rbi +0 -168
  180. data/sorbet/rbi/gems/spoom@1.1.0.rbi +0 -1061
  181. data/sorbet/rbi/gems/spring@2.1.1.rbi +0 -160
  182. data/sorbet/rbi/gems/sprockets-rails@3.2.2.rbi +0 -451
  183. data/sorbet/rbi/gems/sprockets@4.0.2.rbi +0 -1133
  184. data/sorbet/rbi/gems/tapioca@0.4.19.rbi +0 -603
  185. data/sorbet/rbi/gems/thor@1.1.0.rbi +0 -893
  186. data/sorbet/rbi/gems/tzinfo@2.0.4.rbi +0 -566
  187. data/sorbet/rbi/gems/unicode-display_width@2.0.0.rbi +0 -8
  188. data/sorbet/rbi/gems/websocket-driver@0.7.3.rbi +0 -438
  189. data/sorbet/rbi/gems/zeitwerk@2.4.2.rbi +0 -177
data/Gemfile.lock CHANGED
@@ -1,240 +1,267 @@
1
- GIT
2
- remote: https://github.com/rails/rails.git
3
- revision: d612542336d9a61381311c95a27d801bb4094779
4
- branch: main
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ packwerk (2.2.1)
5
+ activesupport (>= 5.2)
6
+ ast
7
+ better_html
8
+ bundler
9
+ constant_resolver (>= 0.2.0)
10
+ parallel
11
+ parser
12
+ sorbet-runtime (>= 0.5.9914)
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
5
16
  specs:
6
- actioncable (7.0.0.alpha)
7
- actionpack (= 7.0.0.alpha)
8
- activesupport (= 7.0.0.alpha)
17
+ actioncable (7.0.3.1)
18
+ actionpack (= 7.0.3.1)
19
+ activesupport (= 7.0.3.1)
9
20
  nio4r (~> 2.0)
10
21
  websocket-driver (>= 0.6.1)
11
- actionmailbox (7.0.0.alpha)
12
- actionpack (= 7.0.0.alpha)
13
- activejob (= 7.0.0.alpha)
14
- activerecord (= 7.0.0.alpha)
15
- activestorage (= 7.0.0.alpha)
16
- activesupport (= 7.0.0.alpha)
22
+ actionmailbox (7.0.3.1)
23
+ actionpack (= 7.0.3.1)
24
+ activejob (= 7.0.3.1)
25
+ activerecord (= 7.0.3.1)
26
+ activestorage (= 7.0.3.1)
27
+ activesupport (= 7.0.3.1)
17
28
  mail (>= 2.7.1)
18
- actionmailer (7.0.0.alpha)
19
- actionpack (= 7.0.0.alpha)
20
- actionview (= 7.0.0.alpha)
21
- activejob (= 7.0.0.alpha)
22
- activesupport (= 7.0.0.alpha)
29
+ net-imap
30
+ net-pop
31
+ net-smtp
32
+ actionmailer (7.0.3.1)
33
+ actionpack (= 7.0.3.1)
34
+ actionview (= 7.0.3.1)
35
+ activejob (= 7.0.3.1)
36
+ activesupport (= 7.0.3.1)
23
37
  mail (~> 2.5, >= 2.5.4)
38
+ net-imap
39
+ net-pop
40
+ net-smtp
24
41
  rails-dom-testing (~> 2.0)
25
- actionpack (7.0.0.alpha)
26
- actionview (= 7.0.0.alpha)
27
- activesupport (= 7.0.0.alpha)
28
- rack (~> 2.0, >= 2.0.9)
42
+ actionpack (7.0.3.1)
43
+ actionview (= 7.0.3.1)
44
+ activesupport (= 7.0.3.1)
45
+ rack (~> 2.0, >= 2.2.0)
29
46
  rack-test (>= 0.6.3)
30
47
  rails-dom-testing (~> 2.0)
31
48
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
32
- actiontext (7.0.0.alpha)
33
- actionpack (= 7.0.0.alpha)
34
- activerecord (= 7.0.0.alpha)
35
- activestorage (= 7.0.0.alpha)
36
- activesupport (= 7.0.0.alpha)
49
+ actiontext (7.0.3.1)
50
+ actionpack (= 7.0.3.1)
51
+ activerecord (= 7.0.3.1)
52
+ activestorage (= 7.0.3.1)
53
+ activesupport (= 7.0.3.1)
54
+ globalid (>= 0.6.0)
37
55
  nokogiri (>= 1.8.5)
38
- actionview (7.0.0.alpha)
39
- activesupport (= 7.0.0.alpha)
56
+ actionview (7.0.3.1)
57
+ activesupport (= 7.0.3.1)
40
58
  builder (~> 3.1)
41
59
  erubi (~> 1.4)
42
60
  rails-dom-testing (~> 2.0)
43
61
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
44
- activejob (7.0.0.alpha)
45
- activesupport (= 7.0.0.alpha)
62
+ activejob (7.0.3.1)
63
+ activesupport (= 7.0.3.1)
46
64
  globalid (>= 0.3.6)
47
- activemodel (7.0.0.alpha)
48
- activesupport (= 7.0.0.alpha)
49
- activerecord (7.0.0.alpha)
50
- activemodel (= 7.0.0.alpha)
51
- activesupport (= 7.0.0.alpha)
52
- activestorage (7.0.0.alpha)
53
- actionpack (= 7.0.0.alpha)
54
- activejob (= 7.0.0.alpha)
55
- activerecord (= 7.0.0.alpha)
56
- activesupport (= 7.0.0.alpha)
57
- marcel (~> 1.0.0)
58
- mini_mime (~> 1.0.2)
59
- activesupport (7.0.0.alpha)
65
+ activemodel (7.0.3.1)
66
+ activesupport (= 7.0.3.1)
67
+ activerecord (7.0.3.1)
68
+ activemodel (= 7.0.3.1)
69
+ activesupport (= 7.0.3.1)
70
+ activestorage (7.0.3.1)
71
+ actionpack (= 7.0.3.1)
72
+ activejob (= 7.0.3.1)
73
+ activerecord (= 7.0.3.1)
74
+ activesupport (= 7.0.3.1)
75
+ marcel (~> 1.0)
76
+ mini_mime (>= 1.1.0)
77
+ activesupport (7.0.3.1)
60
78
  concurrent-ruby (~> 1.0, >= 1.0.2)
61
79
  i18n (>= 1.6, < 2)
62
80
  minitest (>= 5.1)
63
81
  tzinfo (~> 2.0)
64
- zeitwerk (~> 2.3)
65
- rails (7.0.0.alpha)
66
- actioncable (= 7.0.0.alpha)
67
- actionmailbox (= 7.0.0.alpha)
68
- actionmailer (= 7.0.0.alpha)
69
- actionpack (= 7.0.0.alpha)
70
- actiontext (= 7.0.0.alpha)
71
- actionview (= 7.0.0.alpha)
72
- activejob (= 7.0.0.alpha)
73
- activemodel (= 7.0.0.alpha)
74
- activerecord (= 7.0.0.alpha)
75
- activestorage (= 7.0.0.alpha)
76
- activesupport (= 7.0.0.alpha)
77
- bundler (>= 1.15.0)
78
- railties (= 7.0.0.alpha)
79
- sprockets-rails (>= 2.0.0)
80
- railties (7.0.0.alpha)
81
- actionpack (= 7.0.0.alpha)
82
- activesupport (= 7.0.0.alpha)
83
- method_source
84
- rake (>= 0.13)
85
- thor (~> 1.0)
86
-
87
- PATH
88
- remote: .
89
- specs:
90
- packwerk (2.1.1)
91
- activesupport (>= 5.2)
92
- ast
93
- better_html
94
- bundler
95
- constant_resolver
96
- digest
97
- parallel
98
- parser
99
- sorbet-runtime
100
-
101
- GEM
102
- remote: https://rubygems.org/
103
- specs:
104
82
  ast (2.4.2)
105
- better_html (1.0.16)
106
- actionview (>= 4.0)
107
- activesupport (>= 4.0)
83
+ better_html (2.0.1)
84
+ actionview (>= 6.0)
85
+ activesupport (>= 6.0)
108
86
  ast (~> 2.0)
109
87
  erubi (~> 1.4)
110
- html_tokenizer (~> 0.0.6)
111
88
  parser (>= 2.4)
112
89
  smart_properties
113
90
  builder (3.2.4)
114
91
  byebug (11.1.3)
115
92
  coderay (1.1.3)
116
- colorize (0.8.1)
117
- commander (4.5.2)
118
- highline (~> 2.0.0)
119
- concurrent-ruby (1.1.8)
120
- constant_resolver (0.1.5)
93
+ concurrent-ruby (1.1.10)
94
+ constant_resolver (0.2.0)
121
95
  crass (1.0.6)
96
+ diff-lcs (1.5.0)
122
97
  digest (3.1.0)
123
- erubi (1.10.0)
124
- globalid (0.4.2)
125
- activesupport (>= 4.2.0)
126
- highline (2.0.3)
127
- html_tokenizer (0.0.7)
128
- i18n (1.8.10)
98
+ erubi (1.11.0)
99
+ globalid (1.0.0)
100
+ activesupport (>= 5.0)
101
+ i18n (1.12.0)
129
102
  concurrent-ruby (~> 1.0)
130
- loofah (2.9.0)
103
+ json (2.6.2)
104
+ language_server-protocol (3.16.0.3)
105
+ loofah (2.18.0)
131
106
  crass (~> 1.0.2)
132
107
  nokogiri (>= 1.5.9)
133
- m (1.5.1)
108
+ m (1.6.0)
134
109
  method_source (>= 0.6.7)
135
110
  rake (>= 0.9.2.2)
136
111
  mail (2.7.1)
137
112
  mini_mime (>= 0.1.1)
138
- marcel (1.0.0)
113
+ marcel (1.0.2)
139
114
  method_source (1.0.0)
140
- mini_mime (1.0.3)
115
+ mini_mime (1.1.2)
141
116
  mini_portile2 (2.8.0)
142
- minitest (5.14.4)
143
- minitest-focus (1.2.1)
117
+ minitest (5.16.2)
118
+ minitest-focus (1.3.1)
144
119
  minitest (>= 4, < 6)
145
- mocha (1.12.0)
146
- nio4r (2.5.7)
147
- nokogiri (1.13.3)
120
+ mocha (1.14.0)
121
+ net-imap (0.2.3)
122
+ digest
123
+ net-protocol
124
+ strscan
125
+ net-pop (0.1.1)
126
+ digest
127
+ net-protocol
128
+ timeout
129
+ net-protocol (0.1.3)
130
+ timeout
131
+ net-smtp (0.3.1)
132
+ digest
133
+ net-protocol
134
+ timeout
135
+ netrc (0.11.0)
136
+ nio4r (2.5.8)
137
+ nokogiri (1.13.8)
148
138
  mini_portile2 (~> 2.8.0)
149
139
  racc (~> 1.4)
150
- nokogiri (1.13.3-x86_64-darwin)
140
+ nokogiri (1.13.8-x86_64-darwin)
151
141
  racc (~> 1.4)
152
- parallel (1.20.1)
153
- parlour (6.0.0)
154
- commander (~> 4.5)
155
- parser
156
- rainbow (~> 3.0)
157
- sorbet-runtime (>= 0.5)
158
- parser (3.0.0.0)
142
+ parallel (1.22.1)
143
+ parser (3.1.2.1)
159
144
  ast (~> 2.4.1)
160
- pry (0.14.0)
145
+ prettier_print (0.1.0)
146
+ pry (0.14.1)
161
147
  coderay (~> 1.1)
162
148
  method_source (~> 1.0)
163
- psych (3.3.2)
164
149
  racc (1.6.0)
165
- rack (2.2.3)
166
- rack-test (1.1.0)
167
- rack (>= 1.0, < 3)
150
+ rack (2.2.4)
151
+ rack-test (2.0.2)
152
+ rack (>= 1.3)
153
+ rails (7.0.3.1)
154
+ actioncable (= 7.0.3.1)
155
+ actionmailbox (= 7.0.3.1)
156
+ actionmailer (= 7.0.3.1)
157
+ actionpack (= 7.0.3.1)
158
+ actiontext (= 7.0.3.1)
159
+ actionview (= 7.0.3.1)
160
+ activejob (= 7.0.3.1)
161
+ activemodel (= 7.0.3.1)
162
+ activerecord (= 7.0.3.1)
163
+ activestorage (= 7.0.3.1)
164
+ activesupport (= 7.0.3.1)
165
+ bundler (>= 1.15.0)
166
+ railties (= 7.0.3.1)
168
167
  rails-dom-testing (2.0.3)
169
168
  activesupport (>= 4.2.0)
170
169
  nokogiri (>= 1.6)
171
- rails-html-sanitizer (1.3.0)
170
+ rails-html-sanitizer (1.4.3)
172
171
  loofah (~> 2.3)
173
- rainbow (3.0.0)
174
- rake (13.0.3)
175
- regexp_parser (2.1.1)
172
+ railties (7.0.3.1)
173
+ actionpack (= 7.0.3.1)
174
+ activesupport (= 7.0.3.1)
175
+ method_source
176
+ rake (>= 12.2)
177
+ thor (~> 1.0)
178
+ zeitwerk (~> 2.5)
179
+ rainbow (3.1.1)
180
+ rake (13.0.6)
181
+ rbi (0.0.15)
182
+ ast
183
+ parser (>= 2.6.4.0)
184
+ sorbet-runtime (>= 0.5.9204)
185
+ unparser
186
+ regexp_parser (2.5.0)
176
187
  rexml (3.2.5)
177
- rubocop (1.12.0)
188
+ rubocop (1.34.1)
189
+ json (~> 2.3)
178
190
  parallel (~> 1.10)
179
- parser (>= 3.0.0.0)
191
+ parser (>= 3.1.2.1)
180
192
  rainbow (>= 2.2.2, < 4.0)
181
193
  regexp_parser (>= 1.8, < 3.0)
182
- rexml
183
- rubocop-ast (>= 1.2.0, < 2.0)
194
+ rexml (>= 3.2.5, < 4.0)
195
+ rubocop-ast (>= 1.20.0, < 2.0)
184
196
  ruby-progressbar (~> 1.7)
185
197
  unicode-display_width (>= 1.4.0, < 3.0)
186
- rubocop-ast (1.4.1)
187
- parser (>= 2.7.1.5)
188
- rubocop-performance (1.10.2)
189
- rubocop (>= 0.90.0, < 2.0)
198
+ rubocop-ast (1.21.0)
199
+ parser (>= 3.1.1.0)
200
+ rubocop-performance (1.14.3)
201
+ rubocop (>= 1.7.0, < 2.0)
190
202
  rubocop-ast (>= 0.4.0)
191
- rubocop-shopify (2.0.1)
192
- rubocop (~> 1.11)
193
- rubocop-sorbet (0.6.1)
194
- rubocop
203
+ rubocop-shopify (2.9.0)
204
+ rubocop (~> 1.33)
205
+ rubocop-sorbet (0.6.11)
206
+ rubocop (>= 0.90.0)
207
+ ruby-lsp (0.2.3)
208
+ language_server-protocol
209
+ sorbet-runtime
210
+ syntax_tree (>= 2.4)
195
211
  ruby-progressbar (1.11.0)
196
212
  smart_properties (1.17.0)
197
- sorbet (0.5.9538)
198
- sorbet-static (= 0.5.9538)
199
- sorbet-runtime (0.5.9538)
200
- sorbet-static (0.5.9538-universal-darwin-14)
201
- sorbet-static (0.5.9538-universal-darwin-15)
202
- sorbet-static (0.5.9538-universal-darwin-16)
203
- sorbet-static (0.5.9538-universal-darwin-17)
204
- sorbet-static (0.5.9538-universal-darwin-18)
205
- sorbet-static (0.5.9538-universal-darwin-19)
206
- sorbet-static (0.5.9538-universal-darwin-20)
207
- sorbet-static (0.5.9538-universal-darwin-21)
208
- sorbet-static (0.5.9538-x86_64-linux)
209
- spoom (1.1.0)
210
- colorize
211
- sorbet (>= 0.5.6347)
212
- sorbet-runtime
213
+ sorbet (0.5.10313)
214
+ sorbet-static (= 0.5.10313)
215
+ sorbet-runtime (0.5.10313)
216
+ sorbet-static (0.5.10313-universal-darwin-14)
217
+ sorbet-static (0.5.10313-universal-darwin-15)
218
+ sorbet-static (0.5.10313-universal-darwin-16)
219
+ sorbet-static (0.5.10313-universal-darwin-17)
220
+ sorbet-static (0.5.10313-universal-darwin-18)
221
+ sorbet-static (0.5.10313-universal-darwin-19)
222
+ sorbet-static (0.5.10313-universal-darwin-20)
223
+ sorbet-static (0.5.10313-universal-darwin-21)
224
+ sorbet-static (0.5.10313-universal-darwin-22)
225
+ sorbet-static (0.5.10313-x86_64-linux)
226
+ sorbet-static-and-runtime (0.5.10313)
227
+ sorbet (= 0.5.10313)
228
+ sorbet-runtime (= 0.5.10313)
229
+ spoom (1.1.11)
230
+ sorbet (>= 0.5.9204)
231
+ sorbet-runtime (>= 0.5.9204)
213
232
  thor (>= 0.19.2)
214
- spring (2.1.1)
215
- sprockets (4.0.2)
216
- concurrent-ruby (~> 1.0)
217
- rack (> 1, < 3)
218
- sprockets-rails (3.2.2)
219
- actionpack (>= 4.0)
220
- activesupport (>= 4.0)
221
- sprockets (>= 3.0.0)
222
- tapioca (0.4.19)
233
+ spring (4.0.0)
234
+ strscan (3.0.4)
235
+ syntax_tree (3.3.0)
236
+ prettier_print
237
+ tapioca (0.9.2)
223
238
  bundler (>= 1.17.3)
224
- parlour (>= 2.1.0)
239
+ netrc (>= 0.11.0)
240
+ parallel (>= 1.21.0)
225
241
  pry (>= 0.12.2)
226
- sorbet-runtime
227
- sorbet-static (>= 0.4.4471)
228
- spoom
229
- thor (>= 0.19.2)
230
- thor (1.1.0)
231
- tzinfo (2.0.4)
242
+ rbi (~> 0.0.0, >= 0.0.14)
243
+ sorbet-static-and-runtime (>= 0.5.9204)
244
+ spoom (~> 1.1.0, >= 1.1.11)
245
+ thor (>= 1.2.0)
246
+ yard-sorbet
247
+ thor (1.2.1)
248
+ timeout (0.3.0)
249
+ tzinfo (2.0.5)
232
250
  concurrent-ruby (~> 1.0)
233
- unicode-display_width (2.0.0)
234
- websocket-driver (0.7.3)
251
+ unicode-display_width (2.2.0)
252
+ unparser (0.6.5)
253
+ diff-lcs (~> 1.3)
254
+ parser (>= 3.1.0)
255
+ webrick (1.7.0)
256
+ websocket-driver (0.7.5)
235
257
  websocket-extensions (>= 0.1.0)
236
258
  websocket-extensions (0.1.5)
237
- zeitwerk (2.4.2)
259
+ yard (0.9.28)
260
+ webrick (~> 1.7.0)
261
+ yard-sorbet (0.6.1)
262
+ sorbet-runtime (>= 0.5)
263
+ yard (>= 0.9)
264
+ zeitwerk (2.6.0)
238
265
 
239
266
  PLATFORMS
240
267
  ruby
@@ -248,16 +275,16 @@ DEPENDENCIES
248
275
  minitest-focus
249
276
  mocha
250
277
  packwerk!
251
- psych (~> 3)
252
- rails!
278
+ rails
253
279
  rake
254
280
  rubocop-performance
255
281
  rubocop-shopify
256
282
  rubocop-sorbet
257
- sorbet
258
- sorbet-runtime
283
+ ruby-lsp (~> 0.2.1)
284
+ sorbet-static-and-runtime
259
285
  spring
260
286
  tapioca
287
+ zeitwerk
261
288
 
262
289
  BUNDLED WITH
263
- 2.3.4
290
+ 2.3.5
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Packwerk [![Build Status](https://github.com/Shopify/packwerk/workflows/CI/badge.svg)](https://github.com/Shopify/packwerk/actions?query=workflow%3ACI)
2
2
 
3
- ## NOTE: Packwerk is considered to be feature-complete for Shopify's uses. We are currently accepting bug fixes only, and it is not being actively developed. Please fork this project if you are interested in adding new features.
3
+ ### ⚠️ While Shopify is actively using `packwerk`, we consider it feature complete.
4
+ We are keeping `packwerk` compatible with current versions of Ruby and Rails, but will accept feature requests only in rare cases. Please submit bug fixes though!
5
+
6
+ ---
4
7
 
5
8
  > "I know who you are and because of that I know what you do."
6
9
  > This knowledge is a dependency that raises the cost of change.
@@ -58,10 +61,12 @@ Read [USAGE.md](USAGE.md) for usage once Packwerk is installed on your project.
58
61
 
59
62
  ## Ecosystem
60
63
 
61
- You can use these third party tools to enhance your packwerk experience:
64
+ Various third parties have built tooling on top of packwerk. Here's a selection of some that might prove useful:
62
65
 
63
66
  - https://github.com/bellroy/graphwerk draws a graph of your package dependencies
64
67
  - https://github.com/Gusto/packwerk-vscode integrates packwerk into Visual Studio Code so you can see violations right in your editor
68
+ - https://github.com/Gusto/stimpack sets up Rails autoloading, as well as `rspec` and `FactoryBot` integration, for packages arranged in a flat list. Stimpack is quite convenient, but for autoloading we recommend to use `Rails::Engine`s instead.
69
+ - https://github.com/rubyatscale/danger-packwerk integrates packwerk with [danger.systems](https://danger.systems) to provide packwerk feedback as Github inline PR comments
65
70
 
66
71
  ## Development
67
72
 
@@ -0,0 +1,81 @@
1
+ # Resolving Violations
2
+
3
+ Violations can be [recorded as a deprecation](#recording-violations) or (better!) [eliminated](#eliminating-violations).
4
+
5
+ ## Recording Violations
6
+ 💡 New privacy and dependency violations are never hard-blocked. There are many very valid reasons to run `bin/packwerk update-deprecations`, adding new violations to `deprecated_references.yml` files. Even if you feel your reason might not be "valid," if your judgement says adding the violation and shipping your change will produce positive impact, trust your gut.
7
+
8
+ ### Emergency Fixes
9
+ ❔ Is it a revert or is there a lot of urgency because you are fixing a production bug impacting customers?
10
+
11
+ ➡️ Simply run `bin/packwerk update-deprecations`, and address the violation when the customer issue is resolved.
12
+
13
+ ### Improving System Design
14
+ ❔ Are you improving system boundaries by renaming or moving a file, class, constant,` or module?
15
+
16
+ ➡️ Simply run `bin/packwerk update-deprecations`. We've improved how our system is organized, so the new violations are natural.
17
+
18
+ ### Making Things Explicit
19
+ ❔ Are you making something that was implicit (hidden to Packwerk) explicit, such as adding a Sorbet signature, using a class instead of a method call, or something similar?
20
+
21
+ ➡️ Simply run `bin/packwerk update-deprecations`. Making something implicit explicit and capturing that as a new violation is a strict improvement.
22
+
23
+ ### Temporary State
24
+ ❔ Is the violation temporary because you will soon delete the code or is it part of a refactor to improve system boundaries and reduce violations overall?
25
+
26
+ ➡️ Simply run `bin/packwerk update-deprecations`. Sometimes things get "worse" before they get better.
27
+
28
+ ### Delivering Features
29
+ ❔ Are you in a rush to get a feature out and product, your manager, or an internal sense of urgency has made you feel like you can't resolve system design issues?
30
+
31
+ ➡️ Stay strong. Eliminate the violation. It is important to build a sustainable business that optimizes for the long-term. Look for advocates such as from mentors or within your team who can help you justify improving system design.
32
+
33
+ ## Eliminating Violations
34
+ 💡 Dependency and privacy violations are Packwerk's signal that what we've stated about the desired system design (what
35
+ packages exist and what lives in them, the dependencies in a package.yml, and the public interface in the package's public folder) doesn't match the reality of our system.
36
+ If what we've stated about our system design doesn't feel right, then the violations won't make sense either! Make sure to think through system design before addressing a violation.
37
+
38
+ ### Moving Things Around
39
+ ❔ Does the code you're writing (or changing) live in the right package? Does the code you're referencing live in the right package?
40
+
41
+ If not, find a better place for it to live.
42
+
43
+ Otherwise, follow the guide for eliminating [Privacy Violations](#privacy-violations) or [Dependency Violations](#dependency-violations).
44
+
45
+ ### Privacy Violations
46
+ 💡 Packwerk thinks something is a privacy violation if you're referencing a constant, class, or module defined in the private implementation (i.e. not the public folder) of another package. We care about these because we want to make sure we only use parts of a package that have been exposed as public API.
47
+
48
+ An explicit and implementation-hiding public API is a cornerstone of well-modularized code.
49
+
50
+ #### Use Existing Public Interface
51
+ ❔ Does the package you're using expose public API in its public folder that supports your use case?
52
+
53
+ ➡️ Use that public API instead!
54
+
55
+ #### Change The Public Interface
56
+ ❔ Can we work with the package's owner to create and use a public API? Or should the thing we're using already be public?
57
+
58
+ ➡️ Work together on a new public API and use that instead! If the thing we're using should be public, move it to the public folder to make it public!
59
+
60
+ ⛈️ If working with the package's owner to improve the API is not possible, run `bin/packwerk update-deprecations`. Add some context to your PR about why it's not possible.
61
+
62
+ ### Dependency Violations
63
+ 💡 Packwerk thinks something is a dependency violation if you're referencing a constant, class, module defined ANYWHERE but your package doesn't list it as an explicit dependency in its `package.yml`. We care about these because it allows us to be systematically intentional about what our code needs to run and helps us untangle and remove dependency cycles from our system.
64
+
65
+ Thoughtful dependency management is another cornerstone of well-modularized code.
66
+
67
+ #### Adding Explicit Dependencies
68
+ ❔ Do we actually want to depend on the other package? Work with your team to help answer this question!
69
+
70
+ ➡️ Add the other package to your package's `package.yml` `dependencies` key.
71
+
72
+ ⁉️ Did you get a cyclic dependency when CI ran `bin/packwerk validate`?
73
+
74
+ ➡️ Work with your team to think through what link in the cycle we don't want. Remove that link and rerun `bin/packwerk validate`.
75
+
76
+ #### Changing The System Design
77
+ ❔ Can we spend some time to think through changes to the system design that don't require the dependency?
78
+
79
+ ➡️ Work with the owners of the relevant packages, as well as your team, to think through a design that doesn't include the unwanted dependency.
80
+
81
+ ⛈️ If this is not possible within the scope of your changes (think hard about this one!), run `bin/packwerk update-deprecations`. Add some context to your PR about why it's not possible, and any additional context you may have, such as a possible solution.
data/Rakefile CHANGED
@@ -7,7 +7,7 @@ Rake::TestTask.new(:test) do |t|
7
7
  t.libs << "test"
8
8
  t.libs << "lib"
9
9
  t.test_files = FileList["test/**/*_test.rb"]
10
- t.warning = true
10
+ t.warning = false
11
11
  end
12
12
 
13
13
  task(default: :test)
data/USAGE.md CHANGED
@@ -17,6 +17,8 @@
17
17
  * [Using public folders](#using-public-folders)
18
18
  * [Enforcing dependency boundary](#enforcing-dependency-boundary)
19
19
  * [Checking for violations](#checking-for-violations)
20
+ * [Resolving new violations](#resolving-new-violations)
21
+ * [Understanding how to respond to new violations](#understanding-how-to-respond-to-new-violations)
20
22
  * [Recording existing violations](#recording-existing-violations)
21
23
  * [Understanding the list of deprecated references](#understanding-the-list-of-deprecated-references)
22
24
 
@@ -54,7 +56,7 @@ Here is a list of files generated:
54
56
 
55
57
  | File | Location | Description |
56
58
  |-----------------------------|--------------|------------|
57
- | Packwerk configuration | packwerk.yml | See [Setting up the configuration file](#Setting-up-the-configuration-file) |
59
+ | Packwerk configuration | packwerk.yml | See [Setting up the configuration file](#configuring-packwerk) |
58
60
  | Root package | package.yml | A package for the root folder |
59
61
 
60
62
  After that, you may begin creating packages for your application. See [Defining packages](#Defining-packages)
@@ -115,7 +117,7 @@ We recommend setting up the package system validation for your Rails application
115
117
 
116
118
  Use the following command to validate the application:
117
119
 
118
- packwerk validate
120
+ bin/packwerk validate
119
121
 
120
122
  ![](static/packwerk_validate.gif)
121
123
 
@@ -204,17 +206,17 @@ It will be a dependency violation when `components/shop_identity` tries to refer
204
206
 
205
207
  After enforcing the boundary checks for a package, you may execute:
206
208
 
207
- packwerk check
209
+ bin/packwerk check
208
210
 
209
211
  Packwerk will check the entire codebase for any new or stale violations.
210
212
 
211
213
  You can also specify folders for a shorter run time. When checking against folders all subfolders will be analyzed, irrespective of nested package boundaries.
212
214
 
213
- packwerk check components/your_package
215
+ bin/packwerk check components/your_package
214
216
 
215
217
  You can also specify packages for a shorter run time. When checking against packages any packages nested underneath the specified packages will not be checked. This can be helpful to test packages like the root package, which can have many nested packages.
216
218
 
217
- packwerk check --packages=components/your_package,components/your_other_package
219
+ bin/packwerk check --packages=components/your_package,components/your_other_package
218
220
 
219
221
  ![](static/packwerk_check.gif)
220
222
 
@@ -222,6 +224,13 @@ In order to keep the package system valid at each version of the application, we
222
224
 
223
225
  See: [TROUBLESHOOT.md - Sample violations](TROUBLESHOOT.md#Sample-violations)
224
226
 
227
+ ## Resolving new violations
228
+ ### Understanding how to respond to new violations
229
+
230
+ When you have a new dependency or privacy violation, what do you do?
231
+
232
+ See: [RESOLVING_VIOLATIONS.md](RESOLVING_VIOLATIONS.md)
233
+
225
234
  ## Recording existing violations
226
235
 
227
236
  For existing codebases, packages are likely to have existing boundary violations.
data/bin/m CHANGED
@@ -15,7 +15,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
15
15
  bundle_binstub = File.expand_path("../bundle", __FILE__)
16
16
 
17
17
  if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
19
  load(bundle_binstub)
20
20
  else
21
21
  abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
data/bin/rake CHANGED
@@ -15,7 +15,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
15
15
  bundle_binstub = File.expand_path("../bundle", __FILE__)
16
16
 
17
17
  if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
19
  load(bundle_binstub)
20
20
  else
21
21
  abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
data/bin/rubocop CHANGED
@@ -15,7 +15,7 @@ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
15
15
  bundle_binstub = File.expand_path("../bundle", __FILE__)
16
16
 
17
17
  if File.file?(bundle_binstub)
18
- if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
18
+ if /This file was generated by Bundler/.match?(File.read(bundle_binstub, 300))
19
19
  load(bundle_binstub)
20
20
  else
21
21
  abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.