spoom 1.8.3 → 1.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +292 -168
- data/lib/spoom/backtrace_filter/minitest.rb +1 -1
- data/lib/spoom/cli/srb/bump.rb +9 -1
- data/lib/spoom/cli/srb/sigs.rb +10 -0
- data/lib/spoom/cli/srb/tc.rb +5 -1
- data/lib/spoom/deadcode/erb.rb +27 -16
- data/lib/spoom/deadcode/index.rb +6 -1
- data/lib/spoom/deadcode/remover.rb +60 -0
- data/lib/spoom/sorbet/errors.rb +39 -3
- data/lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/base_translator.rb +16 -3
- data/lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs/options.rb +10 -0
- data/lib/spoom/sorbet/translate/rbs_comments_to_sorbet_sigs.rb +5 -2
- data/lib/spoom/sorbet/translate/sorbet_sigs_to_rbs_comments.rb +21 -6
- data/lib/spoom/sorbet/translate.rb +11 -3
- data/lib/spoom/version.rb +1 -1
- data/rbi/spoom.rbi +58 -9
- metadata +3 -3
data/README.md
CHANGED
|
@@ -1,174 +1,190 @@
|
|
|
1
1
|
# Spoom
|
|
2
2
|
|
|
3
|
-
Useful tools for Sorbet
|
|
3
|
+
Useful tools for Sorbet projects.
|
|
4
|
+
|
|
5
|
+
Spoom provides a CLI and a Ruby API to inspect Sorbet projects, improve typing coverage, translate signatures, query Sorbet LSP, and find dead code.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
7
|
-
Add
|
|
9
|
+
Add Spoom to your application's Gemfile:
|
|
8
10
|
|
|
9
11
|
```ruby
|
|
10
|
-
gem
|
|
12
|
+
gem "spoom"
|
|
11
13
|
```
|
|
12
14
|
|
|
13
|
-
|
|
15
|
+
Then install it:
|
|
14
16
|
|
|
15
|
-
|
|
17
|
+
```sh
|
|
18
|
+
bundle install
|
|
19
|
+
```
|
|
16
20
|
|
|
17
|
-
Or install it
|
|
21
|
+
Or install it directly:
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
```sh
|
|
24
|
+
gem install spoom
|
|
25
|
+
```
|
|
20
26
|
|
|
21
|
-
|
|
27
|
+
Spoom requires Ruby 3.3 or newer.
|
|
22
28
|
|
|
23
|
-
|
|
29
|
+
## Command line interface
|
|
24
30
|
|
|
25
|
-
|
|
31
|
+
Run `spoom help` or `spoom help COMMAND` to list all available commands.
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
### Typechecking errors
|
|
28
34
|
|
|
29
|
-
|
|
35
|
+
`spoom srb tc` runs `srb tc` and can sort, filter, format, and export errors.
|
|
30
36
|
|
|
31
|
-
|
|
37
|
+
List errors sorted by location:
|
|
32
38
|
|
|
33
|
-
```
|
|
34
|
-
|
|
39
|
+
```sh
|
|
40
|
+
spoom srb tc --sort loc
|
|
35
41
|
```
|
|
36
42
|
|
|
37
|
-
|
|
43
|
+
List errors sorted by error code:
|
|
38
44
|
|
|
39
|
-
```
|
|
40
|
-
|
|
45
|
+
```sh
|
|
46
|
+
spoom srb tc --sort code
|
|
41
47
|
```
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
List only errors with a specific code:
|
|
44
50
|
|
|
45
|
-
|
|
51
|
+
```sh
|
|
52
|
+
spoom srb tc --code 7004
|
|
53
|
+
```
|
|
46
54
|
|
|
47
|
-
|
|
55
|
+
Limit the number of displayed errors:
|
|
48
56
|
|
|
49
|
-
|
|
57
|
+
```sh
|
|
58
|
+
spoom srb tc --limit 10
|
|
59
|
+
```
|
|
50
60
|
|
|
51
|
-
|
|
61
|
+
Options can be combined:
|
|
52
62
|
|
|
53
|
-
```
|
|
54
|
-
|
|
63
|
+
```sh
|
|
64
|
+
spoom srb tc --sort code --code 7004 --limit 10
|
|
55
65
|
```
|
|
56
66
|
|
|
57
|
-
|
|
67
|
+
Remove duplicated error lines:
|
|
58
68
|
|
|
59
|
-
```
|
|
60
|
-
|
|
69
|
+
```sh
|
|
70
|
+
spoom srb tc --uniq
|
|
61
71
|
```
|
|
62
72
|
|
|
63
|
-
|
|
73
|
+
Format each error line:
|
|
64
74
|
|
|
65
|
-
```
|
|
66
|
-
|
|
75
|
+
```sh
|
|
76
|
+
spoom srb tc --format "%C - %F:%L: %M"
|
|
67
77
|
```
|
|
68
78
|
|
|
69
|
-
|
|
79
|
+
Format tokens:
|
|
70
80
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
* `%C`: error code
|
|
82
|
+
* `%F`: file path
|
|
83
|
+
* `%L`: line number
|
|
84
|
+
* `%M`: error message
|
|
74
85
|
|
|
75
|
-
|
|
86
|
+
Hide the final `Errors: X` count:
|
|
76
87
|
|
|
77
|
-
```
|
|
78
|
-
|
|
88
|
+
```sh
|
|
89
|
+
spoom srb tc --no-count
|
|
79
90
|
```
|
|
80
91
|
|
|
81
|
-
|
|
92
|
+
List only errors from specific files or directories:
|
|
82
93
|
|
|
83
|
-
```
|
|
84
|
-
|
|
94
|
+
```sh
|
|
95
|
+
spoom srb tc file1.rb path1/ path2/
|
|
85
96
|
```
|
|
86
97
|
|
|
87
|
-
|
|
98
|
+
Write errors to a JUnit XML file:
|
|
88
99
|
|
|
100
|
+
```sh
|
|
101
|
+
spoom srb tc --junit-output-path junit.xml
|
|
89
102
|
```
|
|
90
|
-
|
|
103
|
+
|
|
104
|
+
Pass extra options to Sorbet:
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
spoom srb tc --sorbet-options="--typed=true"
|
|
91
108
|
```
|
|
92
109
|
|
|
93
|
-
|
|
110
|
+
### Typing coverage
|
|
94
111
|
|
|
95
|
-
|
|
96
|
-
* `%F` is the file the error is from
|
|
97
|
-
* `%L` is the line the error is from
|
|
98
|
-
* `%M` is the error message
|
|
112
|
+
`spoom srb coverage` collects Sorbet coverage metrics and can generate an HTML report from Sorbet and Git data.
|
|
99
113
|
|
|
100
|
-
|
|
114
|
+

