packwerk 3.2.0 → 3.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packwerk/association_inspector.rb +17 -4
- data/lib/packwerk/checker.rb +3 -3
- data/lib/packwerk/configuration.rb +4 -0
- data/lib/packwerk/const_node_inspector.rb +2 -2
- data/lib/packwerk/constant_name_inspector.rb +2 -2
- data/lib/packwerk/offenses_formatter.rb +3 -3
- data/lib/packwerk/package.rb +1 -1
- data/lib/packwerk/package_todo.rb +1 -4
- data/lib/packwerk/parsers/factory.rb +3 -3
- data/lib/packwerk/parsers/ruby.rb +7 -0
- data/lib/packwerk/reference_extractor.rb +29 -1
- data/lib/packwerk/reference_offense.rb +1 -1
- data/lib/packwerk/run_context.rb +15 -4
- data/lib/packwerk/validator.rb +3 -3
- data/lib/packwerk/version.rb +1 -1
- data/lib/packwerk.rb +1 -0
- data/sorbet/config +1 -0
- data/sorbet/rbi/gems/actionpack@7.0.3.1.rbi +3280 -3450
- data/sorbet/rbi/gems/actionview@7.0.3.1.rbi +2322 -1782
- data/sorbet/rbi/gems/activesupport@7.0.3.1.rbi +2654 -3268
- data/sorbet/rbi/gems/ast@2.4.2.rbi +535 -6
- data/sorbet/rbi/gems/better_html@2.0.1.rbi +529 -0
- data/sorbet/rbi/gems/builder@3.2.4.rbi +4 -4
- data/sorbet/rbi/gems/byebug@11.1.3.rbi +32 -4
- data/sorbet/rbi/gems/concurrent-ruby@1.1.10.rbi +1750 -1840
- data/sorbet/rbi/gems/constant_resolver@0.2.0.rbi +15 -15
- data/sorbet/rbi/gems/crass@1.0.6.rbi +489 -5
- data/sorbet/rbi/gems/erubi@1.11.0.rbi +24 -21
- data/sorbet/rbi/gems/i18n@1.12.0.rbi +395 -395
- data/sorbet/rbi/gems/json@2.6.2.rbi +70 -77
- data/sorbet/rbi/gems/language_server-protocol@3.16.0.3.rbi +1 -1
- data/sorbet/rbi/gems/loofah@2.18.0.rbi +134 -134
- data/sorbet/rbi/gems/m@1.6.0.rbi +60 -60
- data/sorbet/rbi/gems/method_source@1.1.0.rbi +303 -0
- data/sorbet/rbi/gems/minitest-focus@1.3.1.rbi +22 -28
- data/sorbet/rbi/gems/minitest@5.16.2.rbi +384 -396
- data/sorbet/rbi/gems/mocha@1.14.0.rbi +589 -589
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +37 -32
- data/sorbet/rbi/gems/nokogiri@1.15.3.rbi +962 -946
- data/sorbet/rbi/gems/{parallel@1.22.1.rbi → parallel@1.24.0.rbi} +85 -82
- data/sorbet/rbi/gems/{parser@3.2.2.0.rbi → parser@3.3.1.0.rbi} +1679 -1609
- data/sorbet/rbi/gems/prettier_print@0.1.0.rbi +1 -1
- data/sorbet/rbi/gems/{prism@0.24.0.rbi → prism@0.27.0.rbi} +13473 -6472
- data/sorbet/rbi/gems/{racc@1.6.0.rbi → racc@1.7.1.rbi} +42 -33
- data/sorbet/rbi/gems/rack-test@2.0.2.rbi +148 -338
- data/sorbet/rbi/gems/rack@2.2.4.rbi +1079 -1130
- data/sorbet/rbi/gems/rails-dom-testing@2.0.3.rbi +354 -22
- data/sorbet/rbi/gems/rails-html-sanitizer@1.4.3.rbi +113 -259
- data/sorbet/rbi/gems/railties@7.0.3.1.rbi +642 -638
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +109 -99
- data/sorbet/rbi/gems/rake@13.0.6.rbi +714 -599
- data/sorbet/rbi/gems/{rbi@0.0.15.rbi → rbi@0.1.12.rbi} +865 -801
- data/sorbet/rbi/gems/regexp_parser@2.5.0.rbi +853 -870
- data/sorbet/rbi/gems/rexml@3.2.5.rbi +480 -477
- data/sorbet/rbi/gems/rubocop-ast@1.21.0.rbi +1621 -1622
- data/sorbet/rbi/gems/rubocop-performance@1.14.3.rbi +507 -526
- data/sorbet/rbi/gems/rubocop-shopify@2.9.0.rbi +1 -1
- data/sorbet/rbi/gems/rubocop-sorbet@0.6.11.rbi +186 -203
- data/sorbet/rbi/gems/rubocop@1.34.1.rbi +8126 -8367
- data/sorbet/rbi/gems/{ruby-lsp@0.2.1.rbi → ruby-lsp@0.2.3.rbi} +2 -2
- data/sorbet/rbi/gems/ruby-progressbar@1.11.0.rbi +1235 -4
- data/sorbet/rbi/gems/smart_properties@1.17.0.rbi +90 -90
- data/sorbet/rbi/gems/spoom@1.3.2.rbi +4420 -0
- data/sorbet/rbi/gems/spring@4.0.0.rbi +104 -104
- data/sorbet/rbi/gems/syntax_tree@3.3.0.rbi +1 -1
- data/sorbet/rbi/gems/{tapioca@0.9.2.rbi → tapioca@0.13.3.rbi} +1596 -1253
- data/sorbet/rbi/gems/{thor@1.2.1.rbi → thor@1.3.1.rbi} +1047 -652
- data/sorbet/rbi/gems/tzinfo@2.0.5.rbi +531 -513
- data/sorbet/rbi/gems/unicode-display_width@2.2.0.rbi +13 -13
- data/sorbet/rbi/gems/{yard-sorbet@0.6.1.rbi → yard-sorbet@0.8.1.rbi} +132 -92
- data/sorbet/rbi/gems/{yard@0.9.28.rbi → yard@0.9.36.rbi} +3158 -3067
- data/sorbet/rbi/gems/zeitwerk@2.6.4.rbi +149 -145
- metadata +22 -94
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -27
- data/.github/pull_request_template.md +0 -28
- data/.github/workflows/ci.yml +0 -93
- data/.github/workflows/cla.yml +0 -22
- data/.gitignore +0 -13
- data/.rubocop.yml +0 -75
- data/.ruby-version +0 -1
- data/CODEOWNERS +0 -1
- data/CODE_OF_CONDUCT.md +0 -76
- data/CONTRIBUTING.md +0 -17
- data/Gemfile +0 -27
- data/Gemfile.lock +0 -206
- data/RESOLVING_VIOLATIONS.md +0 -76
- data/Rakefile +0 -22
- data/TROUBLESHOOT.md +0 -44
- data/UPGRADING.md +0 -66
- data/USAGE.md +0 -364
- data/bin/console +0 -15
- data/bin/m +0 -29
- data/bin/rake +0 -29
- data/bin/rubocop +0 -29
- data/bin/setup +0 -8
- data/bin/srb +0 -29
- data/bin/tapioca +0 -29
- data/dev.yml +0 -32
- data/docs/cohesion.png +0 -0
- data/gemfiles/Gemfile-rails-6-0 +0 -22
- data/gemfiles/Gemfile-rails-6-1 +0 -22
- data/packwerk.gemspec +0 -59
- data/shipit.rubygems.yml +0 -5
- data/sorbet/rbi/gems/actioncable@7.0.3.1.rbi +0 -2754
- data/sorbet/rbi/gems/actionmailbox@7.0.3.1.rbi +0 -1496
- data/sorbet/rbi/gems/actionmailer@7.0.3.1.rbi +0 -2362
- data/sorbet/rbi/gems/actiontext@7.0.3.1.rbi +0 -1569
- data/sorbet/rbi/gems/activejob@7.0.3.1.rbi +0 -2553
- data/sorbet/rbi/gems/activemodel@7.0.3.1.rbi +0 -5999
- data/sorbet/rbi/gems/activerecord@7.0.3.1.rbi +0 -37832
- data/sorbet/rbi/gems/activestorage@7.0.3.1.rbi +0 -2321
- data/sorbet/rbi/gems/better_html@1.0.16.rbi +0 -317
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +0 -8
- data/sorbet/rbi/gems/diff-lcs@1.5.0.rbi +0 -1079
- data/sorbet/rbi/gems/digest@3.1.0.rbi +0 -189
- data/sorbet/rbi/gems/globalid@1.0.0.rbi +0 -572
- data/sorbet/rbi/gems/mail@2.7.1.rbi +0 -2490
- data/sorbet/rbi/gems/marcel@1.0.2.rbi +0 -220
- data/sorbet/rbi/gems/method_source@1.0.0.rbi +0 -76
- data/sorbet/rbi/gems/mini_mime@1.1.2.rbi +0 -170
- data/sorbet/rbi/gems/net-imap@0.2.3.rbi +0 -2147
- data/sorbet/rbi/gems/net-pop@0.1.1.rbi +0 -926
- data/sorbet/rbi/gems/net-protocol@0.1.3.rbi +0 -11
- data/sorbet/rbi/gems/net-smtp@0.3.1.rbi +0 -1108
- data/sorbet/rbi/gems/nio4r@2.5.8.rbi +0 -292
- data/sorbet/rbi/gems/pry@0.14.1.rbi +0 -8
- data/sorbet/rbi/gems/rails@7.0.3.1.rbi +0 -8
- data/sorbet/rbi/gems/spoom@1.1.11.rbi +0 -2181
- data/sorbet/rbi/gems/strscan@3.0.4.rbi +0 -8
- data/sorbet/rbi/gems/timeout@0.3.0.rbi +0 -142
- data/sorbet/rbi/gems/unparser@0.6.5.rbi +0 -4529
- data/sorbet/rbi/gems/webrick@1.7.0.rbi +0 -2582
- data/sorbet/rbi/gems/websocket-driver@0.7.5.rbi +0 -993
- data/sorbet/rbi/gems/websocket-extensions@0.1.5.rbi +0 -71
data/Gemfile.lock
DELETED
@@ -1,206 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
packwerk (3.2.0)
|
5
|
-
activesupport (>= 6.0)
|
6
|
-
ast
|
7
|
-
better_html
|
8
|
-
bundler
|
9
|
-
constant_resolver (>= 0.2.0)
|
10
|
-
parallel
|
11
|
-
parser
|
12
|
-
prism (>= 0.24.0)
|
13
|
-
sorbet-runtime (>= 0.5.9914)
|
14
|
-
zeitwerk (>= 2.6.1)
|
15
|
-
|
16
|
-
GEM
|
17
|
-
remote: https://rubygems.org/
|
18
|
-
specs:
|
19
|
-
actionpack (7.0.3.1)
|
20
|
-
actionview (= 7.0.3.1)
|
21
|
-
activesupport (= 7.0.3.1)
|
22
|
-
rack (~> 2.0, >= 2.2.0)
|
23
|
-
rack-test (>= 0.6.3)
|
24
|
-
rails-dom-testing (~> 2.0)
|
25
|
-
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
26
|
-
actionview (7.0.3.1)
|
27
|
-
activesupport (= 7.0.3.1)
|
28
|
-
builder (~> 3.1)
|
29
|
-
erubi (~> 1.4)
|
30
|
-
rails-dom-testing (~> 2.0)
|
31
|
-
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
32
|
-
activesupport (7.0.3.1)
|
33
|
-
concurrent-ruby (~> 1.0, >= 1.0.2)
|
34
|
-
i18n (>= 1.6, < 2)
|
35
|
-
minitest (>= 5.1)
|
36
|
-
tzinfo (~> 2.0)
|
37
|
-
ast (2.4.2)
|
38
|
-
better_html (2.0.1)
|
39
|
-
actionview (>= 6.0)
|
40
|
-
activesupport (>= 6.0)
|
41
|
-
ast (~> 2.0)
|
42
|
-
erubi (~> 1.4)
|
43
|
-
parser (>= 2.4)
|
44
|
-
smart_properties
|
45
|
-
builder (3.2.4)
|
46
|
-
byebug (11.1.3)
|
47
|
-
coderay (1.1.3)
|
48
|
-
concurrent-ruby (1.1.10)
|
49
|
-
constant_resolver (0.2.0)
|
50
|
-
crass (1.0.6)
|
51
|
-
diff-lcs (1.5.0)
|
52
|
-
erubi (1.11.0)
|
53
|
-
i18n (1.12.0)
|
54
|
-
concurrent-ruby (~> 1.0)
|
55
|
-
json (2.6.2)
|
56
|
-
language_server-protocol (3.16.0.3)
|
57
|
-
loofah (2.18.0)
|
58
|
-
crass (~> 1.0.2)
|
59
|
-
nokogiri (>= 1.5.9)
|
60
|
-
m (1.6.0)
|
61
|
-
method_source (>= 0.6.7)
|
62
|
-
rake (>= 0.9.2.2)
|
63
|
-
method_source (1.0.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.15.3-arm64-darwin)
|
70
|
-
racc (~> 1.4)
|
71
|
-
nokogiri (1.15.3-x86_64-darwin)
|
72
|
-
racc (~> 1.4)
|
73
|
-
nokogiri (1.15.3-x86_64-linux)
|
74
|
-
racc (~> 1.4)
|
75
|
-
parallel (1.22.1)
|
76
|
-
parser (3.2.2.0)
|
77
|
-
ast (~> 2.4.1)
|
78
|
-
prettier_print (0.1.0)
|
79
|
-
prism (0.24.0)
|
80
|
-
pry (0.14.1)
|
81
|
-
coderay (~> 1.1)
|
82
|
-
method_source (~> 1.0)
|
83
|
-
racc (1.7.1)
|
84
|
-
rack (2.2.4)
|
85
|
-
rack-test (2.0.2)
|
86
|
-
rack (>= 1.3)
|
87
|
-
rails-dom-testing (2.0.3)
|
88
|
-
activesupport (>= 4.2.0)
|
89
|
-
nokogiri (>= 1.6)
|
90
|
-
rails-html-sanitizer (1.4.3)
|
91
|
-
loofah (~> 2.3)
|
92
|
-
railties (7.0.3.1)
|
93
|
-
actionpack (= 7.0.3.1)
|
94
|
-
activesupport (= 7.0.3.1)
|
95
|
-
method_source
|
96
|
-
rake (>= 12.2)
|
97
|
-
thor (~> 1.0)
|
98
|
-
zeitwerk (~> 2.5)
|
99
|
-
rainbow (3.1.1)
|
100
|
-
rake (13.0.6)
|
101
|
-
rbi (0.0.15)
|
102
|
-
ast
|
103
|
-
parser (>= 2.6.4.0)
|
104
|
-
sorbet-runtime (>= 0.5.9204)
|
105
|
-
unparser
|
106
|
-
regexp_parser (2.5.0)
|
107
|
-
rexml (3.2.5)
|
108
|
-
rubocop (1.34.1)
|
109
|
-
json (~> 2.3)
|
110
|
-
parallel (~> 1.10)
|
111
|
-
parser (>= 3.1.2.1)
|
112
|
-
rainbow (>= 2.2.2, < 4.0)
|
113
|
-
regexp_parser (>= 1.8, < 3.0)
|
114
|
-
rexml (>= 3.2.5, < 4.0)
|
115
|
-
rubocop-ast (>= 1.20.0, < 2.0)
|
116
|
-
ruby-progressbar (~> 1.7)
|
117
|
-
unicode-display_width (>= 1.4.0, < 3.0)
|
118
|
-
rubocop-ast (1.21.0)
|
119
|
-
parser (>= 3.1.1.0)
|
120
|
-
rubocop-performance (1.14.3)
|
121
|
-
rubocop (>= 1.7.0, < 2.0)
|
122
|
-
rubocop-ast (>= 0.4.0)
|
123
|
-
rubocop-shopify (2.9.0)
|
124
|
-
rubocop (~> 1.33)
|
125
|
-
rubocop-sorbet (0.6.11)
|
126
|
-
rubocop (>= 0.90.0)
|
127
|
-
ruby-lsp (0.2.3)
|
128
|
-
language_server-protocol
|
129
|
-
sorbet-runtime
|
130
|
-
syntax_tree (>= 2.4)
|
131
|
-
ruby-progressbar (1.11.0)
|
132
|
-
smart_properties (1.17.0)
|
133
|
-
sorbet (0.5.10313)
|
134
|
-
sorbet-static (= 0.5.10313)
|
135
|
-
sorbet-runtime (0.5.10313)
|
136
|
-
sorbet-static (0.5.10313-universal-darwin-14)
|
137
|
-
sorbet-static (0.5.10313-universal-darwin-15)
|
138
|
-
sorbet-static (0.5.10313-universal-darwin-16)
|
139
|
-
sorbet-static (0.5.10313-universal-darwin-17)
|
140
|
-
sorbet-static (0.5.10313-universal-darwin-18)
|
141
|
-
sorbet-static (0.5.10313-universal-darwin-19)
|
142
|
-
sorbet-static (0.5.10313-universal-darwin-20)
|
143
|
-
sorbet-static (0.5.10313-universal-darwin-21)
|
144
|
-
sorbet-static (0.5.10313-universal-darwin-22)
|
145
|
-
sorbet-static (0.5.10313-x86_64-linux)
|
146
|
-
sorbet-static-and-runtime (0.5.10313)
|
147
|
-
sorbet (= 0.5.10313)
|
148
|
-
sorbet-runtime (= 0.5.10313)
|
149
|
-
spoom (1.1.11)
|
150
|
-
sorbet (>= 0.5.9204)
|
151
|
-
sorbet-runtime (>= 0.5.9204)
|
152
|
-
thor (>= 0.19.2)
|
153
|
-
spring (4.0.0)
|
154
|
-
syntax_tree (3.3.0)
|
155
|
-
prettier_print
|
156
|
-
tapioca (0.9.2)
|
157
|
-
bundler (>= 1.17.3)
|
158
|
-
netrc (>= 0.11.0)
|
159
|
-
parallel (>= 1.21.0)
|
160
|
-
pry (>= 0.12.2)
|
161
|
-
rbi (~> 0.0.0, >= 0.0.14)
|
162
|
-
sorbet-static-and-runtime (>= 0.5.9204)
|
163
|
-
spoom (~> 1.1.0, >= 1.1.11)
|
164
|
-
thor (>= 1.2.0)
|
165
|
-
yard-sorbet
|
166
|
-
thor (1.2.1)
|
167
|
-
tzinfo (2.0.5)
|
168
|
-
concurrent-ruby (~> 1.0)
|
169
|
-
unicode-display_width (2.2.0)
|
170
|
-
unparser (0.6.5)
|
171
|
-
diff-lcs (~> 1.3)
|
172
|
-
parser (>= 3.1.0)
|
173
|
-
webrick (1.7.0)
|
174
|
-
yard (0.9.28)
|
175
|
-
webrick (~> 1.7.0)
|
176
|
-
yard-sorbet (0.6.1)
|
177
|
-
sorbet-runtime (>= 0.5)
|
178
|
-
yard (>= 0.9)
|
179
|
-
zeitwerk (2.6.4)
|
180
|
-
|
181
|
-
PLATFORMS
|
182
|
-
arm64-darwin-21
|
183
|
-
x86_64-darwin
|
184
|
-
x86_64-darwin-20
|
185
|
-
x86_64-linux
|
186
|
-
|
187
|
-
DEPENDENCIES
|
188
|
-
byebug
|
189
|
-
constant_resolver
|
190
|
-
m
|
191
|
-
minitest-focus
|
192
|
-
mocha
|
193
|
-
packwerk!
|
194
|
-
railties
|
195
|
-
rake
|
196
|
-
rubocop-performance
|
197
|
-
rubocop-shopify
|
198
|
-
rubocop-sorbet
|
199
|
-
ruby-lsp (~> 0.2.1)
|
200
|
-
sorbet-static-and-runtime
|
201
|
-
spring
|
202
|
-
tapioca
|
203
|
-
zeitwerk
|
204
|
-
|
205
|
-
BUNDLED WITH
|
206
|
-
2.4.8
|
data/RESOLVING_VIOLATIONS.md
DELETED
@@ -1,76 +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 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 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 [Dependency Violations](#dependency-violations).
|
44
|
-
|
45
|
-
#### Use Existing Public Interface
|
46
|
-
❔ Does the package you're using expose public API in its public folder that supports your use case?
|
47
|
-
|
48
|
-
➡️ Use that public API instead!
|
49
|
-
|
50
|
-
#### Change The Public Interface
|
51
|
-
❔ 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?
|
52
|
-
|
53
|
-
➡️ 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!
|
54
|
-
|
55
|
-
⛈️ 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.
|
56
|
-
|
57
|
-
### Dependency Violations
|
58
|
-
💡 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.
|
59
|
-
|
60
|
-
Thoughtful dependency management is another cornerstone of well-modularized code.
|
61
|
-
|
62
|
-
#### Adding Explicit Dependencies
|
63
|
-
❔ Do we actually want to depend on the other package? Work with your team to help answer this question!
|
64
|
-
|
65
|
-
➡️ Add the other package to your package's `package.yml` `dependencies` key.
|
66
|
-
|
67
|
-
⁉️ Did you get a cyclic dependency when CI ran `bin/packwerk validate`?
|
68
|
-
|
69
|
-
➡️ Work with your team to think through what link in the cycle we don't want. Remove that link and rerun `bin/packwerk validate`.
|
70
|
-
|
71
|
-
#### Changing The System Design
|
72
|
-
❔ Can we spend some time to think through changes to the system design that don't require the dependency?
|
73
|
-
|
74
|
-
➡️ 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.
|
75
|
-
|
76
|
-
⛈️ 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,22 +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"].reject do |file|
|
10
|
-
file.include?("test/loading/")
|
11
|
-
end
|
12
|
-
t.warning = false
|
13
|
-
end
|
14
|
-
|
15
|
-
Rake::TestTask.new("test:loading") do |t|
|
16
|
-
t.libs << "test"
|
17
|
-
t.libs << "lib"
|
18
|
-
t.test_files = FileList["test/loading/**/*_test.rb"]
|
19
|
-
t.warning = false
|
20
|
-
end
|
21
|
-
|
22
|
-
task(default: :test)
|
data/TROUBLESHOOT.md
DELETED
@@ -1,44 +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
|
-
_Note: You cannot specify folders or packages for `bin/packwerk validate` and `bin/packwerk update-todo` because the
|
18
|
-
command runs for the entire application._
|
19
|
-
|
20
|
-

|
21
|
-
|
22
|
-
### Package Dependency violation
|
23
|
-
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`.
|
24
|
-
|
25
|
-
See: [USAGE.md - Enforcing dependency boundary](USAGE.md#Enforcing-dependency-boundary)
|
26
|
-
|
27
|
-
#### Interpreting Dependency violation
|
28
|
-
|
29
|
-
> /Users/JaneDoe/src/github.com/sample-project/billing/app/jobs/document_processing_job.rb:48:6
|
30
|
-
> Dependency violation: ::Edi::Source belongs to 'edi', but 'billing' does not specify a dependency on 'edi'.
|
31
|
-
> Are we missing an abstraction?
|
32
|
-
> Is the code making the reference, and the referenced constant, in the right packages?
|
33
|
-
>
|
34
|
-
> Inference details: 'Edi::Source' refers to ::Edi::Source which seems to be defined in edi/app/models/edi/source.rb.
|
35
|
-
|
36
|
-
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`.
|
37
|
-
|
38
|
-
##### Suggestions
|
39
|
-
If a package declares dependencies, assume that some thought went into that. It is unlikely that the correct fix is to add another dependency.
|
40
|
-
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.
|
41
|
-
|
42
|
-
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).
|
43
|
-
|
44
|
-
If you’re getting stuck, find people with context about the two packages involved and ask for their opinion.
|
data/UPGRADING.md
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
# Upgrading from 2.x to 3.0
|
2
|
-
|
3
|
-
In Packwerk 3.0, we've made two notable changes:
|
4
|
-
|
5
|
-
## Renaming deprecated_references to package_todo
|
6
|
-
|
7
|
-
The `update-deprecations` subcommand has been renamed to `update-todo`. Old `deprecated_references.yml` files will be automatically deleted and replaced with `package_todo.yml` files when you run `update-todo`. This behaviour has been in Packwerk [since 2.3.0](https://github.com/Shopify/packwerk/releases/tag/v2.3.0), and automatic deletion will be removed in the next release.
|
8
|
-
|
9
|
-
### Removal of privacy checking
|
10
|
-
|
11
|
-
Privacy checking via `enforce_privacy` has been removed. Developers are encouraged to focus on leveraging Packwerk for dependency checking. For those who still need privacy checks, please use [Gusto's extension gem](https://github.com/rubyatscale/packwerk-extensions).
|
12
|
-
|
13
|
-
# Upgrading from 1.x to 2.0
|
14
|
-
|
15
|
-
With Packwerk 2.0, we made a few changes to simplify the setup. Updating will require removing some previously necessary files and configuration.
|
16
|
-
|
17
|
-
## Gem group
|
18
|
-
|
19
|
-
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.
|
20
|
-
|
21
|
-
## Removing application config caches
|
22
|
-
|
23
|
-
### Load paths
|
24
|
-
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.
|
25
|
-
|
26
|
-
### Inflections
|
27
|
-
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).
|
28
|
-
|
29
|
-
|
30
|
-
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).
|
31
|
-
|
32
|
-
`config/inflections.yml`
|
33
|
-
```yml
|
34
|
-
# List your inflections in this file instead of `inflections.rb`
|
35
|
-
# See steps to set up custom inflections:
|
36
|
-
# https://github.com/Shopify/packwerk/blob/main/USAGE.md#Inflections
|
37
|
-
|
38
|
-
acronym:
|
39
|
-
- 'HTML'
|
40
|
-
- 'API'
|
41
|
-
|
42
|
-
singular:
|
43
|
-
- ['oxen', 'oxen']
|
44
|
-
|
45
|
-
irregular:
|
46
|
-
- ['person', 'people']
|
47
|
-
|
48
|
-
uncountable:
|
49
|
-
- 'fish'
|
50
|
-
- 'sheep'
|
51
|
-
```
|
52
|
-
|
53
|
-
`config/initializers/inflections.rb`
|
54
|
-
```ruby
|
55
|
-
ActiveSupport::Inflector.inflections(:en) do |inflect|
|
56
|
-
inflect.acronym('HTML')
|
57
|
-
inflect.acronym('API')
|
58
|
-
|
59
|
-
inflect.singular('oxen', 'oxen')
|
60
|
-
|
61
|
-
inflect.irregular('person', 'people')
|
62
|
-
|
63
|
-
inflect.uncountable('fish')
|
64
|
-
inflect.uncountable('sheep')
|
65
|
-
end
|
66
|
-
```
|