packwerk 3.0.0 → 3.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -2
  3. data/exe/packwerk +4 -1
  4. data/lib/packwerk/application_validator.rb +3 -0
  5. data/lib/packwerk/association_inspector.rb +17 -4
  6. data/lib/packwerk/checker.rb +16 -7
  7. data/lib/packwerk/cli.rb +14 -177
  8. data/lib/packwerk/commands/base_command.rb +69 -0
  9. data/lib/packwerk/commands/check_command.rb +62 -0
  10. data/lib/packwerk/commands/help_command.rb +33 -0
  11. data/lib/packwerk/commands/init_command.rb +42 -0
  12. data/lib/packwerk/commands/lazy_loaded_entry.rb +37 -0
  13. data/lib/packwerk/commands/update_todo_command.rb +60 -0
  14. data/lib/packwerk/commands/uses_parse_run.rb +92 -0
  15. data/lib/packwerk/commands/validate_command.rb +46 -0
  16. data/lib/packwerk/commands/version_command.rb +18 -0
  17. data/lib/packwerk/commands.rb +54 -0
  18. data/lib/packwerk/configuration.rb +8 -1
  19. data/lib/packwerk/const_node_inspector.rb +2 -2
  20. data/lib/packwerk/constant_name_inspector.rb +2 -2
  21. data/lib/packwerk/file_processor.rb +12 -1
  22. data/lib/packwerk/formatters/default_offenses_formatter.rb +3 -3
  23. data/lib/packwerk/formatters/progress_formatter.rb +11 -0
  24. data/lib/packwerk/generators/templates/package.yml +2 -2
  25. data/lib/packwerk/generators/templates/packwerk.yml.erb +1 -1
  26. data/lib/packwerk/offense_collection.rb +32 -12
  27. data/lib/packwerk/offenses_formatter.rb +14 -5
  28. data/lib/packwerk/package.rb +1 -1
  29. data/lib/packwerk/package_todo.rb +86 -69
  30. data/lib/packwerk/parse_run.rb +42 -82
  31. data/lib/packwerk/parsers/factory.rb +3 -3
  32. data/lib/packwerk/parsers/ruby.rb +9 -2
  33. data/lib/packwerk/reference_checking/checkers/dependency_checker.rb +3 -3
  34. data/lib/packwerk/reference_extractor.rb +29 -1
  35. data/lib/packwerk/reference_offense.rb +1 -1
  36. data/lib/packwerk/run_context.rb +15 -4
  37. data/lib/packwerk/spring_command.rb +0 -2
  38. data/lib/packwerk/validator.rb +19 -5
  39. data/lib/packwerk/version.rb +1 -1
  40. data/lib/packwerk.rb +5 -28
  41. data/sorbet/config +1 -0
  42. data/sorbet/rbi/gems/actionpack@7.0.3.1.rbi +3280 -3450
  43. data/sorbet/rbi/gems/actionview@7.0.3.1.rbi +2322 -1782
  44. data/sorbet/rbi/gems/activesupport@7.0.3.1.rbi +2654 -3268
  45. data/sorbet/rbi/gems/ast@2.4.2.rbi +535 -6
  46. data/sorbet/rbi/gems/better_html@2.0.1.rbi +529 -0
  47. data/sorbet/rbi/gems/builder@3.2.4.rbi +4 -4
  48. data/sorbet/rbi/gems/byebug@11.1.3.rbi +32 -4
  49. data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +1750 -1840
  50. data/sorbet/rbi/gems/constant_resolver@0.2.0.rbi +15 -15
  51. data/sorbet/rbi/gems/crass@1.0.6.rbi +489 -5
  52. data/sorbet/rbi/gems/erubi@1.11.0.rbi +24 -21
  53. data/sorbet/rbi/gems/i18n@1.12.0.rbi +395 -395
  54. data/sorbet/rbi/gems/json@2.6.2.rbi +70 -77
  55. data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +1 -1
  56. data/sorbet/rbi/gems/loofah@2.18.0.rbi +134 -134
  57. data/sorbet/rbi/gems/m@1.6.0.rbi +60 -60
  58. data/sorbet/rbi/gems/method_source@1.1.0.rbi +303 -0
  59. data/sorbet/rbi/gems/minitest-focus@1.3.1.rbi +22 -28
  60. data/sorbet/rbi/gems/minitest@5.16.2.rbi +384 -396
  61. data/sorbet/rbi/gems/mocha@1.14.0.rbi +589 -589
  62. data/sorbet/rbi/gems/netrc@0.11.0.rbi +37 -32
  63. data/sorbet/rbi/gems/{nokogiri@1.13.8.rbi → nokogiri@1.15.3.rbi} +1869 -1030
  64. data/sorbet/rbi/gems/{parallel@1.22.1.rbi → parallel@1.24.0.rbi} +85 -82
  65. data/sorbet/rbi/gems/parser@3.3.1.0.rbi +7320 -0
  66. data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +1 -1
  67. data/sorbet/rbi/gems/prism@0.27.0.rbi +36983 -0
  68. data/sorbet/rbi/gems/{racc@1.6.0.rbi → racc@1.7.1.rbi} +42 -33
  69. data/sorbet/rbi/gems/rack-test@2.0.2.rbi +148 -338
  70. data/sorbet/rbi/gems/rack@2.2.4.rbi +1079 -1130
  71. data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +354 -22
  72. data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +113 -259
  73. data/sorbet/rbi/gems/railties@7.0.3.1.rbi +642 -638
  74. data/sorbet/rbi/gems/rainbow@3.1.1.rbi +109 -99
  75. data/sorbet/rbi/gems/rake@13.0.6.rbi +714 -599
  76. data/sorbet/rbi/gems/{rbi@0.0.15.rbi → rbi@0.1.12.rbi} +865 -801
  77. data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +853 -870
  78. data/sorbet/rbi/gems/rexml@3.2.5.rbi +480 -477
  79. data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +1621 -1622
  80. data/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi +507 -526
  81. data/sorbet/rbi/gems/rubocop-shopify@2.9.0.rbi +1 -1
  82. data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +186 -203
  83. data/sorbet/rbi/gems/rubocop@1.34.1.rbi +8126 -8367
  84. data/sorbet/rbi/gems/{ruby-lsp@0.2.1.rbi → ruby-lsp@0.2.3.rbi} +2 -2
  85. data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +1235 -4
  86. data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +90 -90
  87. data/sorbet/rbi/gems/spoom@1.3.2.rbi +4420 -0
  88. data/sorbet/rbi/gems/spring@4.0.0.rbi +104 -104
  89. data/sorbet/rbi/gems/syntax_tree@3.3.0.rbi +1 -1
  90. data/sorbet/rbi/gems/{tapioca@0.9.2.rbi → tapioca@0.13.3.rbi} +1596 -1253
  91. data/sorbet/rbi/gems/{thor@1.2.1.rbi → thor@1.3.1.rbi} +1047 -652
  92. data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +531 -513
  93. data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +13 -13
  94. data/sorbet/rbi/gems/{yard-sorbet@0.6.1.rbi → yard-sorbet@0.8.1.rbi} +132 -92
  95. data/sorbet/rbi/gems/{yard@0.9.28.rbi → yard@0.9.36.rbi} +3158 -3067
  96. data/sorbet/rbi/gems/zeitwerk@2.6.4.rbi +149 -145
  97. metadata +36 -84
  98. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -27
  99. data/.github/pull_request_template.md +0 -28
  100. data/.github/workflows/ci.yml +0 -65
  101. data/.github/workflows/cla.yml +0 -22
  102. data/.gitignore +0 -13
  103. data/.rubocop.yml +0 -75
  104. data/.ruby-version +0 -1
  105. data/CODEOWNERS +0 -1
  106. data/CODE_OF_CONDUCT.md +0 -76
  107. data/CONTRIBUTING.md +0 -17
  108. data/Gemfile +0 -27
  109. data/Gemfile.lock +0 -201
  110. data/RESOLVING_VIOLATIONS.md +0 -81
  111. data/Rakefile +0 -13
  112. data/TROUBLESHOOT.md +0 -45
  113. data/UPGRADING.md +0 -54
  114. data/USAGE.md +0 -367
  115. data/bin/console +0 -15
  116. data/bin/m +0 -29
  117. data/bin/rake +0 -29
  118. data/bin/rubocop +0 -29
  119. data/bin/setup +0 -8
  120. data/bin/srb +0 -29
  121. data/bin/tapioca +0 -29
  122. data/dev.yml +0 -32
  123. data/docs/cohesion.png +0 -0
  124. data/gemfiles/Gemfile-rails-6-0 +0 -22
  125. data/gemfiles/Gemfile-rails-6-1 +0 -22
  126. data/lib/packwerk/cli/result.rb +0 -11
  127. data/packwerk.gemspec +0 -58
  128. data/shipit.rubygems.yml +0 -5
  129. data/sorbet/rbi/gems/actioncable@7.0.3.1.rbi +0 -2754
  130. data/sorbet/rbi/gems/actionmailbox@7.0.3.1.rbi +0 -1496
  131. data/sorbet/rbi/gems/actionmailer@7.0.3.1.rbi +0 -2362
  132. data/sorbet/rbi/gems/actiontext@7.0.3.1.rbi +0 -1569
  133. data/sorbet/rbi/gems/activejob@7.0.3.1.rbi +0 -2553
  134. data/sorbet/rbi/gems/activemodel@7.0.3.1.rbi +0 -5999
  135. data/sorbet/rbi/gems/activerecord@7.0.3.1.rbi +0 -37832
  136. data/sorbet/rbi/gems/activestorage@7.0.3.1.rbi +0 -2321
  137. data/sorbet/rbi/gems/better_html@1.0.16.rbi +0 -317
  138. data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -8
  139. data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -1079
  140. data/sorbet/rbi/gems/digest@3.1.0.rbi +0 -189
  141. data/sorbet/rbi/gems/globalid@1.0.0.rbi +0 -572
  142. data/sorbet/rbi/gems/mail@2.7.1.rbi +0 -2490
  143. data/sorbet/rbi/gems/marcel@1.0.2.rbi +0 -220
  144. data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -76
  145. data/sorbet/rbi/gems/mini_mime@1.1.2.rbi +0 -170
  146. data/sorbet/rbi/gems/net-imap@0.2.3.rbi +0 -2147
  147. data/sorbet/rbi/gems/net-pop@0.1.1.rbi +0 -926
  148. data/sorbet/rbi/gems/net-protocol@0.1.3.rbi +0 -11
  149. data/sorbet/rbi/gems/net-smtp@0.3.1.rbi +0 -1108
  150. data/sorbet/rbi/gems/nio4r@2.5.8.rbi +0 -292
  151. data/sorbet/rbi/gems/parser@3.1.2.1.rbi +0 -9029
  152. data/sorbet/rbi/gems/pry@0.14.1.rbi +0 -8
  153. data/sorbet/rbi/gems/rails@7.0.3.1.rbi +0 -8
  154. data/sorbet/rbi/gems/spoom@1.1.11.rbi +0 -2181
  155. data/sorbet/rbi/gems/strscan@3.0.4.rbi +0 -8
  156. data/sorbet/rbi/gems/timeout@0.3.0.rbi +0 -142
  157. data/sorbet/rbi/gems/unparser@0.6.5.rbi +0 -4529
  158. data/sorbet/rbi/gems/webrick@1.7.0.rbi +0 -2582
  159. data/sorbet/rbi/gems/websocket-driver@0.7.5.rbi +0 -993
  160. data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +0 -71