|
|
101
115
|
|
|
102
|
-
|
|
103
|
-
|
|
116
|
+
Show a coverage snapshot:
|
|
117
|
+
|
|
118
|
+
```sh
|
|
119
|
+
spoom srb coverage
|
|
104
120
|
```
|
|
105
121
|
|
|
106
|
-
|
|
122
|
+
Save a snapshot under `spoom_data/`:
|
|
107
123
|
|
|
124
|
+
```sh
|
|
125
|
+
spoom srb coverage --save
|
|
108
126
|
```
|
|
109
|
-
$ spoom srb tc file1.rb path1/ path2/
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
#### Typing coverage
|
|
113
127
|
|
|
114
|
-
|
|
128
|
+
Save a snapshot under a specific directory:
|
|
115
129
|
|
|
116
|
-
```
|
|
117
|
-
|
|
130
|
+
```sh
|
|
131
|
+
spoom srb coverage --save my_data/
|
|
118
132
|
```
|
|
119
133
|
|
|
120
|
-
|
|
134
|
+
Show typing coverage evolution based on Git history:
|
|
121
135
|
|
|
122
|
-
```
|
|
123
|
-
|
|
136
|
+
```sh
|
|
137
|
+
spoom srb coverage timeline
|
|
124
138
|
```
|
|
125
139
|
|
|
126
|
-
|
|
140
|
+
Replay a specific date range:
|
|
127
141
|
|
|
128
|
-
```
|
|
129
|
-
|
|
142
|
+
```sh
|
|
143
|
+
spoom srb coverage timeline --from YYYY-MM-DD --to YYYY-MM-DD
|
|
130
144
|
```
|
|
131
145
|
|
|
132
|
-
|
|
146
|
+
Save timeline snapshots under `spoom_data/`:
|
|
133
147
|
|
|
134
|
-
```
|
|
135
|
-
|
|
148
|
+
```sh
|
|
149
|
+
spoom srb coverage timeline --save
|
|
136
150
|
```
|
|
137
151
|
|
|
138
|
-
|
|
152
|
+
Save timeline snapshots under a specific directory:
|
|
139
153
|
|
|
140
|
-
```
|
|
141
|
-
|
|
154
|
+
```sh
|
|
155
|
+
spoom srb coverage timeline --save my_data/
|
|
142
156
|
```
|
|
143
157
|
|
|
144
|
-
|
|
158
|
+
Run `bundle install` before collecting each timeline snapshot:
|
|
145
159
|
|
|
146
|
-
```
|
|
147
|
-
|
|
160
|
+
```sh
|
|
161
|
+
spoom srb coverage timeline --bundle-install
|
|
148
162
|
```
|
|
149
163
|
|
|
150
|
-
|
|
164
|
+
Generate an HTML coverage report from saved snapshots:
|
|
151
165
|
|
|
152
|
-
```
|
|
153
|
-
|
|
166
|
+
```sh
|
|
167
|
+
spoom srb coverage report
|
|
154
168
|
```
|
|
155
169
|
|
|
156
|
-
|
|
170
|
+
The report is generated at `spoom_report.html` by default.
|
|
157
171
|
|
|
158
|
-
|
|
159
|
-
|
|
172
|
+
Generate a report from a custom data directory:
|
|
173
|
+
|
|
174
|
+
```sh
|
|
175
|
+
spoom srb coverage report --data my_data/
|
|
160
176
|
```
|
|
161
177
|
|
|
162
|
-
|
|
178
|
+
Change the generated report path:
|
|
163
179
|
|
|
164
|
-
```
|
|
165
|
-
|
|
180
|
+
```sh
|
|
181
|
+
spoom srb coverage report --file coverage.html
|
|
166
182
|
```
|
|
167
183
|
|
|
168
|
-
Change
|
|
184
|
+
Change report colors:
|
|
169
185
|
|
|
170
|
-
```
|
|
171
|
-
|
|
186
|
+
```sh
|
|
187
|
+
spoom srb coverage report \
|
|
172
188
|
--color-true "#648ffe" \
|
|
173
189
|
--color-false "#fe6002" \
|
|
174
190
|
--color-ignore "#feb000" \
|
|
@@ -176,123 +192,213 @@ $ spoom srb coverage report \
|
|
|
176
192
|
--color-strong "#6444f1"
|
|
177
193
|
```
|
|
178
194
|
|
|
179
|
-
Open the HTML
|
|
195
|
+
Open the HTML coverage report:
|
|
180
196
|
|
|
197
|
+
```sh
|
|
198
|
+
spoom srb coverage open
|
|
181
199
|
```
|
|
182
|
-
|
|
200
|
+
|
|
201
|
+
Open a report at a custom path:
|
|
202
|
+
|
|
203
|
+
```sh
|
|
204
|
+
spoom srb coverage open coverage.html
|
|
183
205
|
```
|
|
184
206
|
|
|
185
|
-
|
|
207
|
+
### Sorbet sigils
|
|
186
208
|
|
|
187
|
-
|
|
209
|
+
`spoom srb bump` changes `# typed:` sigils when the change does not introduce typechecking errors.
|
|
188
210
|
|
|
189
|
-
|
|
190
|
-
|
|
211
|
+
Bump files from `typed: false` to `typed: true`:
|
|
212
|
+
|
|
213
|
+
```sh
|
|
214
|
+
spoom srb bump --from false --to true
|
|
191
215
|
```
|
|
192
216
|
|
|
193
|
-
|
|
217
|
+
Force the change without typechecking:
|
|
194
218
|
|
|
195
|
-
```
|
|
196
|
-
|
|
219
|
+
```sh
|
|
220
|
+
spoom srb bump --from false --to true --force
|
|
197
221
|
```
|
|
198
222
|
|
|
199
|
-
Bump
|
|
223
|
+
Bump only files listed in a file, one path per line:
|
|
200
224
|
|
|
201
|
-
```
|
|
202
|
-
|
|
225
|
+
```sh
|
|
226
|
+
spoom srb bump --from false --to true --only list.txt
|
|
203
227
|
```
|
|
204
228
|
|
|
205
|
-
Check
|
|
206
|
-
Will exit with a non-zero status if some files can be bumped without errors (useful to check for bumpable files on CI for example):
|
|
229
|
+
Check which files can be bumped without applying changes:
|
|
207
230
|
|
|
208
|
-
```
|
|
209
|
-
|
|
231
|
+
```sh
|
|
232
|
+
spoom srb bump --from false --to true --dry
|
|
210
233
|
```
|
|
211
234
|
|
|
212
|
-
|
|
235
|
+
This command exits with a non-zero status when files can be bumped, which is useful in CI.
|
|
213
236
|
|
|
214
|
-
|
|
215
|
-
|
|
237
|
+
Use a custom Sorbet executable:
|
|
238
|
+
|
|
239
|
+
```sh
|
|
240
|
+
spoom srb bump --from false --to true --sorbet /path/to/sorbet/bin
|
|
216
241
|
```
|
|
217
242
|
|
|
218
|
-
Count
|
|
243
|
+
Count typechecking errors if all files were bumped:
|
|
219
244
|
|
|
245
|
+
```sh
|
|
246
|
+
spoom srb bump --from false --to true --count-errors --dry
|
|
220
247
|
```
|
|
221
|
-
|
|
248
|
+
|
|
249
|
+
### Signatures and type assertions
|
|
250
|
+
|
|
251
|
+
`spoom srb sigs` translates signatures between Sorbet RBI syntax and RBS comments.
|
|
252
|
+
|
|
253
|
+
Translate signatures from RBI to RBS comments:
|
|
254
|
+
|
|
255
|
+
```sh
|
|
256
|
+
spoom srb sigs translate
|
|
222
257
|
```
|
|
223
258
|
|
|
224
|
-
|
|
259
|
+
Translate signatures from RBS comments to RBI:
|
|
260
|
+
|
|
261
|
+
```sh
|
|
262
|
+
spoom srb sigs translate --from rbs --to rbi path/to/file.rb
|
|
263
|
+
```
|
|
225
264
|
|
|
226
|
-
|
|
265
|
+
Strip Sorbet signatures from files:
|
|
227
266
|
|
|
267
|
+
```sh
|
|
268
|
+
spoom srb sigs strip path/to/file.rb
|
|
228
269
|
```
|
|
229
|
-
|
|
270
|
+
|
|
271
|
+
Export gem signatures to an RBI file:
|
|
272
|
+
|
|
273
|
+
```sh
|
|
274
|
+
spoom srb sigs export
|
|
230
275
|
```
|
|
231
276
|
|
|
232
|
-
|
|
277
|
+
Check that the exported RBI file is up to date:
|
|
233
278
|
|
|
279
|
+
```sh
|
|
280
|
+
spoom srb sigs export --check-sync
|
|
234
281
|
```
|
|
235
|
-
|
|
282
|
+
|
|
283
|
+
`spoom srb assertions` translates Sorbet type assertions to RBS comments:
|
|
284
|
+
|
|
285
|
+
```sh
|
|
286
|
+
spoom srb assertions translate path/to/file.rb
|
|
236
287
|
```
|
|
237
288
|
|
|
238
|
-
|
|
289
|
+
### Sorbet LSP
|
|
290
|
+
|
|
291
|
+
`spoom srb lsp` sends requests to Sorbet LSP.
|
|
239
292
|
|
|
240
|
-
|
|
293
|
+
This command group is experimental.
|
|
241
294
|
|
|
242
|
-
Find
|
|
295
|
+
Find symbols matching `Foo`:
|
|
243
296
|
|
|
297
|
+
```sh
|
|
298
|
+
spoom srb lsp find Foo
|
|
244
299
|
```
|
|
245
|
-
|
|
300
|
+
|
|
301
|
+
List symbols in a file:
|
|
302
|
+
|
|
303
|
+
```sh
|
|
304
|
+
spoom srb lsp symbols file.rb
|
|
246
305
|
```
|
|
247
306
|
|
|
248
|
-
List
|
|
307
|
+
List definitions for a code location:
|
|
249
308
|
|
|
309
|
+
```sh
|
|
310
|
+
spoom srb lsp defs file.rb 10 4
|
|
250
311
|
```
|
|
251
|
-
|
|
312
|
+
|
|
313
|
+
List references for a code location:
|
|
314
|
+
|
|
315
|
+
```sh
|
|
316
|
+
spoom srb lsp refs file.rb 10 4
|
|
252
317
|
```
|
|
253
318
|
|
|
254
|
-
|
|
319
|
+
Show hover information for a code location:
|
|
255
320
|
|
|
321
|
+
```sh
|
|
322
|
+
spoom srb lsp hover file.rb 10 4
|
|
256
323
|
```
|
|
257
|
-
|
|
324
|
+
|
|
325
|
+
Show signature information for a code location:
|
|
326
|
+
|
|
327
|
+
```sh
|
|
328
|
+
spoom srb lsp sigs file.rb 10 4
|
|
258
329
|
```
|
|
259
330
|
|
|
260
|
-
|
|
331
|
+
Show type information for a code location:
|
|
261
332
|
|
|
333
|
+
```sh
|
|
334
|
+
spoom srb lsp types file.rb 10 4
|
|
262
335
|
```
|
|
263
|
-
|
|
336
|
+
|
|
337
|
+
### Sorbet code metrics
|
|
338
|
+
|
|
339
|
+
`spoom srb metrics` collects metrics about Sorbet usage in Ruby files.
|
|
340
|
+
|
|
341
|
+
Show metrics for the current project:
|
|
342
|
+
|
|
343
|
+
```sh
|
|
344
|
+
spoom srb metrics
|
|
264
345
|
```
|
|
265
346
|
|
|
266
|
-
Show
|
|
347
|
+
Show metrics for specific files or directories:
|
|
267
348
|
|
|
349
|
+
```sh
|
|
350
|
+
spoom srb metrics lib/ test/foo_test.rb
|
|
268
351
|
```
|
|
269
|
-
|
|
352
|
+
|
|
353
|
+
Dump raw metric keys and values:
|
|
354
|
+
|
|
355
|
+
```sh
|
|
356
|
+
spoom srb metrics --dump
|
|
270
357
|
```
|
|
271
358
|
|
|
272
|
-
|
|
359
|
+
### Dead code
|
|
273
360
|
|
|
361
|
+
`spoom deadcode` indexes a project and reports definitions that do not appear to be referenced.
|
|
362
|
+
|
|
363
|
+
Analyze the current project:
|
|
364
|
+
|
|
365
|
+
```sh
|
|
366
|
+
spoom deadcode
|
|
274
367
|
```
|
|
275
|
-
|
|
368
|
+
|
|
369
|
+
Analyze specific paths:
|
|
370
|
+
|
|
371
|
+
```sh
|
|
372
|
+
spoom deadcode lib/ app/models/
|
|
276
373
|
```
|
|
277
374
|
|
|
278
|
-
Show
|
|
375
|
+
Show files, loaded plugins, definitions, or references used during analysis:
|
|
279
376
|
|
|
377
|
+
```sh
|
|
378
|
+
spoom deadcode --show-files
|
|
379
|
+
spoom deadcode --show-plugins
|
|
380
|
+
spoom deadcode --show-defs
|
|
381
|
+
spoom deadcode --show-refs
|
|
280
382
|
```
|
|
281
|
-
|
|
383
|
+
|
|
384
|
+
Remove a reported dead code candidate:
|
|
385
|
+
|
|
386
|
+
```sh
|
|
387
|
+
spoom deadcode remove path/to/file.rb:42:18-47:23
|
|
282
388
|
```
|
|
283
389
|
|
|
284
|
-
|
|
390
|
+
## Ruby API
|
|
285
391
|
|
|
286
|
-
|
|
392
|
+
### Parsing Sorbet config
|
|
287
393
|
|
|
288
|
-
|
|
394
|
+
Parse a Sorbet config file:
|
|
289
395
|
|
|
290
396
|
```ruby
|
|
291
397
|
config = Spoom::Sorbet::Config.parse_file("sorbet/config")
|
|
292
|
-
puts config.paths
|
|
398
|
+
puts config.paths
|
|
293
399
|
```
|
|
294
400
|
|
|
295
|
-
|
|
401
|
+
Parse a Sorbet config string:
|
|
296
402
|
|
|
297
403
|
```ruby
|
|
298
404
|
config = Spoom::Sorbet::Config.parse_string(<<~CONFIG)
|
|
@@ -300,30 +406,31 @@ config = Spoom::Sorbet::Config.parse_string(<<~CONFIG)
|
|
|
300
406
|
--file=b
|
|
301
407
|
--ignore=c
|
|
302
408
|
CONFIG
|
|
303
|
-
|
|
304
|
-
puts config.
|
|
409
|
+
|
|
410
|
+
puts config.paths
|
|
411
|
+
puts config.ignore
|
|
305
412
|
```
|
|
306
413
|
|
|
307
|
-
List all files
|
|
414
|
+
List all files typechecked by Sorbet:
|
|
308
415
|
|
|
309
416
|
```ruby
|
|
310
417
|
config = Spoom::Sorbet::Config.parse_file("sorbet/config")
|
|
311
|
-
puts Spoom::
|
|
418
|
+
puts Spoom::Context.new(".").srb_files(with_config: config)
|
|
312
419
|
```
|
|
313
420
|
|
|
314
|
-
|
|
421
|
+
### Parsing Sorbet metrics
|
|
315
422
|
|
|
316
423
|
Display metrics collected during typechecking:
|
|
317
424
|
|
|
318
425
|
```ruby
|
|
319
|
-
puts Spoom::
|
|
426
|
+
puts Spoom::Context.new(".").srb_metrics(capture_err: false)
|
|
320
427
|
```
|
|
321
428
|
|
|
322
|
-
|
|
429
|
+
### Interacting with LSP
|
|
323
430
|
|
|
324
431
|
Create an LSP client:
|
|
325
432
|
|
|
326
|
-
```
|
|
433
|
+
```ruby
|
|
327
434
|
client = Spoom::LSP::Client.new(
|
|
328
435
|
Spoom::Sorbet::BIN_PATH,
|
|
329
436
|
"--lsp",
|
|
@@ -333,71 +440,88 @@ client = Spoom::LSP::Client.new(
|
|
|
333
440
|
client.open(".")
|
|
334
441
|
```
|
|
335
442
|
|
|
336
|
-
Find
|
|
443
|
+
Find symbols matching a string:
|
|
337
444
|
|
|
338
|
-
```
|
|
445
|
+
```ruby
|
|
339
446
|
puts client.symbols("Foo")
|
|
340
447
|
```
|
|
341
448
|
|
|
342
|
-
Find
|
|
449
|
+
Find symbols in a file:
|
|
343
450
|
|
|
344
|
-
```
|
|
451
|
+
```ruby
|
|
345
452
|
puts client.document_symbols("file://path/to/my/file.rb")
|
|
346
453
|
```
|
|
347
454
|
|
|
348
|
-
|
|
455
|
+
## Backtrace filtering
|
|
456
|
+
|
|
457
|
+
Spoom provides a Minitest backtrace filter that removes Sorbet frames from test failures.
|
|
349
458
|
|
|
350
|
-
|
|
459
|
+
Enable it in your test helper:
|
|
351
460
|
|
|
352
461
|
```ruby
|
|
353
462
|
# test/test_helper.rb
|
|
354
463
|
require "spoom/backtrace_filter/minitest"
|
|
464
|
+
|
|
355
465
|
Minitest.backtrace_filter = Spoom::BacktraceFilter::Minitest.new
|
|
356
466
|
```
|
|
357
467
|
|
|
358
|
-
|
|
468
|
+
## Development
|
|
359
469
|
|
|
360
|
-
|
|
470
|
+
After checking out the repo, install dependencies:
|
|
361
471
|
|
|
472
|
+
```sh
|
|
473
|
+
bin/setup
|
|
362
474
|
```
|
|
363
|
-
$ spoom deadcode
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
This will list all the methods and constants that do not appear to be used in your project.
|
|
367
475
|
|
|
368
|
-
|
|
476
|
+
Run the tests:
|
|
369
477
|
|
|
478
|
+
```sh
|
|
479
|
+
bin/test
|
|
370
480
|
```
|
|
371
|
-
|
|
481
|
+
|
|
482
|
+
Run an interactive console:
|
|
483
|
+
|
|
484
|
+
```sh
|
|
485
|
+
bin/console
|
|
372
486
|
```
|
|
373
487
|
|
|
374
|
-
|
|
488
|
+
Run the full local sanity check before pushing:
|
|
375
489
|
|
|
376
|
-
|
|
490
|
+
```sh
|
|
491
|
+
bin/sanity
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
Install this gem locally:
|
|
377
495
|
|
|
378
|
-
|
|
496
|
+
```sh
|
|
497
|
+
bundle exec rake install
|
|
498
|
+
```
|
|
379
499
|
|
|
380
500
|
## Releasing
|
|
381
501
|
|
|
382
502
|
### Bump the gem version
|
|
383
503
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
504
|
+
* [ ] Update the version number in [`lib/spoom/version.rb`](https://github.com/Shopify/spoom/blob/main/lib/spoom/version.rb)
|
|
505
|
+
* [ ] Run `bundle install` to update the version number in `Gemfile.lock`
|
|
506
|
+
* [ ] Commit the change with `Bump version to vx.y.z`
|
|
507
|
+
* [ ] Push the change directly to `main` or open a pull request
|
|
388
508
|
|
|
389
509
|
### Create a new tag
|
|
390
510
|
|
|
391
|
-
|
|
392
|
-
|
|
511
|
+
* [ ] Create a tag with the new version number: `git tag vx.y.z`
|
|
512
|
+
* [ ] Push the tag: `git push origin vx.y.z`
|
|
393
513
|
|
|
394
|
-
###
|
|
514
|
+
### Publish the release
|
|
395
515
|
|
|
396
|
-
|
|
516
|
+
The [release workflow](https://github.com/Shopify/spoom/actions/workflows/release.yml) publishes new gem versions to RubyGems through [Trusted Publishing](https://guides.rubygems.org/trusted-publishing/).
|
|
517
|
+
|
|
518
|
+
A member of the Ruby and Rails Infrastructure team at Shopify must approve the workflow before it runs. Once approved, it publishes the gem and creates a GitHub release.
|
|
397
519
|
|
|
398
520
|
## Contributing
|
|
399
521
|
|
|
400
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/spoom.
|
|
522
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/Shopify/spoom.
|
|
523
|
+
|
|
524
|
+
This project is intended to be a safe, welcoming space for collaboration. Contributors are expected to follow the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
|
401
525
|
|
|
402
526
|
## License
|
|
403
527
|
|
|
@@ -405,4 +529,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
|
405
529
|
|
|
406
530
|
## Code of Conduct
|
|
407
531
|
|
|
408
|
-
Everyone interacting in
|
|
532
|
+
Everyone interacting in Spoom's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the [code of conduct](https://github.com/Shopify/spoom/blob/main/CODE_OF_CONDUCT.md).
|