data/Gemfile.lock DELETED
@@ -1,201 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- packwerk (3.0.0)
5
- activesupport (>= 6.0)
6
- ast
7
- better_html
8
- bundler
9
- constant_resolver (>= 0.2.0)
10
- parallel
11
- parser
12
- sorbet-runtime (>= 0.5.9914)
13
- zeitwerk (>= 2.6.1)
14
-
15
- GEM
16
- remote: https://rubygems.org/
17
- specs:
18
- actionpack (7.0.3.1)
19
- actionview (= 7.0.3.1)
20
- activesupport (= 7.0.3.1)
21
- rack (~> 2.0, >= 2.2.0)
22
- rack-test (>= 0.6.3)
23
- rails-dom-testing (~> 2.0)
24
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
25
- actionview (7.0.3.1)
26
- activesupport (= 7.0.3.1)
27
- builder (~> 3.1)
28
- erubi (~> 1.4)
29
- rails-dom-testing (~> 2.0)
30
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
31
- activesupport (7.0.3.1)
32
- concurrent-ruby (~> 1.0, >= 1.0.2)
33
- i18n (>= 1.6, < 2)
34
- minitest (>= 5.1)
35
- tzinfo (~> 2.0)
36
- ast (2.4.2)
37
- better_html (2.0.1)
38
- actionview (>= 6.0)
39
- activesupport (>= 6.0)
40
- ast (~> 2.0)
41
- erubi (~> 1.4)
42
- parser (>= 2.4)
43
- smart_properties
44
- builder (3.2.4)
45
- byebug (11.1.3)
46
- coderay (1.1.3)
47
- concurrent-ruby (1.1.10)
48
- constant_resolver (0.2.0)
49
- crass (1.0.6)
50
- diff-lcs (1.5.0)
51
- erubi (1.11.0)
52
- i18n (1.12.0)
53
- concurrent-ruby (~> 1.0)
54
- json (2.6.2)
55
- language_server-protocol (3.16.0.3)
56
- loofah (2.18.0)
57
- crass (~> 1.0.2)
58
- nokogiri (>= 1.5.9)
59
- m (1.6.0)
60
- method_source (>= 0.6.7)
61
- rake (>= 0.9.2.2)
62
- method_source (1.0.0)
63
- mini_portile2 (2.8.0)
64
- minitest (5.16.2)
65
- minitest-focus (1.3.1)
66
- minitest (>= 4, < 6)
67
- mocha (1.14.0)
68
- netrc (0.11.0)
69
- nokogiri (1.13.8)
70
- mini_portile2 (~> 2.8.0)
71
- racc (~> 1.4)
72
- parallel (1.22.1)
73
- parser (3.1.2.1)
74
- ast (~> 2.4.1)
75
- prettier_print (0.1.0)
76
- pry (0.14.1)
77
- coderay (~> 1.1)
78
- method_source (~> 1.0)
79
- racc (1.6.0)
80
- rack (2.2.4)
81
- rack-test (2.0.2)
82
- rack (>= 1.3)
83
- rails-dom-testing (2.0.3)
84
- activesupport (>= 4.2.0)
85
- nokogiri (>= 1.6)
86
- rails-html-sanitizer (1.4.3)
87
- loofah (~> 2.3)
88
- railties (7.0.3.1)
89
- actionpack (= 7.0.3.1)
90
- activesupport (= 7.0.3.1)
91
- method_source
92
- rake (>= 12.2)
93
- thor (~> 1.0)
94
- zeitwerk (~> 2.5)
95
- rainbow (3.1.1)
96
- rake (13.0.6)
97
- rbi (0.0.15)
98
- ast
99
- parser (>= 2.6.4.0)
100
- sorbet-runtime (>= 0.5.9204)
101
- unparser
102
- regexp_parser (2.5.0)
103
- rexml (3.2.5)
104
- rubocop (1.34.1)
105
- json (~> 2.3)
106
- parallel (~> 1.10)
107
- parser (>= 3.1.2.1)
108
- rainbow (>= 2.2.2, < 4.0)
109
- regexp_parser (>= 1.8, < 3.0)
110
- rexml (>= 3.2.5, < 4.0)
111
- rubocop-ast (>= 1.20.0, < 2.0)
112
- ruby-progressbar (~> 1.7)
113
- unicode-display_width (>= 1.4.0, < 3.0)
114
- rubocop-ast (1.21.0)
115
- parser (>= 3.1.1.0)
116
- rubocop-performance (1.14.3)
117
- rubocop (>= 1.7.0, < 2.0)
118
- rubocop-ast (>= 0.4.0)
119
- rubocop-shopify (2.9.0)
120
- rubocop (~> 1.33)
121
- rubocop-sorbet (0.6.11)
122
- rubocop (>= 0.90.0)
123
- ruby-lsp (0.2.3)
124
- language_server-protocol
125
- sorbet-runtime
126
- syntax_tree (>= 2.4)
127
- ruby-progressbar (1.11.0)
128
- smart_properties (1.17.0)
129
- sorbet (0.5.10313)
130
- sorbet-static (= 0.5.10313)
131
- sorbet-runtime (0.5.10313)
132
- sorbet-static (0.5.10313-universal-darwin-14)
133
- sorbet-static (0.5.10313-universal-darwin-15)
134
- sorbet-static (0.5.10313-universal-darwin-16)
135
- sorbet-static (0.5.10313-universal-darwin-17)
136
- sorbet-static (0.5.10313-universal-darwin-18)
137
- sorbet-static (0.5.10313-universal-darwin-19)
138
- sorbet-static (0.5.10313-universal-darwin-20)
139
- sorbet-static (0.5.10313-universal-darwin-21)
140
- sorbet-static (0.5.10313-universal-darwin-22)
141
- sorbet-static (0.5.10313-x86_64-linux)
142
- sorbet-static-and-runtime (0.5.10313)
143
- sorbet (= 0.5.10313)
144
- sorbet-runtime (= 0.5.10313)
145
- spoom (1.1.11)
146
- sorbet (>= 0.5.9204)
147
- sorbet-runtime (>= 0.5.9204)
148
- thor (>= 0.19.2)
149
- spring (4.0.0)
150
- syntax_tree (3.3.0)
151
- prettier_print
152
- tapioca (0.9.2)
153
- bundler (>= 1.17.3)
154
- netrc (>= 0.11.0)
155
- parallel (>= 1.21.0)
156
- pry (>= 0.12.2)
157
- rbi (~> 0.0.0, >= 0.0.14)
158
- sorbet-static-and-runtime (>= 0.5.9204)
159
- spoom (~> 1.1.0, >= 1.1.11)
160
- thor (>= 1.2.0)
161
- yard-sorbet
162
- thor (1.2.1)
163
- tzinfo (2.0.5)
164
- concurrent-ruby (~> 1.0)
165
- unicode-display_width (2.2.0)
166
- unparser (0.6.5)
167
- diff-lcs (~> 1.3)
168
- parser (>= 3.1.0)
169
- webrick (1.7.0)
170
- yard (0.9.28)
171
- webrick (~> 1.7.0)
172
- yard-sorbet (0.6.1)
173
- sorbet-runtime (>= 0.5)
174
- yard (>= 0.9)
175
- zeitwerk (2.6.4)
176
-
177
- PLATFORMS
178
- ruby
179
- x86_64-darwin
180
- x86_64-darwin-20
181
-
182
- DEPENDENCIES
183
- byebug
184
- constant_resolver
185
- m
186
- minitest-focus
187
- mocha
188
- packwerk!
189
- railties
190
- rake
191
- rubocop-performance
192
- rubocop-shopify
193
- rubocop-sorbet
194
- ruby-lsp (~> 0.2.1)
195
- sorbet-static-and-runtime
196
- spring
197
- tapioca
198
- zeitwerk
199
-
200
- BUNDLED WITH
201
- 2.4.7
@@ -1,81 +0,0 @@
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-todo`, adding new violations to `package_todo.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-todo`, 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-todo`. 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-todo`. 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-todo`. 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-todo`. 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-todo`. 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 DELETED
@@ -1,13 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rake/testtask"
5
-
6
- Rake::TestTask.new(:test) do |t|
7
- t.libs << "test"
8
- t.libs << "lib"
9
- t.test_files = FileList["test/**/*_test.rb"]
10
- t.warning = false
11
- end
12
-
13
- task(default: :test)
data/TROUBLESHOOT.md DELETED
@@ -1,45 +0,0 @@
1
- # Troubleshoot
2
-
3
- * [Troubleshooting violations](#Troubleshooting-violations)
4
- * [Feedback loop](#Feedback-loop)
5
- * [Package Dependency violation](#Package-Dependency-violation)
6
- * [Interpreting Dependency violation](#Interpreting-Dependency-violation)
7
-
8
- ## Troubleshooting violations
9
-
10
- ### Feedback loop
11
- Packwerk can give feedback via continuous integration (CI) if you have it set up, but that is a long feedback cycle. If you want faster feedback, use Packwerk on the command line locally.
12
-
13
- You can specify folders or packages in Packwerk commands for a shorter run time:
14
-
15
- bin/packwerk check components/your_package
16
-
17
- bin/packwerk update-todo components/your_package
18
-
19
- _Note: You cannot specify folders or packages for `bin/packwerk validate` because the command runs for the entire application._
20
-
21
- ![](static/packwerk_check_violation.gif)
22
-
23
- ### Package Dependency violation
24
- A constant defined in a package A is referenced from a package B that doesn’t define a dependency on A. Packages define their dependencies in their `package.yml`.
25
-
26
- See: [USAGE.md - Enforcing dependency boundary](USAGE.md#Enforcing-dependency-boundary)
27
-
28
- #### Interpreting Dependency violation
29
-
30
- > /Users/JaneDoe/src/github.com/sample-project/billing/app/jobs/document_processing_job.rb:48:6
31
- > Dependency violation: ::Edi::Source belongs to 'edi', but 'billing' does not specify a dependency on 'edi'.
32
- > Are we missing an abstraction?
33
- > Is the code making the reference, and the referenced constant, in the right packages?
34
- >
35
- > Inference details: 'Edi::Source' refers to ::Edi::Source which seems to be defined in edi/app/models/edi/source.rb.
36
-
37
- There has been a dependency violation in the package `billing` to the package `edi`, through the use of the constant `Edi::Source` in the file `billing/app/jobs/document_processing_job.rb`.
38
-
39
- ##### Suggestions
40
- If a package declares dependencies, assume that some thought went into that. It is unlikely that the correct fix is to add another dependency.
41
- Check if the code containing the reference and the code defining the constants are in the right packages. If not, fix that by moving code around.
42
-
43
- If a dependency A -> B is not desired, but a dependency B -> A is OK, consider using [dependency inversion](https://www.sandimetz.com/blog/2009/03/21/solid-design-principles).
44
-
45
- If you’re getting stuck, find people with context about the two packages involved and ask for their opinion.
data/UPGRADING.md DELETED
@@ -1,54 +0,0 @@
1
- # Upgrading from 1.x to 2.0
2
-
3
- With Packwerk 2.0, we made a few changes to simplify the setup. Updating will require removing some previously necessary files and configuration.
4
-
5
- ## Gem group
6
-
7
- Because packwerk is no longer involved in specifying the application's inflections, it doesn't have to live in the `production` group in your `Gemfile` anymore. We recommend moving it to the `development` group.
8
-
9
- ## Removing application config caches
10
-
11
- ### Load paths
12
- We no longer require the `load_paths` key in `packwerk.yml`. You can simply delete the load_paths key as it will not be read anymore. Instead, Packwerk will ask Rails for load paths. If you're using spring, make sure to properly set up spring (see [USAGE.md](USAGE.md#setting-up-spring)) to keep packwerk fast.
13
-
14
- ### Inflections
15
- We no longer require a custom `inflections.yml` file. Instead, you'll want to revert BACK to using the `inflections.rb` initializer as you would have done prior to adopting packwerk. To do this, you'll want to convert back to using the plain [ActiveSupport Inflections API](https://api.rubyonrails.org/classes/ActiveSupport/Inflector/Inflections.html).
16
-
17
-
18
- Given the following example `inflections.yml`, here is an example `inflections.rb` that would follow. Tip: if you're using git, you can run `git log config/inflections.yml`, find the first commit that introduced `inflections.yml`, find the COMMIT_SHA, and then run `git show COMMIT_SHA` to see what your inflections file looked like before (note that you may have changed `inflections.yml` since then, though).
19
-
20
- `config/inflections.yml`
21
- ```yml
22
- # List your inflections in this file instead of `inflections.rb`
23
- # See steps to set up custom inflections:
24
- # https://github.com/Shopify/packwerk/blob/main/USAGE.md#Inflections
25
-
26
- acronym:
27
- - 'HTML'
28
- - 'API'
29
-
30
- singular:
31
- - ['oxen', 'oxen']
32
-
33
- irregular:
34
- - ['person', 'people']
35
-
36
- uncountable:
37
- - 'fish'
38
- - 'sheep'
39
- ```
40
-
41
- `config/initializers/inflections.rb`
42
- ```ruby
43
- ActiveSupport::Inflector.inflections(:en) do |inflect|
44
- inflect.acronym('HTML')
45
- inflect.acronym('API')
46
-
47
- inflect.singular('oxen', 'oxen')
48
-
49
- inflect.irregular('person', 'people')
50
-
51
- inflect.uncountable('fish')
52
- inflect.uncountable('sheep')
53
- end
54
- ```