spoom 1.6.1 → 1.6.2
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 +14 -0
- data/lib/spoom/backtrace_filter/minitest.rb +1 -1
- data/lib/spoom/cli/helper.rb +8 -6
- data/lib/spoom/cli/srb/coverage.rb +1 -1
- data/lib/spoom/cli/srb/sigs.rb +3 -2
- data/lib/spoom/cli/srb/tc.rb +16 -1
- data/lib/spoom/context/exec.rb +1 -1
- data/lib/spoom/context.rb +1 -1
- data/lib/spoom/coverage/report.rb +3 -3
- data/lib/spoom/coverage/snapshot.rb +1 -1
- data/lib/spoom/deadcode/index.rb +3 -3
- data/lib/spoom/deadcode/plugins/actionpack.rb +14 -17
- data/lib/spoom/deadcode/plugins/active_record.rb +41 -50
- data/lib/spoom/deadcode/plugins/active_support.rb +1 -1
- data/lib/spoom/deadcode/plugins/rubocop.rb +1 -1
- data/lib/spoom/deadcode/plugins.rb +21 -27
- data/lib/spoom/deadcode/remover.rb +21 -20
- data/lib/spoom/file_collector.rb +1 -1
- data/lib/spoom/file_tree.rb +5 -5
- data/lib/spoom/model/builder.rb +6 -9
- data/lib/spoom/model/model.rb +6 -6
- data/lib/spoom/model/namespace_visitor.rb +1 -1
- data/lib/spoom/model/references_visitor.rb +1 -1
- data/lib/spoom/poset.rb +5 -5
- data/lib/spoom/sorbet/assertions.rb +3 -3
- data/lib/spoom/sorbet/config.rb +6 -6
- data/lib/spoom/sorbet/errors.rb +71 -14
- data/lib/spoom/sorbet/lsp/base.rb +1 -1
- data/lib/spoom/sorbet/lsp/structures.rb +29 -32
- data/lib/spoom/sorbet/lsp.rb +5 -5
- data/lib/spoom/sorbet/sigils.rb +9 -12
- data/lib/spoom/sorbet/sigs.rb +6 -6
- data/lib/spoom/sorbet.rb +3 -3
- data/lib/spoom/version.rb +1 -1
- data/lib/spoom.rb +1 -1
- data/rbi/spoom.rbi +8 -569
- metadata +20 -6
data/rbi/spoom.rbi
CHANGED
@@ -35,30 +35,24 @@ module Spoom::Cli::Helper
|
|
35
35
|
sig { params(string: ::String).returns(::String) }
|
36
36
|
def blue(string); end
|
37
37
|
|
38
|
-
|
39
|
-
|
40
|
-
def collect_files(paths); end
|
38
|
+
sig { params(paths: T::Array[::String], include_rbi_files: T::Boolean).returns(T::Array[::String]) }
|
39
|
+
def collect_files(paths, include_rbi_files: T.unsafe(nil)); end
|
41
40
|
|
42
|
-
# Is the `--color` option true?
|
43
41
|
sig { returns(T::Boolean) }
|
44
42
|
def color?; end
|
45
43
|
|
46
|
-
# Colorize a string if `color?`
|
47
44
|
sig { params(string: ::String, color: ::Spoom::Color).returns(::String) }
|
48
45
|
def colorize(string, *color); end
|
49
46
|
|
50
|
-
# Returns the context at `--path` (by default the current working directory)
|
51
47
|
sig { returns(::Spoom::Context) }
|
52
48
|
def context; end
|
53
49
|
|
54
|
-
# Raise if `spoom` is not ran inside a context with a `sorbet/config` file
|
55
50
|
sig { returns(::Spoom::Context) }
|
56
51
|
def context_requiring_sorbet!; end
|
57
52
|
|
58
53
|
sig { params(string: ::String).returns(::String) }
|
59
54
|
def cyan(string); end
|
60
55
|
|
61
|
-
# Return the path specified through `--path`
|
62
56
|
sig { returns(::String) }
|
63
57
|
def exec_path; end
|
64
58
|
|
@@ -74,19 +68,12 @@ module Spoom::Cli::Helper
|
|
74
68
|
sig { params(string: ::String).returns(::String) }
|
75
69
|
def red(string); end
|
76
70
|
|
77
|
-
# Print `message` on `$stdout`
|
78
71
|
sig { params(message: ::String).void }
|
79
72
|
def say(message); end
|
80
73
|
|
81
|
-
# Print `message` on `$stderr`
|
82
|
-
#
|
83
|
-
# The message is prefixed by a status (default: `Error`).
|
84
74
|
sig { params(message: ::String, status: T.nilable(::String), nl: T::Boolean).void }
|
85
75
|
def say_error(message, status: T.unsafe(nil), nl: T.unsafe(nil)); end
|
86
76
|
|
87
|
-
# Print `message` on `$stderr`
|
88
|
-
#
|
89
|
-
# The message is prefixed by a status (default: `Warning`).
|
90
77
|
sig { params(message: ::String, status: T.nilable(::String), nl: T::Boolean).void }
|
91
78
|
def say_warning(message, status: T.unsafe(nil), nl: T.unsafe(nil)); end
|
92
79
|
|
@@ -110,7 +97,6 @@ class Spoom::Cli::Main < ::Thor
|
|
110
97
|
def tc(*paths_to_select); end
|
111
98
|
|
112
99
|
class << self
|
113
|
-
# @return [Boolean]
|
114
100
|
def exit_on_failure?; end
|
115
101
|
end
|
116
102
|
end
|
@@ -161,38 +147,18 @@ class Spoom::Cli::Srb::LSP < ::Thor
|
|
161
147
|
include ::Spoom::Colorize
|
162
148
|
include ::Spoom::Cli::Helper
|
163
149
|
|
164
|
-
# TODO: options, filter, limit, kind etc.. filter rbi
|
165
150
|
def defs(file, line, col); end
|
166
|
-
|
167
|
-
# TODO: options, filter, limit, kind etc.. filter rbi
|
168
151
|
def find(query); end
|
169
|
-
|
170
152
|
def help(command = T.unsafe(nil), subcommand = T.unsafe(nil)); end
|
171
|
-
|
172
|
-
# TODO: options, filter, limit, kind etc.. filter rbi
|
173
153
|
def hover(file, line, col); end
|
174
|
-
|
175
|
-
# TODO: options, filter, limit, kind etc.. filter rbi
|
176
154
|
def list; end
|
177
|
-
|
178
155
|
def lsp_client; end
|
179
|
-
|
180
|
-
# TODO: options, filter, limit, kind etc.. filter rbi
|
181
156
|
def refs(file, line, col); end
|
182
|
-
|
183
157
|
def run(&block); end
|
184
|
-
|
185
|
-
# TODO: options, filter, limit, kind etc.. filter rbi
|
186
158
|
def sigs(file, line, col); end
|
187
|
-
|
188
159
|
def symbol_printer; end
|
189
|
-
|
190
|
-
# TODO: options, filter, limit, kind etc.. filter rbi
|
191
160
|
def symbols(file); end
|
192
|
-
|
193
161
|
def to_uri(path); end
|
194
|
-
|
195
|
-
# TODO: options, filter, limit, kind etc.. filter rbi
|
196
162
|
def types(file, line, col); end
|
197
163
|
end
|
198
164
|
|
@@ -264,10 +230,6 @@ module Spoom::Colorize
|
|
264
230
|
def set_color(string, *color); end
|
265
231
|
end
|
266
232
|
|
267
|
-
# An abstraction to a Ruby project context
|
268
|
-
#
|
269
|
-
# A context maps to a directory in the file system.
|
270
|
-
# It is used to manipulate files and run commands in the context of this directory.
|
271
233
|
class Spoom::Context
|
272
234
|
include ::Spoom::Context::Bundle
|
273
235
|
include ::Spoom::Context::Exec
|
@@ -275,79 +237,56 @@ class Spoom::Context
|
|
275
237
|
include ::Spoom::Context::Git
|
276
238
|
include ::Spoom::Context::Sorbet
|
277
239
|
|
278
|
-
# Create a new context about `absolute_path`
|
279
|
-
#
|
280
|
-
# The directory will not be created if it doesn't exist.
|
281
|
-
# Call `#make!` to create it.
|
282
240
|
sig { params(absolute_path: ::String).void }
|
283
241
|
def initialize(absolute_path); end
|
284
242
|
|
285
|
-
# The absolute path to the directory this context is about
|
286
243
|
sig { returns(::String) }
|
287
244
|
def absolute_path; end
|
288
245
|
|
289
246
|
class << self
|
290
|
-
# Create a new context in the system's temporary directory
|
291
|
-
#
|
292
|
-
# `name` is used as prefix to the temporary directory name.
|
293
|
-
# The directory will be created if it doesn't exist.
|
294
247
|
sig { params(name: T.nilable(::String)).returns(T.attached_class) }
|
295
248
|
def mktmp!(name = T.unsafe(nil)); end
|
296
249
|
end
|
297
250
|
end
|
298
251
|
|
299
|
-
# Bundle features for a context
|
300
252
|
module Spoom::Context::Bundle
|
301
253
|
requires_ancestor { Spoom::Context }
|
302
254
|
|
303
|
-
# Run a command with `bundle` in this context directory
|
304
255
|
sig { params(command: ::String, version: T.nilable(::String), capture_err: T::Boolean).returns(::Spoom::ExecResult) }
|
305
256
|
def bundle(command, version: T.unsafe(nil), capture_err: T.unsafe(nil)); end
|
306
257
|
|
307
|
-
# Run a command `bundle exec` in this context directory
|
308
258
|
sig { params(command: ::String, version: T.nilable(::String), capture_err: T::Boolean).returns(::Spoom::ExecResult) }
|
309
259
|
def bundle_exec(command, version: T.unsafe(nil), capture_err: T.unsafe(nil)); end
|
310
260
|
|
311
|
-
# Run `bundle install` in this context directory
|
312
261
|
sig { params(version: T.nilable(::String), capture_err: T::Boolean).returns(::Spoom::ExecResult) }
|
313
262
|
def bundle_install!(version: T.unsafe(nil), capture_err: T.unsafe(nil)); end
|
314
263
|
|
315
|
-
# Get `gem` version from the `Gemfile.lock` content
|
316
|
-
#
|
317
|
-
# Returns `nil` if `gem` cannot be found in the Gemfile.
|
318
264
|
sig { params(gem: ::String).returns(T.nilable(::Gem::Version)) }
|
319
265
|
def gem_version_from_gemfile_lock(gem); end
|
320
266
|
|
321
267
|
sig { returns(T::Hash[::String, ::Bundler::LazySpecification]) }
|
322
268
|
def gemfile_lock_specs; end
|
323
269
|
|
324
|
-
# Read the contents of the Gemfile in this context directory
|
325
270
|
sig { returns(T.nilable(::String)) }
|
326
271
|
def read_gemfile; end
|
327
272
|
|
328
|
-
# Read the contents of the Gemfile.lock in this context directory
|
329
273
|
sig { returns(T.nilable(::String)) }
|
330
274
|
def read_gemfile_lock; end
|
331
275
|
|
332
|
-
# Set the `contents` of the Gemfile in this context directory
|
333
276
|
sig { params(contents: ::String, append: T::Boolean).void }
|
334
277
|
def write_gemfile!(contents, append: T.unsafe(nil)); end
|
335
278
|
end
|
336
279
|
|
337
|
-
# Execution features for a context
|
338
280
|
module Spoom::Context::Exec
|
339
281
|
requires_ancestor { Spoom::Context }
|
340
282
|
|
341
|
-
# Run a command in this context directory
|
342
283
|
sig { params(command: ::String, capture_err: T::Boolean).returns(::Spoom::ExecResult) }
|
343
284
|
def exec(command, capture_err: T.unsafe(nil)); end
|
344
285
|
end
|
345
286
|
|
346
|
-
# File System features for a context
|
347
287
|
module Spoom::Context::FileSystem
|
348
288
|
requires_ancestor { Spoom::Context }
|
349
289
|
|
350
|
-
# Returns the absolute path to `relative_path` in the context's directory
|
351
290
|
sig { params(relative_path: ::String).returns(::String) }
|
352
291
|
def absolute_path_to(relative_path); end
|
353
292
|
|
@@ -360,143 +299,104 @@ module Spoom::Context::FileSystem
|
|
360
299
|
end
|
361
300
|
def collect_files(allow_extensions: T.unsafe(nil), allow_mime_types: T.unsafe(nil), exclude_patterns: T.unsafe(nil)); end
|
362
301
|
|
363
|
-
# Delete this context and its content
|
364
|
-
#
|
365
|
-
# Warning: it will `rm -rf` the context directory on the file system.
|
366
302
|
sig { void }
|
367
303
|
def destroy!; end
|
368
304
|
|
369
|
-
# Does the context directory at `absolute_path` exist and is a directory?
|
370
305
|
sig { returns(T::Boolean) }
|
371
306
|
def exist?; end
|
372
307
|
|
373
|
-
# Does `relative_path` point to an existing file in this context directory?
|
374
308
|
sig { params(relative_path: ::String).returns(T::Boolean) }
|
375
309
|
def file?(relative_path); end
|
376
310
|
|
377
|
-
# List all files in this context matching `pattern`
|
378
311
|
sig { params(pattern: ::String).returns(T::Array[::String]) }
|
379
312
|
def glob(pattern = T.unsafe(nil)); end
|
380
313
|
|
381
|
-
# List all files at the top level of this context directory
|
382
314
|
sig { returns(T::Array[::String]) }
|
383
315
|
def list; end
|
384
316
|
|
385
|
-
# Create the context directory at `absolute_path`
|
386
317
|
sig { void }
|
387
318
|
def mkdir!; end
|
388
319
|
|
389
|
-
# Move the file or directory from `from_relative_path` to `to_relative_path`
|
390
320
|
sig { params(from_relative_path: ::String, to_relative_path: ::String).void }
|
391
321
|
def move!(from_relative_path, to_relative_path); end
|
392
322
|
|
393
|
-
# Return the contents of the file at `relative_path` in this context directory
|
394
|
-
#
|
395
|
-
# Will raise if the file doesn't exist.
|
396
323
|
sig { params(relative_path: ::String).returns(::String) }
|
397
324
|
def read(relative_path); end
|
398
325
|
|
399
|
-
# Remove the path at `relative_path` (recursive + force) in this context directory
|
400
326
|
sig { params(relative_path: ::String).void }
|
401
327
|
def remove!(relative_path); end
|
402
328
|
|
403
|
-
# Write `contents` in the file at `relative_path` in this context directory
|
404
|
-
#
|
405
|
-
# Append to the file if `append` is true.
|
406
329
|
sig { params(relative_path: ::String, contents: ::String, append: T::Boolean).void }
|
407
330
|
def write!(relative_path, contents = T.unsafe(nil), append: T.unsafe(nil)); end
|
408
331
|
end
|
409
332
|
|
410
|
-
# Git features for a context
|
411
333
|
module Spoom::Context::Git
|
412
334
|
requires_ancestor { Spoom::Context }
|
413
335
|
|
414
|
-
# Run a command prefixed by `git` in this context directory
|
415
336
|
sig { params(command: ::String).returns(::Spoom::ExecResult) }
|
416
337
|
def git(command); end
|
417
338
|
|
418
|
-
# Run `git checkout` in this context directory
|
419
339
|
sig { params(ref: ::String).returns(::Spoom::ExecResult) }
|
420
340
|
def git_checkout!(ref: T.unsafe(nil)); end
|
421
341
|
|
422
|
-
# Run `git checkout -b <branch-name> <ref>` in this context directory
|
423
342
|
sig { params(branch_name: ::String, ref: T.nilable(::String)).returns(::Spoom::ExecResult) }
|
424
343
|
def git_checkout_new_branch!(branch_name, ref: T.unsafe(nil)); end
|
425
344
|
|
426
|
-
# Run `git add . && git commit` in this context directory
|
427
345
|
sig { params(message: ::String, time: ::Time, allow_empty: T::Boolean).returns(::Spoom::ExecResult) }
|
428
346
|
def git_commit!(message: T.unsafe(nil), time: T.unsafe(nil), allow_empty: T.unsafe(nil)); end
|
429
347
|
|
430
|
-
# Get the current git branch in this context directory
|
431
348
|
sig { returns(T.nilable(::String)) }
|
432
349
|
def git_current_branch; end
|
433
350
|
|
434
|
-
# Run `git diff` in this context directory
|
435
351
|
sig { params(arg: ::String).returns(::Spoom::ExecResult) }
|
436
352
|
def git_diff(*arg); end
|
437
353
|
|
438
|
-
# Run `git init` in this context directory
|
439
|
-
#
|
440
|
-
# Warning: passing a branch will run `git init -b <branch>` which is only available in git 2.28+.
|
441
|
-
# In older versions, use `git_init!` followed by `git("checkout -b <branch>")`.
|
442
354
|
sig { params(branch: T.nilable(::String)).returns(::Spoom::ExecResult) }
|
443
355
|
def git_init!(branch: T.unsafe(nil)); end
|
444
356
|
|
445
|
-
# Get the last commit in the currently checked out branch
|
446
357
|
sig { params(short_sha: T::Boolean).returns(T.nilable(::Spoom::Git::Commit)) }
|
447
358
|
def git_last_commit(short_sha: T.unsafe(nil)); end
|
448
359
|
|
449
360
|
sig { params(arg: ::String).returns(::Spoom::ExecResult) }
|
450
361
|
def git_log(*arg); end
|
451
362
|
|
452
|
-
# Run `git push <remote> <ref>` in this context directory
|
453
363
|
sig { params(remote: ::String, ref: ::String, force: T::Boolean).returns(::Spoom::ExecResult) }
|
454
364
|
def git_push!(remote, ref, force: T.unsafe(nil)); end
|
455
365
|
|
456
366
|
sig { params(arg: ::String).returns(::Spoom::ExecResult) }
|
457
367
|
def git_show(*arg); end
|
458
368
|
|
459
|
-
# Is there uncommitted changes in this context directory?
|
460
369
|
sig { params(path: ::String).returns(T::Boolean) }
|
461
370
|
def git_workdir_clean?(path: T.unsafe(nil)); end
|
462
371
|
end
|
463
372
|
|
464
|
-
# Sorbet features for a context
|
465
373
|
module Spoom::Context::Sorbet
|
466
374
|
requires_ancestor { Spoom::Context }
|
467
375
|
|
468
|
-
# Does this context has a `sorbet/config` file?
|
469
376
|
sig { returns(T::Boolean) }
|
470
377
|
def has_sorbet_config?; end
|
471
378
|
|
472
|
-
# Read the strictness sigil from the file at `relative_path` (returns `nil` if no sigil)
|
473
379
|
sig { params(relative_path: ::String).returns(T.nilable(::String)) }
|
474
380
|
def read_file_strictness(relative_path); end
|
475
381
|
|
476
|
-
# Read the contents of `sorbet/config` in this context directory
|
477
382
|
sig { returns(::String) }
|
478
383
|
def read_sorbet_config; end
|
479
384
|
|
480
385
|
sig { returns(::Spoom::Sorbet::Config) }
|
481
386
|
def sorbet_config; end
|
482
387
|
|
483
|
-
# Get the commit introducing the `sorbet/config` file
|
484
388
|
sig { returns(T.nilable(::Spoom::Git::Commit)) }
|
485
389
|
def sorbet_intro_commit; end
|
486
390
|
|
487
|
-
# Get the commit removing the `sorbet/config` file
|
488
391
|
sig { returns(T.nilable(::Spoom::Git::Commit)) }
|
489
392
|
def sorbet_removal_commit; end
|
490
393
|
|
491
|
-
# Run `bundle exec srb` in this context directory
|
492
394
|
sig { params(arg: ::String, sorbet_bin: T.nilable(::String), capture_err: T::Boolean).returns(::Spoom::ExecResult) }
|
493
395
|
def srb(*arg, sorbet_bin: T.unsafe(nil), capture_err: T.unsafe(nil)); end
|
494
396
|
|
495
|
-
# List all files typechecked by Sorbet from its `config`
|
496
397
|
sig { params(with_config: T.nilable(::Spoom::Sorbet::Config), include_rbis: T::Boolean).returns(T::Array[::String]) }
|
497
398
|
def srb_files(with_config: T.unsafe(nil), include_rbis: T.unsafe(nil)); end
|
498
399
|
|
499
|
-
# List all files typechecked by Sorbet from its `config` that matches `strictness`
|
500
400
|
sig do
|
501
401
|
params(
|
502
402
|
strictness: ::String,
|
@@ -521,7 +421,6 @@ module Spoom::Context::Sorbet
|
|
521
421
|
sig { params(arg: ::String, sorbet_bin: T.nilable(::String), capture_err: T::Boolean).returns(T.nilable(::String)) }
|
522
422
|
def srb_version(*arg, sorbet_bin: T.unsafe(nil), capture_err: T.unsafe(nil)); end
|
523
423
|
|
524
|
-
# Set the `contents` of `sorbet/config` in this context directory
|
525
424
|
sig { params(contents: ::String, append: T::Boolean).void }
|
526
425
|
def write_sorbet_config!(contents, append: T.unsafe(nil)); end
|
527
426
|
end
|
@@ -557,7 +456,6 @@ class Spoom::Coverage::Cards::Card < ::Spoom::Coverage::Template
|
|
557
456
|
sig { params(template: ::String, title: T.nilable(::String), body: T.nilable(::String)).void }
|
558
457
|
def initialize(template: T.unsafe(nil), title: T.unsafe(nil), body: T.unsafe(nil)); end
|
559
458
|
|
560
|
-
# @return [String, nil]
|
561
459
|
def body; end
|
562
460
|
|
563
461
|
sig { returns(T.nilable(::String)) }
|
@@ -566,14 +464,12 @@ end
|
|
566
464
|
|
567
465
|
Spoom::Coverage::Cards::Card::TEMPLATE = T.let(T.unsafe(nil), String)
|
568
466
|
|
569
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
570
467
|
class Spoom::Coverage::Cards::Erb < ::Spoom::Coverage::Cards::Card
|
571
468
|
abstract!
|
572
469
|
|
573
470
|
sig { void }
|
574
471
|
def initialize; end
|
575
472
|
|
576
|
-
# @abstract
|
577
473
|
sig { abstract.returns(::String) }
|
578
474
|
def erb; end
|
579
475
|
|
@@ -665,7 +561,6 @@ module Spoom::Coverage::D3
|
|
665
561
|
end
|
666
562
|
end
|
667
563
|
|
668
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
669
564
|
class Spoom::Coverage::D3::Base
|
670
565
|
abstract!
|
671
566
|
|
@@ -678,7 +573,6 @@ class Spoom::Coverage::D3::Base
|
|
678
573
|
sig { returns(::String) }
|
679
574
|
def id; end
|
680
575
|
|
681
|
-
# @abstract
|
682
576
|
sig { abstract.returns(::String) }
|
683
577
|
def script; end
|
684
578
|
|
@@ -740,7 +634,6 @@ class Spoom::Coverage::D3::ColorPalette < ::T::Struct
|
|
740
634
|
end
|
741
635
|
end
|
742
636
|
|
743
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
744
637
|
class Spoom::Coverage::D3::Pie < ::Spoom::Coverage::D3::Base
|
745
638
|
abstract!
|
746
639
|
|
@@ -783,7 +676,6 @@ class Spoom::Coverage::D3::Pie::Sigs < ::Spoom::Coverage::D3::Pie
|
|
783
676
|
def tooltip; end
|
784
677
|
end
|
785
678
|
|
786
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
787
679
|
class Spoom::Coverage::D3::Timeline < ::Spoom::Coverage::D3::Base
|
788
680
|
abstract!
|
789
681
|
|
@@ -796,7 +688,6 @@ class Spoom::Coverage::D3::Timeline < ::Spoom::Coverage::D3::Base
|
|
796
688
|
sig { params(y: ::String, color: ::String, curve: ::String).returns(::String) }
|
797
689
|
def line(y:, color: T.unsafe(nil), curve: T.unsafe(nil)); end
|
798
690
|
|
799
|
-
# @abstract
|
800
691
|
sig { abstract.returns(::String) }
|
801
692
|
def plot; end
|
802
693
|
|
@@ -879,7 +770,6 @@ class Spoom::Coverage::D3::Timeline::Sigs < ::Spoom::Coverage::D3::Timeline::Sta
|
|
879
770
|
def tooltip; end
|
880
771
|
end
|
881
772
|
|
882
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
883
773
|
class Spoom::Coverage::D3::Timeline::Stacked < ::Spoom::Coverage::D3::Timeline
|
884
774
|
abstract!
|
885
775
|
|
@@ -904,7 +794,6 @@ class Spoom::Coverage::D3::Timeline::Versions < ::Spoom::Coverage::D3::Timeline
|
|
904
794
|
def tooltip; end
|
905
795
|
end
|
906
796
|
|
907
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
908
797
|
class Spoom::Coverage::Page < ::Spoom::Coverage::Template
|
909
798
|
abstract!
|
910
799
|
|
@@ -914,7 +803,6 @@ class Spoom::Coverage::Page < ::Spoom::Coverage::Template
|
|
914
803
|
sig { returns(::String) }
|
915
804
|
def body_html; end
|
916
805
|
|
917
|
-
# @abstract
|
918
806
|
sig { abstract.returns(T::Array[::Spoom::Coverage::Cards::Card]) }
|
919
807
|
def cards; end
|
920
808
|
|
@@ -999,7 +887,6 @@ class Spoom::Coverage::Snapshot < ::T::Struct
|
|
999
887
|
end
|
1000
888
|
end
|
1001
889
|
|
1002
|
-
# The strictness name as found in the Sorbet metrics file
|
1003
890
|
Spoom::Coverage::Snapshot::STRICTNESSES = T.let(T.unsafe(nil), Array)
|
1004
891
|
|
1005
892
|
class Spoom::Coverage::SnapshotPrinter < ::Spoom::Printer
|
@@ -1015,11 +902,9 @@ class Spoom::Coverage::SnapshotPrinter < ::Spoom::Printer
|
|
1015
902
|
def print_map(hash, total); end
|
1016
903
|
end
|
1017
904
|
|
1018
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
1019
905
|
class Spoom::Coverage::Template
|
1020
906
|
abstract!
|
1021
907
|
|
1022
|
-
# Create a new template from an Erb file path
|
1023
908
|
sig { params(template: ::String).void }
|
1024
909
|
def initialize(template:); end
|
1025
910
|
|
@@ -1046,7 +931,6 @@ end
|
|
1046
931
|
Spoom::Deadcode::DEFAULT_CUSTOM_PLUGINS_PATH = T.let(T.unsafe(nil), String)
|
1047
932
|
Spoom::Deadcode::DEFAULT_PLUGINS = T.let(T.unsafe(nil), Set)
|
1048
933
|
|
1049
|
-
# A definition is a class, module, method, constant, etc. being defined in the code
|
1050
934
|
class Spoom::Deadcode::Definition < ::T::Struct
|
1051
935
|
const :kind, ::Spoom::Deadcode::Definition::Kind
|
1052
936
|
const :name, ::String
|
@@ -1057,11 +941,9 @@ class Spoom::Deadcode::Definition < ::T::Struct
|
|
1057
941
|
sig { void }
|
1058
942
|
def alive!; end
|
1059
943
|
|
1060
|
-
# Status
|
1061
944
|
sig { returns(T::Boolean) }
|
1062
945
|
def alive?; end
|
1063
946
|
|
1064
|
-
# Kind
|
1065
947
|
sig { returns(T::Boolean) }
|
1066
948
|
def attr_reader?; end
|
1067
949
|
|
@@ -1089,7 +971,6 @@ class Spoom::Deadcode::Definition < ::T::Struct
|
|
1089
971
|
sig { returns(T::Boolean) }
|
1090
972
|
def module?; end
|
1091
973
|
|
1092
|
-
# Utils
|
1093
974
|
sig { params(args: T.untyped).returns(::String) }
|
1094
975
|
def to_json(*args); end
|
1095
976
|
|
@@ -1117,7 +998,6 @@ class Spoom::Deadcode::Definition::Status < ::T::Enum
|
|
1117
998
|
end
|
1118
999
|
end
|
1119
1000
|
|
1120
|
-
# Custom engine to handle ERB templates as used by Rails
|
1121
1001
|
class Spoom::Deadcode::ERB < ::Erubi::Engine
|
1122
1002
|
sig { params(input: T.untyped, properties: T.untyped).void }
|
1123
1003
|
def initialize(input, properties = T.unsafe(nil)); end
|
@@ -1161,13 +1041,9 @@ class Spoom::Deadcode::Index
|
|
1161
1041
|
sig { returns(T::Hash[::String, T::Array[::Spoom::Deadcode::Definition]]) }
|
1162
1042
|
def definitions; end
|
1163
1043
|
|
1164
|
-
# Utils
|
1165
1044
|
sig { params(name: ::String).returns(T::Array[::Spoom::Deadcode::Definition]) }
|
1166
1045
|
def definitions_for_name(name); end
|
1167
1046
|
|
1168
|
-
# Mark all definitions having a reference of the same name as `alive`
|
1169
|
-
#
|
1170
|
-
# To be called once all the files have been indexed and all the definitions and references discovered.
|
1171
1047
|
sig { void }
|
1172
1048
|
def finalize!; end
|
1173
1049
|
|
@@ -1177,7 +1053,6 @@ class Spoom::Deadcode::Index
|
|
1177
1053
|
sig { params(erb: ::String, file: ::String, plugins: T::Array[::Spoom::Deadcode::Plugins::Base]).void }
|
1178
1054
|
def index_erb(erb, file:, plugins: T.unsafe(nil)); end
|
1179
1055
|
|
1180
|
-
# Indexing
|
1181
1056
|
sig { params(file: ::String, plugins: T::Array[::Spoom::Deadcode::Plugins::Base]).void }
|
1182
1057
|
def index_file(file, plugins: T.unsafe(nil)); end
|
1183
1058
|
|
@@ -1267,7 +1142,6 @@ end
|
|
1267
1142
|
|
1268
1143
|
Spoom::Deadcode::Plugins::ActiveSupport::SETUP_AND_TEARDOWN_METHODS = T.let(T.unsafe(nil), Array)
|
1269
1144
|
|
1270
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
1271
1145
|
class Spoom::Deadcode::Plugins::Base
|
1272
1146
|
abstract!
|
1273
1147
|
|
@@ -1277,125 +1151,41 @@ class Spoom::Deadcode::Plugins::Base
|
|
1277
1151
|
sig { returns(::Spoom::Deadcode::Index) }
|
1278
1152
|
def index; end
|
1279
1153
|
|
1280
|
-
# Do not override this method, use `on_define_accessor` instead.
|
1281
1154
|
sig { params(definition: ::Spoom::Model::Attr).void }
|
1282
1155
|
def internal_on_define_accessor(definition); end
|
1283
1156
|
|
1284
|
-
# Do not override this method, use `on_define_class` instead.
|
1285
1157
|
sig { params(definition: ::Spoom::Model::Class).void }
|
1286
1158
|
def internal_on_define_class(definition); end
|
1287
1159
|
|
1288
|
-
# Do not override this method, use `on_define_constant` instead.
|
1289
1160
|
sig { params(definition: ::Spoom::Model::Constant).void }
|
1290
1161
|
def internal_on_define_constant(definition); end
|
1291
1162
|
|
1292
|
-
# Do not override this method, use `on_define_method` instead.
|
1293
1163
|
sig { params(definition: ::Spoom::Model::Method).void }
|
1294
1164
|
def internal_on_define_method(definition); end
|
1295
1165
|
|
1296
|
-
# Do not override this method, use `on_define_module` instead.
|
1297
1166
|
sig { params(definition: ::Spoom::Model::Module).void }
|
1298
1167
|
def internal_on_define_module(definition); end
|
1299
1168
|
|
1300
|
-
# Called when an accessor is defined.
|
1301
|
-
#
|
1302
|
-
# Will be called when the indexer processes a `attr_reader`, `attr_writer` or `attr_accessor` node.
|
1303
|
-
# Note that when this method is called, the definition for the node has already been added to the index.
|
1304
|
-
# It is still possible to ignore it from the plugin:
|
1305
|
-
#
|
1306
|
-
# ~~~rb
|
1307
|
-
# class MyPlugin < Spoom::Deadcode::Plugins::Base
|
1308
|
-
# def on_define_accessor(definition)
|
1309
|
-
# @index.ignore(definition) if symbol_def.name == "foo"
|
1310
|
-
# end
|
1311
|
-
# end
|
1312
|
-
# ~~~
|
1313
1169
|
sig { params(definition: ::Spoom::Model::Attr).void }
|
1314
1170
|
def on_define_accessor(definition); end
|
1315
1171
|
|
1316
|
-
# Called when a class is defined.
|
1317
|
-
#
|
1318
|
-
# Will be called when the indexer processes a `class` node.
|
1319
|
-
# Note that when this method is called, the definition for the node has already been added to the index.
|
1320
|
-
# It is still possible to ignore it from the plugin:
|
1321
|
-
#
|
1322
|
-
# ~~~rb
|
1323
|
-
# class MyPlugin < Spoom::Deadcode::Plugins::Base
|
1324
|
-
# def on_define_class(definition)
|
1325
|
-
# @index.ignore(definition) if definition.name == "Foo"
|
1326
|
-
# end
|
1327
|
-
# end
|
1328
|
-
# ~~~
|
1329
1172
|
sig { params(definition: ::Spoom::Model::Class).void }
|
1330
1173
|
def on_define_class(definition); end
|
1331
1174
|
|
1332
|
-
# Called when a constant is defined.
|
1333
|
-
#
|
1334
|
-
# Will be called when the indexer processes a `CONST =` node.
|
1335
|
-
# Note that when this method is called, the definition for the node has already been added to the index.
|
1336
|
-
# It is still possible to ignore it from the plugin:
|
1337
|
-
#
|
1338
|
-
# ~~~rb
|
1339
|
-
# class MyPlugin < Spoom::Deadcode::Plugins::Base
|
1340
|
-
# def on_define_constant(definition)
|
1341
|
-
# @index.ignore(definition) if definition.name == "FOO"
|
1342
|
-
# end
|
1343
|
-
# end
|
1344
|
-
# ~~~
|
1345
1175
|
sig { params(definition: ::Spoom::Model::Constant).void }
|
1346
1176
|
def on_define_constant(definition); end
|
1347
1177
|
|
1348
|
-
# Called when a method is defined.
|
1349
|
-
#
|
1350
|
-
# Will be called when the indexer processes a `def` or `defs` node.
|
1351
|
-
# Note that when this method is called, the definition for the node has already been added to the index.
|
1352
|
-
# It is still possible to ignore it from the plugin:
|
1353
|
-
#
|
1354
|
-
# ~~~rb
|
1355
|
-
# class MyPlugin < Spoom::Deadcode::Plugins::Base
|
1356
|
-
# def on_define_method(definition)
|
1357
|
-
# @index.ignore(definition) if definition.name == "foo"
|
1358
|
-
# end
|
1359
|
-
# end
|
1360
|
-
# ~~~
|
1361
1178
|
sig { params(definition: ::Spoom::Model::Method).void }
|
1362
1179
|
def on_define_method(definition); end
|
1363
1180
|
|
1364
|
-
# Called when a module is defined.
|
1365
|
-
#
|
1366
|
-
# Will be called when the indexer processes a `module` node.
|
1367
|
-
# Note that when this method is called, the definition for the node has already been added to the index.
|
1368
|
-
# It is still possible to ignore it from the plugin:
|
1369
|
-
#
|
1370
|
-
# ~~~rb
|
1371
|
-
# class MyPlugin < Spoom::Deadcode::Plugins::Base
|
1372
|
-
# def on_define_module(definition)
|
1373
|
-
# @index.ignore(definition) if definition.name == "Foo"
|
1374
|
-
# end
|
1375
|
-
# end
|
1376
|
-
# ~~~
|
1377
1181
|
sig { params(definition: ::Spoom::Model::Module).void }
|
1378
1182
|
def on_define_module(definition); end
|
1379
1183
|
|
1380
|
-
# Called when a send is being processed
|
1381
|
-
#
|
1382
|
-
# ~~~rb
|
1383
|
-
# class MyPlugin < Spoom::Deadcode::Plugins::Base
|
1384
|
-
# def on_send(send)
|
1385
|
-
# return unless send.name == "dsl_method"
|
1386
|
-
# return if send.args.empty?
|
1387
|
-
#
|
1388
|
-
# method_name = send.args.first.slice.delete_prefix(":")
|
1389
|
-
# @index.reference_method(method_name, send.node, send.loc)
|
1390
|
-
# end
|
1391
|
-
# end
|
1392
|
-
# ~~~
|
1393
1184
|
sig { params(send: ::Spoom::Deadcode::Send).void }
|
1394
1185
|
def on_send(send); end
|
1395
1186
|
|
1396
1187
|
private
|
1397
1188
|
|
1398
|
-
# Plugin utils
|
1399
1189
|
sig { params(name: ::String).returns(::String) }
|
1400
1190
|
def camelize(name); end
|
1401
1191
|
|
@@ -1423,88 +1213,22 @@ class Spoom::Deadcode::Plugins::Base
|
|
1423
1213
|
sig { params(const: ::Symbol).returns(T::Array[::Regexp]) }
|
1424
1214
|
def patterns(const); end
|
1425
1215
|
|
1426
|
-
# DSL support
|
1427
1216
|
sig { params(definition: ::Spoom::Model::Namespace, superclass_name: ::String).returns(T::Boolean) }
|
1428
1217
|
def subclass_of?(definition, superclass_name); end
|
1429
1218
|
|
1430
1219
|
class << self
|
1431
|
-
# Mark classes directly subclassing a class matching `names` as ignored.
|
1432
|
-
#
|
1433
|
-
# Names can be either strings or regexps:
|
1434
|
-
#
|
1435
|
-
# ~~~rb
|
1436
|
-
# class MyPlugin < Spoom::Deadcode::Plugins::Base
|
1437
|
-
# ignore_classes_inheriting_from(
|
1438
|
-
# "Foo",
|
1439
|
-
# "Bar",
|
1440
|
-
# /Baz.*/,
|
1441
|
-
# )
|
1442
|
-
# end
|
1443
|
-
# ~~~
|
1444
1220
|
sig { params(names: T.any(::Regexp, ::String)).void }
|
1445
1221
|
def ignore_classes_inheriting_from(*names); end
|
1446
1222
|
|
1447
|
-
# Mark classes matching `names` as ignored.
|
1448
|
-
#
|
1449
|
-
# Names can be either strings or regexps:
|
1450
|
-
#
|
1451
|
-
# ~~~rb
|
1452
|
-
# class MyPlugin < Spoom::Deadcode::Plugins::Base
|
1453
|
-
# ignore_class_names(
|
1454
|
-
# "Foo",
|
1455
|
-
# "Bar",
|
1456
|
-
# /Baz.*/,
|
1457
|
-
# )
|
1458
|
-
# end
|
1459
|
-
# ~~~
|
1460
1223
|
sig { params(names: T.any(::Regexp, ::String)).void }
|
1461
1224
|
def ignore_classes_named(*names); end
|
1462
1225
|
|
1463
|
-
# Mark constants matching `names` as ignored.
|
1464
|
-
#
|
1465
|
-
# Names can be either strings or regexps:
|
1466
|
-
#
|
1467
|
-
# ~~~rb
|
1468
|
-
# class MyPlugin < Spoom::Deadcode::Plugins::Base
|
1469
|
-
# ignore_class_names(
|
1470
|
-
# "FOO",
|
1471
|
-
# "BAR",
|
1472
|
-
# /BAZ.*/,
|
1473
|
-
# )
|
1474
|
-
# end
|
1475
|
-
# ~~~
|
1476
1226
|
sig { params(names: T.any(::Regexp, ::String)).void }
|
1477
1227
|
def ignore_constants_named(*names); end
|
1478
1228
|
|
1479
|
-
# Mark methods matching `names` as ignored.
|
1480
|
-
#
|
1481
|
-
# Names can be either strings or regexps:
|
1482
|
-
#
|
1483
|
-
# ~~~rb
|
1484
|
-
# class MyPlugin < Spoom::Deadcode::Plugins::Base
|
1485
|
-
# ignore_method_names(
|
1486
|
-
# "foo",
|
1487
|
-
# "bar",
|
1488
|
-
# /baz.*/,
|
1489
|
-
# )
|
1490
|
-
# end
|
1491
|
-
# ~~~
|
1492
1229
|
sig { params(names: T.any(::Regexp, ::String)).void }
|
1493
1230
|
def ignore_methods_named(*names); end
|
1494
1231
|
|
1495
|
-
# Mark modules matching `names` as ignored.
|
1496
|
-
#
|
1497
|
-
# Names can be either strings or regexps:
|
1498
|
-
#
|
1499
|
-
# ~~~rb
|
1500
|
-
# class MyPlugin < Spoom::Deadcode::Plugins::Base
|
1501
|
-
# ignore_class_names(
|
1502
|
-
# "Foo",
|
1503
|
-
# "Bar",
|
1504
|
-
# /Baz.*/,
|
1505
|
-
# )
|
1506
|
-
# end
|
1507
|
-
# ~~~
|
1508
1232
|
sig { params(names: T.any(::Regexp, ::String)).void }
|
1509
1233
|
def ignore_modules_named(*names); end
|
1510
1234
|
|
@@ -1644,31 +1368,26 @@ class Spoom::Deadcode::Remover::NodeContext
|
|
1644
1368
|
sig { returns(T::Array[::Prism::Node]) }
|
1645
1369
|
def nesting; end
|
1646
1370
|
|
1647
|
-
# @return [Array<Prism::Node>]
|
1648
1371
|
def nesting=(_arg0); end
|
1649
1372
|
|
1650
1373
|
sig { returns(T.nilable(::Prism::Node)) }
|
1651
1374
|
def next_node; end
|
1652
1375
|
|
1653
|
-
# @raise [Error]
|
1654
1376
|
sig { returns(T::Array[::Prism::Node]) }
|
1655
1377
|
def next_nodes; end
|
1656
1378
|
|
1657
1379
|
sig { returns(::Prism::Node) }
|
1658
1380
|
def node; end
|
1659
1381
|
|
1660
|
-
# @raise [Error]
|
1661
1382
|
sig { returns(::Spoom::Deadcode::Remover::NodeContext) }
|
1662
1383
|
def parent_context; end
|
1663
1384
|
|
1664
|
-
# @raise [Error]
|
1665
1385
|
sig { returns(::Prism::Node) }
|
1666
1386
|
def parent_node; end
|
1667
1387
|
|
1668
1388
|
sig { returns(T.nilable(::Prism::Node)) }
|
1669
1389
|
def previous_node; end
|
1670
1390
|
|
1671
|
-
# @raise [Error]
|
1672
1391
|
sig { returns(T::Array[::Prism::Node]) }
|
1673
1392
|
def previous_nodes; end
|
1674
1393
|
|
@@ -1765,7 +1484,6 @@ class Spoom::Deadcode::Remover::NodeRemover
|
|
1765
1484
|
def transform_sig(node, name:, kind:); end
|
1766
1485
|
end
|
1767
1486
|
|
1768
|
-
# An abstraction to simplify handling of Prism::CallNode nodes.
|
1769
1487
|
class Spoom::Deadcode::Send < ::T::Struct
|
1770
1488
|
const :node, ::Prism::CallNode
|
1771
1489
|
const :name, ::String
|
@@ -1808,14 +1526,6 @@ class Spoom::ExecResult < ::T::Struct
|
|
1808
1526
|
end
|
1809
1527
|
|
1810
1528
|
class Spoom::FileCollector
|
1811
|
-
# Initialize a new file collector
|
1812
|
-
#
|
1813
|
-
# If `allow_extensions` is empty, all files are collected.
|
1814
|
-
# If `allow_extensions` is an array of extensions, only files with one of these extensions are collected.
|
1815
|
-
#
|
1816
|
-
# If `allow_mime_types` is empty, all files are collected.
|
1817
|
-
# If `allow_mime_types` is an array of mimetypes, files without an extension are collected if their mimetype is in
|
1818
|
-
# the list.
|
1819
1529
|
sig do
|
1820
1530
|
params(
|
1821
1531
|
allow_extensions: T::Array[::String],
|
@@ -1855,46 +1565,35 @@ class Spoom::FileCollector
|
|
1855
1565
|
def visit_file(path); end
|
1856
1566
|
end
|
1857
1567
|
|
1858
|
-
# Build a file hierarchy from a set of file paths.
|
1859
1568
|
class Spoom::FileTree
|
1860
1569
|
sig { params(paths: T::Enumerable[::String]).void }
|
1861
1570
|
def initialize(paths = T.unsafe(nil)); end
|
1862
1571
|
|
1863
|
-
# Add a `path` to the tree
|
1864
|
-
#
|
1865
|
-
# This will create all nodes until the root of `path`.
|
1866
1572
|
sig { params(path: ::String).returns(::Spoom::FileTree::Node) }
|
1867
1573
|
def add_path(path); end
|
1868
1574
|
|
1869
|
-
# Add all `paths` to the tree
|
1870
1575
|
sig { params(paths: T::Enumerable[::String]).void }
|
1871
1576
|
def add_paths(paths); end
|
1872
1577
|
|
1873
|
-
# All the nodes in this tree
|
1874
1578
|
sig { returns(T::Array[::Spoom::FileTree::Node]) }
|
1875
1579
|
def nodes; end
|
1876
1580
|
|
1877
|
-
# Return a map of typing scores for each node in the tree
|
1878
1581
|
sig { params(context: ::Spoom::Context).returns(T::Hash[::Spoom::FileTree::Node, ::Float]) }
|
1879
1582
|
def nodes_strictness_scores(context); end
|
1880
1583
|
|
1881
|
-
# All the paths in this tree
|
1882
1584
|
sig { returns(T::Array[::String]) }
|
1883
1585
|
def paths; end
|
1884
1586
|
|
1885
|
-
# Return a map of typing scores for each path in the tree
|
1886
1587
|
sig { params(context: ::Spoom::Context).returns(T::Hash[::String, ::Float]) }
|
1887
1588
|
def paths_strictness_scores(context); end
|
1888
1589
|
|
1889
1590
|
sig { params(out: T.any(::IO, ::StringIO), colors: T::Boolean).void }
|
1890
1591
|
def print(out: T.unsafe(nil), colors: T.unsafe(nil)); end
|
1891
1592
|
|
1892
|
-
# All root nodes
|
1893
1593
|
sig { returns(T::Array[::Spoom::FileTree::Node]) }
|
1894
1594
|
def roots; end
|
1895
1595
|
end
|
1896
1596
|
|
1897
|
-
# A visitor that collects all the nodes in a tree
|
1898
1597
|
class Spoom::FileTree::CollectNodes < ::Spoom::FileTree::Visitor
|
1899
1598
|
sig { void }
|
1900
1599
|
def initialize; end
|
@@ -1906,7 +1605,6 @@ class Spoom::FileTree::CollectNodes < ::Spoom::FileTree::Visitor
|
|
1906
1605
|
def visit_node(node); end
|
1907
1606
|
end
|
1908
1607
|
|
1909
|
-
# A visitor that collects the typing score of each node in a tree
|
1910
1608
|
class Spoom::FileTree::CollectScores < ::Spoom::FileTree::CollectStrictnesses
|
1911
1609
|
sig { params(context: ::Spoom::Context).void }
|
1912
1610
|
def initialize(context); end
|
@@ -1926,7 +1624,6 @@ class Spoom::FileTree::CollectScores < ::Spoom::FileTree::CollectStrictnesses
|
|
1926
1624
|
def strictness_score(strictness); end
|
1927
1625
|
end
|
1928
1626
|
|
1929
|
-
# A visitor that collects the strictness of each node in a tree
|
1930
1627
|
class Spoom::FileTree::CollectStrictnesses < ::Spoom::FileTree::Visitor
|
1931
1628
|
sig { params(context: ::Spoom::Context).void }
|
1932
1629
|
def initialize(context); end
|
@@ -1938,13 +1635,11 @@ class Spoom::FileTree::CollectStrictnesses < ::Spoom::FileTree::Visitor
|
|
1938
1635
|
def visit_node(node); end
|
1939
1636
|
end
|
1940
1637
|
|
1941
|
-
# A node representing either a file or a directory inside a FileTree
|
1942
1638
|
class Spoom::FileTree::Node < ::T::Struct
|
1943
1639
|
const :parent, T.nilable(::Spoom::FileTree::Node)
|
1944
1640
|
const :name, ::String
|
1945
1641
|
const :children, T::Hash[::String, ::Spoom::FileTree::Node], default: T.unsafe(nil)
|
1946
1642
|
|
1947
|
-
# Full path to this node from root
|
1948
1643
|
sig { returns(::String) }
|
1949
1644
|
def path; end
|
1950
1645
|
|
@@ -1953,9 +1648,6 @@ class Spoom::FileTree::Node < ::T::Struct
|
|
1953
1648
|
end
|
1954
1649
|
end
|
1955
1650
|
|
1956
|
-
# An internal class used to print a FileTree
|
1957
|
-
#
|
1958
|
-
# See `FileTree#print`
|
1959
1651
|
class Spoom::FileTree::Printer < ::Spoom::FileTree::Visitor
|
1960
1652
|
sig do
|
1961
1653
|
params(
|
@@ -1975,9 +1667,6 @@ class Spoom::FileTree::Printer < ::Spoom::FileTree::Visitor
|
|
1975
1667
|
def strictness_color(strictness); end
|
1976
1668
|
end
|
1977
1669
|
|
1978
|
-
# An abstract visitor for FileTree
|
1979
|
-
#
|
1980
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
1981
1670
|
class Spoom::FileTree::Visitor
|
1982
1671
|
abstract!
|
1983
1672
|
|
@@ -2003,7 +1692,6 @@ class Spoom::Git::Commit < ::T::Struct
|
|
2003
1692
|
class << self
|
2004
1693
|
def inherited(s); end
|
2005
1694
|
|
2006
|
-
# Parse a line formatted as `%h %at` into a `Commit`
|
2007
1695
|
sig { params(string: ::String).returns(T.nilable(::Spoom::Git::Commit)) }
|
2008
1696
|
def parse_line(string); end
|
2009
1697
|
end
|
@@ -2030,16 +1718,12 @@ class Spoom::LSP::Client
|
|
2030
1718
|
sig { returns(::Integer) }
|
2031
1719
|
def next_id; end
|
2032
1720
|
|
2033
|
-
# LSP requests
|
2034
|
-
#
|
2035
|
-
# @raise [Error::AlreadyOpen]
|
2036
1721
|
sig { params(workspace_path: ::String).void }
|
2037
1722
|
def open(workspace_path); end
|
2038
1723
|
|
2039
1724
|
sig { returns(T.nilable(T::Hash[T.untyped, T.untyped])) }
|
2040
1725
|
def read; end
|
2041
1726
|
|
2042
|
-
# @raise [Error::BadHeaders]
|
2043
1727
|
sig { returns(T.nilable(::String)) }
|
2044
1728
|
def read_raw; end
|
2045
1729
|
|
@@ -2179,9 +1863,6 @@ class Spoom::LSP::Location < ::T::Struct
|
|
2179
1863
|
end
|
2180
1864
|
end
|
2181
1865
|
|
2182
|
-
# A general message as defined by JSON-RPC.
|
2183
|
-
#
|
2184
|
-
# The language server protocol always uses `"2.0"` as the `jsonrpc` version.
|
2185
1866
|
class Spoom::LSP::Message
|
2186
1867
|
sig { void }
|
2187
1868
|
def initialize; end
|
@@ -2193,9 +1874,6 @@ class Spoom::LSP::Message
|
|
2193
1874
|
def to_json(*args); end
|
2194
1875
|
end
|
2195
1876
|
|
2196
|
-
# A notification message.
|
2197
|
-
#
|
2198
|
-
# A processed notification message must not send a response back. They work like events.
|
2199
1877
|
class Spoom::LSP::Notification < ::Spoom::LSP::Message
|
2200
1878
|
sig { params(method: ::String, params: T::Hash[T.untyped, T.untyped]).void }
|
2201
1879
|
def initialize(method, params); end
|
@@ -2227,11 +1905,9 @@ class Spoom::LSP::Position < ::T::Struct
|
|
2227
1905
|
end
|
2228
1906
|
end
|
2229
1907
|
|
2230
|
-
# @abstract Subclasses must implement the `abstract` methods below.
|
2231
1908
|
module Spoom::LSP::PrintableSymbol
|
2232
1909
|
interface!
|
2233
1910
|
|
2234
|
-
# @abstract
|
2235
1911
|
sig { abstract.params(printer: ::Spoom::LSP::SymbolPrinter).void }
|
2236
1912
|
def accept_printer(printer); end
|
2237
1913
|
end
|
@@ -2256,9 +1932,6 @@ class Spoom::LSP::Range < ::T::Struct
|
|
2256
1932
|
end
|
2257
1933
|
end
|
2258
1934
|
|
2259
|
-
# A request message to describe a request between the client and the server.
|
2260
|
-
#
|
2261
|
-
# Every processed request must send a response back to the sender of the request.
|
2262
1935
|
class Spoom::LSP::Request < ::Spoom::LSP::Message
|
2263
1936
|
sig { params(id: ::Integer, method: ::String, params: T::Hash[T.untyped, T.untyped]).void }
|
2264
1937
|
def initialize(id, method, params); end
|
@@ -2324,7 +1997,6 @@ class Spoom::LSP::SymbolPrinter < ::Spoom::Printer
|
|
2324
1997
|
sig { returns(T.nilable(::String)) }
|
2325
1998
|
def prefix; end
|
2326
1999
|
|
2327
|
-
# @return [String, nil]
|
2328
2000
|
def prefix=(_arg0); end
|
2329
2001
|
|
2330
2002
|
sig { params(objects: T::Array[::Spoom::LSP::PrintableSymbol]).void }
|
@@ -2343,7 +2015,6 @@ end
|
|
2343
2015
|
class Spoom::Location
|
2344
2016
|
include ::Comparable
|
2345
2017
|
|
2346
|
-
# @raise [LocationError]
|
2347
2018
|
sig do
|
2348
2019
|
params(
|
2349
2020
|
file: ::String,
|
@@ -2358,10 +2029,7 @@ class Spoom::Location
|
|
2358
2029
|
sig { override.params(other: ::BasicObject).returns(T.nilable(::Integer)) }
|
2359
2030
|
def <=>(other); end
|
2360
2031
|
|
2361
|
-
# @return [Integer, nil]
|
2362
2032
|
def end_column; end
|
2363
|
-
|
2364
|
-
# @return [Integer, nil]
|
2365
2033
|
def end_line; end
|
2366
2034
|
|
2367
2035
|
sig { returns(::String) }
|
@@ -2370,7 +2038,6 @@ class Spoom::Location
|
|
2370
2038
|
sig { params(other: ::Spoom::Location).returns(T::Boolean) }
|
2371
2039
|
def include?(other); end
|
2372
2040
|
|
2373
|
-
# @return [Integer, nil]
|
2374
2041
|
def start_column; end
|
2375
2042
|
|
2376
2043
|
sig { returns(T.nilable(::Integer)) }
|
@@ -2383,7 +2050,6 @@ class Spoom::Location
|
|
2383
2050
|
sig { params(file: ::String, location: ::Prism::Location).returns(::Spoom::Location) }
|
2384
2051
|
def from_prism(file, location); end
|
2385
2052
|
|
2386
|
-
# @raise [LocationError]
|
2387
2053
|
sig { params(location_string: ::String).returns(::Spoom::Location) }
|
2388
2054
|
def from_string(location_string); end
|
2389
2055
|
end
|
@@ -2395,20 +2061,12 @@ class Spoom::Model
|
|
2395
2061
|
sig { void }
|
2396
2062
|
def initialize; end
|
2397
2063
|
|
2398
|
-
# Get a symbol by it's full name
|
2399
|
-
#
|
2400
|
-
# Raises an error if the symbol is not found
|
2401
|
-
#
|
2402
|
-
# @raise [Error]
|
2403
2064
|
sig { params(full_name: ::String).returns(::Spoom::Model::Symbol) }
|
2404
2065
|
def [](full_name); end
|
2405
2066
|
|
2406
2067
|
sig { void }
|
2407
2068
|
def finalize!; end
|
2408
2069
|
|
2409
|
-
# Register a new symbol by it's full name
|
2410
|
-
#
|
2411
|
-
# If the symbol already exists, it will be returned.
|
2412
2070
|
sig { params(full_name: ::String).returns(::Spoom::Model::Symbol) }
|
2413
2071
|
def register_symbol(full_name); end
|
2414
2072
|
|
@@ -2421,7 +2079,6 @@ class Spoom::Model
|
|
2421
2079
|
sig { params(symbol: ::Spoom::Model::Symbol).returns(T::Array[::Spoom::Model::Symbol]) }
|
2422
2080
|
def supertypes(symbol); end
|
2423
2081
|
|
2424
|
-
# All the symbols registered in this model
|
2425
2082
|
sig { returns(T::Hash[::String, ::Spoom::Model::Symbol]) }
|
2426
2083
|
def symbols; end
|
2427
2084
|
|
@@ -2434,7 +2091,6 @@ class Spoom::Model
|
|
2434
2091
|
def compute_symbols_hierarchy!; end
|
2435
2092
|
end
|
2436
2093
|
|
2437
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
2438
2094
|
class Spoom::Model::Attr < ::Spoom::Model::Property
|
2439
2095
|
abstract!
|
2440
2096
|
end
|
@@ -2443,7 +2099,6 @@ class Spoom::Model::AttrAccessor < ::Spoom::Model::Attr; end
|
|
2443
2099
|
class Spoom::Model::AttrReader < ::Spoom::Model::Attr; end
|
2444
2100
|
class Spoom::Model::AttrWriter < ::Spoom::Model::Attr; end
|
2445
2101
|
|
2446
|
-
# Populate a Model by visiting the nodes from a Ruby file
|
2447
2102
|
class Spoom::Model::Builder < ::Spoom::Model::NamespaceVisitor
|
2448
2103
|
sig { params(model: ::Spoom::Model, file: ::String, comments: T::Array[::Prism::Comment]).void }
|
2449
2104
|
def initialize(model, file, comments:); end
|
@@ -2502,7 +2157,6 @@ class Spoom::Model::Class < ::Spoom::Model::Namespace
|
|
2502
2157
|
sig { returns(T.nilable(::String)) }
|
2503
2158
|
def superclass_name; end
|
2504
2159
|
|
2505
|
-
# @return [String, nil]
|
2506
2160
|
def superclass_name=(_arg0); end
|
2507
2161
|
end
|
2508
2162
|
|
@@ -2538,9 +2192,6 @@ class Spoom::Model::Extend < ::Spoom::Model::Mixin; end
|
|
2538
2192
|
class Spoom::Model::Include < ::Spoom::Model::Mixin; end
|
2539
2193
|
class Spoom::Model::Method < ::Spoom::Model::Property; end
|
2540
2194
|
|
2541
|
-
# A mixin (include, prepend, extend) to a namespace
|
2542
|
-
#
|
2543
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
2544
2195
|
class Spoom::Model::Mixin
|
2545
2196
|
abstract!
|
2546
2197
|
|
@@ -2553,9 +2204,6 @@ end
|
|
2553
2204
|
|
2554
2205
|
class Spoom::Model::Module < ::Spoom::Model::Namespace; end
|
2555
2206
|
|
2556
|
-
# A class or module
|
2557
|
-
#
|
2558
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
2559
2207
|
class Spoom::Model::Namespace < ::Spoom::Model::SymbolDef
|
2560
2208
|
abstract!
|
2561
2209
|
|
@@ -2576,7 +2224,6 @@ class Spoom::Model::Namespace < ::Spoom::Model::SymbolDef
|
|
2576
2224
|
def mixins; end
|
2577
2225
|
end
|
2578
2226
|
|
2579
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
2580
2227
|
class Spoom::Model::NamespaceVisitor < ::Spoom::Visitor
|
2581
2228
|
abstract!
|
2582
2229
|
|
@@ -2589,9 +2236,6 @@ end
|
|
2589
2236
|
|
2590
2237
|
class Spoom::Model::Prepend < ::Spoom::Model::Mixin; end
|
2591
2238
|
|
2592
|
-
# A method or an attribute accessor
|
2593
|
-
#
|
2594
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
2595
2239
|
class Spoom::Model::Property < ::Spoom::Model::SymbolDef
|
2596
2240
|
abstract!
|
2597
2241
|
|
@@ -2614,10 +2258,6 @@ class Spoom::Model::Property < ::Spoom::Model::SymbolDef
|
|
2614
2258
|
def visibility; end
|
2615
2259
|
end
|
2616
2260
|
|
2617
|
-
# A reference to something that looks like a constant or a method
|
2618
|
-
#
|
2619
|
-
# Constants could be classes, modules, or actual constants.
|
2620
|
-
# Methods could be accessors, instance or class methods, aliases, etc.
|
2621
2261
|
class Spoom::Model::Reference < ::T::Struct
|
2622
2262
|
const :kind, ::Spoom::Model::Reference::Kind
|
2623
2263
|
const :name, ::String
|
@@ -2647,7 +2287,6 @@ class Spoom::Model::Reference::Kind < ::T::Enum
|
|
2647
2287
|
end
|
2648
2288
|
end
|
2649
2289
|
|
2650
|
-
# Visit a file to collect all the references to constants and methods
|
2651
2290
|
class Spoom::Model::ReferencesVisitor < ::Spoom::Visitor
|
2652
2291
|
sig { params(file: ::String).void }
|
2653
2292
|
def initialize(file); end
|
@@ -2733,7 +2372,6 @@ class Spoom::Model::ReferencesVisitor < ::Spoom::Visitor
|
|
2733
2372
|
def reference_method(name, node); end
|
2734
2373
|
end
|
2735
2374
|
|
2736
|
-
# A Sorbet signature (sig block)
|
2737
2375
|
class Spoom::Model::Sig
|
2738
2376
|
sig { params(string: ::String).void }
|
2739
2377
|
def initialize(string); end
|
@@ -2744,24 +2382,16 @@ end
|
|
2744
2382
|
|
2745
2383
|
class Spoom::Model::SingletonClass < ::Spoom::Model::Namespace; end
|
2746
2384
|
|
2747
|
-
# A Symbol is a uniquely named entity in the Ruby codebase
|
2748
|
-
#
|
2749
|
-
# A symbol can have multiple definitions, e.g. a class can be reopened.
|
2750
|
-
# Sometimes a symbol can have multiple definitions of different types,
|
2751
|
-
# e.g. `foo` method can be defined both as a method and as an attribute accessor.
|
2752
2385
|
class Spoom::Model::Symbol
|
2753
2386
|
sig { params(full_name: ::String).void }
|
2754
2387
|
def initialize(full_name); end
|
2755
2388
|
|
2756
|
-
# The definitions of this symbol (where it exists in the code)
|
2757
2389
|
sig { returns(T::Array[::Spoom::Model::SymbolDef]) }
|
2758
2390
|
def definitions; end
|
2759
2391
|
|
2760
|
-
# The full, unique name of this symbol
|
2761
2392
|
sig { returns(::String) }
|
2762
2393
|
def full_name; end
|
2763
2394
|
|
2764
|
-
# The short name of this symbol
|
2765
2395
|
sig { returns(::String) }
|
2766
2396
|
def name; end
|
2767
2397
|
|
@@ -2769,12 +2399,6 @@ class Spoom::Model::Symbol
|
|
2769
2399
|
def to_s; end
|
2770
2400
|
end
|
2771
2401
|
|
2772
|
-
# A SymbolDef is a definition of a Symbol
|
2773
|
-
#
|
2774
|
-
# It can be a class, module, constant, method, etc.
|
2775
|
-
# A SymbolDef has a location pointing to the actual code that defines the symbol.
|
2776
|
-
#
|
2777
|
-
# @abstract It cannot be directly instantiated. Subclasses must implement the `abstract` methods below.
|
2778
2402
|
class Spoom::Model::SymbolDef
|
2779
2403
|
abstract!
|
2780
2404
|
|
@@ -2788,27 +2412,21 @@ class Spoom::Model::SymbolDef
|
|
2788
2412
|
end
|
2789
2413
|
def initialize(symbol, owner:, location:, comments:); end
|
2790
2414
|
|
2791
|
-
# The comments associated with this definition
|
2792
2415
|
sig { returns(T::Array[::Spoom::Model::Comment]) }
|
2793
2416
|
def comments; end
|
2794
2417
|
|
2795
|
-
# The full name of the symbol this definition belongs to
|
2796
2418
|
sig { returns(::String) }
|
2797
2419
|
def full_name; end
|
2798
2420
|
|
2799
|
-
# The actual code location of this definition
|
2800
2421
|
sig { returns(::Spoom::Location) }
|
2801
2422
|
def location; end
|
2802
2423
|
|
2803
|
-
# The short name of the symbol this definition belongs to
|
2804
2424
|
sig { returns(::String) }
|
2805
2425
|
def name; end
|
2806
2426
|
|
2807
|
-
# The enclosing namespace this definition belongs to
|
2808
2427
|
sig { returns(T.nilable(::Spoom::Model::Namespace)) }
|
2809
2428
|
def owner; end
|
2810
2429
|
|
2811
|
-
# The symbol this definition belongs to
|
2812
2430
|
sig { returns(::Spoom::Model::Symbol) }
|
2813
2431
|
def symbol; end
|
2814
2432
|
end
|
@@ -2828,10 +2446,6 @@ end
|
|
2828
2446
|
|
2829
2447
|
class Spoom::ParseError < ::Spoom::Error; end
|
2830
2448
|
|
2831
|
-
# A Poset is a set of elements with a partial order relation.
|
2832
|
-
#
|
2833
|
-
# The partial order relation is a binary relation that is reflexive, antisymmetric, and transitive.
|
2834
|
-
# It can be used to represent a hierarchy of classes or modules, the dependencies between gems, etc.
|
2835
2449
|
class Spoom::Poset
|
2836
2450
|
extend T::Generic
|
2837
2451
|
|
@@ -2840,48 +2454,31 @@ class Spoom::Poset
|
|
2840
2454
|
sig { void }
|
2841
2455
|
def initialize; end
|
2842
2456
|
|
2843
|
-
# Get the POSet element for a given value
|
2844
|
-
#
|
2845
|
-
# Raises if the element is not found
|
2846
|
-
#
|
2847
|
-
# @raise [Error]
|
2848
2457
|
sig { params(value: E).returns(Spoom::Poset::Element[E]) }
|
2849
2458
|
def [](value); end
|
2850
2459
|
|
2851
|
-
# Add a direct edge from one element to another
|
2852
|
-
#
|
2853
|
-
# Transitive edges (transitive closure) are automatically computed.
|
2854
|
-
# Adds the elements if they don't exist.
|
2855
|
-
# If the direct edge already exists, nothing is done.
|
2856
2460
|
sig { params(from: E, to: E).void }
|
2857
2461
|
def add_direct_edge(from, to); end
|
2858
2462
|
|
2859
|
-
# Add an element to the POSet
|
2860
2463
|
sig { params(value: E).returns(Spoom::Poset::Element[E]) }
|
2861
2464
|
def add_element(value); end
|
2862
2465
|
|
2863
|
-
# Is there a direct edge from `from` to `to`?
|
2864
2466
|
sig { params(from: E, to: E).returns(T::Boolean) }
|
2865
2467
|
def direct_edge?(from, to); end
|
2866
2468
|
|
2867
|
-
# Is there an edge (direct or indirect) from `from` to `to`?
|
2868
2469
|
sig { params(from: E, to: E).returns(T::Boolean) }
|
2869
2470
|
def edge?(from, to); end
|
2870
2471
|
|
2871
|
-
# Is the given value a element in the POSet?
|
2872
2472
|
sig { params(value: E).returns(T::Boolean) }
|
2873
2473
|
def element?(value); end
|
2874
2474
|
|
2875
|
-
# Show the POSet as a DOT graph using xdot (used for debugging)
|
2876
2475
|
sig { params(direct: T::Boolean, transitive: T::Boolean).void }
|
2877
2476
|
def show_dot(direct: T.unsafe(nil), transitive: T.unsafe(nil)); end
|
2878
2477
|
|
2879
|
-
# Return the POSet as a DOT graph
|
2880
2478
|
sig { params(direct: T::Boolean, transitive: T::Boolean).returns(::String) }
|
2881
2479
|
def to_dot(direct: T.unsafe(nil), transitive: T.unsafe(nil)); end
|
2882
2480
|
end
|
2883
2481
|
|
2884
|
-
# An element in a POSet
|
2885
2482
|
class Spoom::Poset::Element
|
2886
2483
|
extend T::Generic
|
2887
2484
|
include ::Comparable
|
@@ -2894,42 +2491,27 @@ class Spoom::Poset::Element
|
|
2894
2491
|
sig { params(other: T.untyped).returns(T.nilable(::Integer)) }
|
2895
2492
|
def <=>(other); end
|
2896
2493
|
|
2897
|
-
# Direct and indirect ancestors of this element
|
2898
2494
|
sig { returns(T::Array[E]) }
|
2899
2495
|
def ancestors; end
|
2900
2496
|
|
2901
|
-
# Direct children of this element
|
2902
2497
|
sig { returns(T::Array[E]) }
|
2903
2498
|
def children; end
|
2904
2499
|
|
2905
|
-
# Direct and indirect descendants of this element
|
2906
2500
|
sig { returns(T::Array[E]) }
|
2907
2501
|
def descendants; end
|
2908
2502
|
|
2909
|
-
# Edges (direct and indirect) from this element to other elements in the same POSet
|
2910
|
-
#
|
2911
|
-
# @return [Set<Element[E]>]
|
2912
2503
|
def dfroms; end
|
2913
2504
|
|
2914
|
-
# Edges (direct and indirect) from this element to other elements in the same POSet
|
2915
2505
|
sig { returns(T::Set[Spoom::Poset::Element[E]]) }
|
2916
2506
|
def dtos; end
|
2917
2507
|
|
2918
|
-
# Edges (direct and indirect) from this element to other elements in the same POSet
|
2919
|
-
#
|
2920
|
-
# @return [Set<Element[E]>]
|
2921
2508
|
def froms; end
|
2922
2509
|
|
2923
|
-
# Direct parents of this element
|
2924
2510
|
sig { returns(T::Array[E]) }
|
2925
2511
|
def parents; end
|
2926
2512
|
|
2927
|
-
# Edges (direct and indirect) from this element to other elements in the same POSet
|
2928
|
-
#
|
2929
|
-
# @return [Set<Element[E]>]
|
2930
2513
|
def tos; end
|
2931
2514
|
|
2932
|
-
# The value held by this element
|
2933
2515
|
sig { returns(E) }
|
2934
2516
|
def value; end
|
2935
2517
|
end
|
@@ -2942,43 +2524,32 @@ class Spoom::Printer
|
|
2942
2524
|
sig { params(out: T.any(::IO, ::StringIO), colors: T::Boolean, indent_level: ::Integer).void }
|
2943
2525
|
def initialize(out: T.unsafe(nil), colors: T.unsafe(nil), indent_level: T.unsafe(nil)); end
|
2944
2526
|
|
2945
|
-
# Colorize `string` with color if `@colors`
|
2946
2527
|
sig { params(string: ::String, color: ::Spoom::Color).returns(::String) }
|
2947
2528
|
def colorize(string, *color); end
|
2948
2529
|
|
2949
|
-
# Decrease indent level
|
2950
2530
|
sig { void }
|
2951
2531
|
def dedent; end
|
2952
2532
|
|
2953
|
-
# Increase indent level
|
2954
2533
|
sig { void }
|
2955
2534
|
def indent; end
|
2956
2535
|
|
2957
2536
|
sig { returns(T.any(::IO, ::StringIO)) }
|
2958
2537
|
def out; end
|
2959
2538
|
|
2960
|
-
# @return [IO, StringIO]
|
2961
2539
|
def out=(_arg0); end
|
2962
2540
|
|
2963
|
-
# Print `string` into `out`
|
2964
2541
|
sig { params(string: T.nilable(::String)).void }
|
2965
2542
|
def print(string); end
|
2966
2543
|
|
2967
|
-
# Print `string` colored with `color` into `out`
|
2968
|
-
#
|
2969
|
-
# Does not use colors unless `@colors`.
|
2970
2544
|
sig { params(string: T.nilable(::String), color: ::Spoom::Color).void }
|
2971
2545
|
def print_colored(string, *color); end
|
2972
2546
|
|
2973
|
-
# Print `string` with indent and newline
|
2974
2547
|
sig { params(string: T.nilable(::String)).void }
|
2975
2548
|
def printl(string); end
|
2976
2549
|
|
2977
|
-
# Print a new line into `out`
|
2978
2550
|
sig { void }
|
2979
2551
|
def printn; end
|
2980
2552
|
|
2981
|
-
# Print an indent space into `out`
|
2982
2553
|
sig { void }
|
2983
2554
|
def printt; end
|
2984
2555
|
end
|
@@ -3023,7 +2594,6 @@ class Spoom::Sorbet::Assertions::AssignNode
|
|
3023
2594
|
sig { returns(::String) }
|
3024
2595
|
def rbs_type; end
|
3025
2596
|
|
3026
|
-
# @return [Prism::Node]
|
3027
2597
|
def type; end
|
3028
2598
|
|
3029
2599
|
sig { returns(::Prism::Node) }
|
@@ -3042,11 +2612,9 @@ class Spoom::Sorbet::Assertions::Locator < ::Spoom::Visitor
|
|
3042
2612
|
sig { params(node: ::Prism::Node).returns(T::Boolean) }
|
3043
2613
|
def contains_heredoc?(node); end
|
3044
2614
|
|
3045
|
-
# Is this node a `T` or `::T` constant?
|
3046
2615
|
sig { params(node: T.nilable(::Prism::Node)).returns(T::Boolean) }
|
3047
2616
|
def t?(node); end
|
3048
2617
|
|
3049
|
-
# Is this node a `T.let` or `T.cast`?
|
3050
2618
|
sig { params(node: ::Prism::CallNode).returns(T::Boolean) }
|
3051
2619
|
def t_annotation?(node); end
|
3052
2620
|
|
@@ -3057,104 +2625,30 @@ class Spoom::Sorbet::Assertions::Locator < ::Spoom::Visitor
|
|
3057
2625
|
end
|
3058
2626
|
def visit_assign(node); end
|
3059
2627
|
|
3060
|
-
# @param node [AssignType]
|
3061
|
-
# @return [void]
|
3062
2628
|
def visit_class_variable_and_write_node(*args, **_arg1, &blk); end
|
3063
|
-
|
3064
|
-
# @param node [AssignType]
|
3065
|
-
# @return [void]
|
3066
2629
|
def visit_class_variable_operator_write_node(*args, **_arg1, &blk); end
|
3067
|
-
|
3068
|
-
# @param node [AssignType]
|
3069
|
-
# @return [void]
|
3070
2630
|
def visit_class_variable_or_write_node(*args, **_arg1, &blk); end
|
3071
|
-
|
3072
|
-
# @param node [AssignType]
|
3073
|
-
# @return [void]
|
3074
2631
|
def visit_class_variable_write_node(*args, **_arg1, &blk); end
|
3075
|
-
|
3076
|
-
# @param node [AssignType]
|
3077
|
-
# @return [void]
|
3078
2632
|
def visit_constant_and_write_node(*args, **_arg1, &blk); end
|
3079
|
-
|
3080
|
-
# @param node [AssignType]
|
3081
|
-
# @return [void]
|
3082
2633
|
def visit_constant_operator_write_node(*args, **_arg1, &blk); end
|
3083
|
-
|
3084
|
-
# @param node [AssignType]
|
3085
|
-
# @return [void]
|
3086
2634
|
def visit_constant_or_write_node(*args, **_arg1, &blk); end
|
3087
|
-
|
3088
|
-
# @param node [AssignType]
|
3089
|
-
# @return [void]
|
3090
2635
|
def visit_constant_path_and_write_node(*args, **_arg1, &blk); end
|
3091
|
-
|
3092
|
-
# @param node [AssignType]
|
3093
|
-
# @return [void]
|
3094
2636
|
def visit_constant_path_operator_write_node(*args, **_arg1, &blk); end
|
3095
|
-
|
3096
|
-
# @param node [AssignType]
|
3097
|
-
# @return [void]
|
3098
2637
|
def visit_constant_path_or_write_node(*args, **_arg1, &blk); end
|
3099
|
-
|
3100
|
-
# @param node [AssignType]
|
3101
|
-
# @return [void]
|
3102
2638
|
def visit_constant_path_write_node(*args, **_arg1, &blk); end
|
3103
|
-
|
3104
|
-
# @param node [AssignType]
|
3105
|
-
# @return [void]
|
3106
2639
|
def visit_constant_write_node(*args, **_arg1, &blk); end
|
3107
|
-
|
3108
|
-
# @param node [AssignType]
|
3109
|
-
# @return [void]
|
3110
2640
|
def visit_global_variable_and_write_node(*args, **_arg1, &blk); end
|
3111
|
-
|
3112
|
-
# @param node [AssignType]
|
3113
|
-
# @return [void]
|
3114
2641
|
def visit_global_variable_operator_write_node(*args, **_arg1, &blk); end
|
3115
|
-
|
3116
|
-
# @param node [AssignType]
|
3117
|
-
# @return [void]
|
3118
2642
|
def visit_global_variable_or_write_node(*args, **_arg1, &blk); end
|
3119
|
-
|
3120
|
-
# @param node [AssignType]
|
3121
|
-
# @return [void]
|
3122
2643
|
def visit_global_variable_write_node(*args, **_arg1, &blk); end
|
3123
|
-
|
3124
|
-
# @param node [AssignType]
|
3125
|
-
# @return [void]
|
3126
2644
|
def visit_instance_variable_and_write_node(*args, **_arg1, &blk); end
|
3127
|
-
|
3128
|
-
# @param node [AssignType]
|
3129
|
-
# @return [void]
|
3130
2645
|
def visit_instance_variable_operator_write_node(*args, **_arg1, &blk); end
|
3131
|
-
|
3132
|
-
# @param node [AssignType]
|
3133
|
-
# @return [void]
|
3134
2646
|
def visit_instance_variable_or_write_node(*args, **_arg1, &blk); end
|
3135
|
-
|
3136
|
-
# @param node [AssignType]
|
3137
|
-
# @return [void]
|
3138
2647
|
def visit_instance_variable_write_node(*args, **_arg1, &blk); end
|
3139
|
-
|
3140
|
-
# @param node [AssignType]
|
3141
|
-
# @return [void]
|
3142
2648
|
def visit_local_variable_and_write_node(*args, **_arg1, &blk); end
|
3143
|
-
|
3144
|
-
# @param node [AssignType]
|
3145
|
-
# @return [void]
|
3146
2649
|
def visit_local_variable_operator_write_node(*args, **_arg1, &blk); end
|
3147
|
-
|
3148
|
-
# @param node [AssignType]
|
3149
|
-
# @return [void]
|
3150
2650
|
def visit_local_variable_or_write_node(*args, **_arg1, &blk); end
|
3151
|
-
|
3152
|
-
# @param node [AssignType]
|
3153
|
-
# @return [void]
|
3154
2651
|
def visit_local_variable_write_node(*args, **_arg1, &blk); end
|
3155
|
-
|
3156
|
-
# @param node [AssignType]
|
3157
|
-
# @return [void]
|
3158
2652
|
def visit_multi_write_node(*args, **_arg1, &blk); end
|
3159
2653
|
end
|
3160
2654
|
|
@@ -3174,70 +2668,30 @@ end
|
|
3174
2668
|
Spoom::Sorbet::BIN_PATH = T.let(T.unsafe(nil), String)
|
3175
2669
|
Spoom::Sorbet::CONFIG_PATH = T.let(T.unsafe(nil), String)
|
3176
2670
|
|
3177
|
-
# Parse Sorbet config files
|
3178
|
-
#
|
3179
|
-
# Parses a Sorbet config file:
|
3180
|
-
#
|
3181
|
-
# ```ruby
|
3182
|
-
# config = Spoom::Sorbet::Config.parse_file("sorbet/config")
|
3183
|
-
# puts config.paths # "."
|
3184
|
-
# ```
|
3185
|
-
#
|
3186
|
-
# Parses a Sorbet config string:
|
3187
|
-
#
|
3188
|
-
# ```ruby
|
3189
|
-
# config = Spoom::Sorbet::Config.parse_string(<<~CONFIG)
|
3190
|
-
# a
|
3191
|
-
# --file=b
|
3192
|
-
# --ignore=c
|
3193
|
-
# CONFIG
|
3194
|
-
# puts config.paths # "a", "b"
|
3195
|
-
# puts config.ignore # "c"
|
3196
|
-
# ```
|
3197
2671
|
class Spoom::Sorbet::Config
|
3198
2672
|
sig { void }
|
3199
2673
|
def initialize; end
|
3200
2674
|
|
3201
|
-
# @return [Array<String>]
|
3202
2675
|
def allowed_extensions; end
|
3203
|
-
|
3204
|
-
# @return [Array<String>]
|
3205
2676
|
def allowed_extensions=(_arg0); end
|
3206
2677
|
|
3207
2678
|
sig { returns(::Spoom::Sorbet::Config) }
|
3208
2679
|
def copy; end
|
3209
2680
|
|
3210
|
-
# @return [Array<String>]
|
3211
2681
|
def ignore; end
|
3212
|
-
|
3213
|
-
# @return [Array<String>]
|
3214
2682
|
def ignore=(_arg0); end
|
3215
2683
|
|
3216
2684
|
sig { returns(T::Boolean) }
|
3217
2685
|
def no_stdlib; end
|
3218
2686
|
|
3219
|
-
# @return [Boolean]
|
3220
2687
|
def no_stdlib=(_arg0); end
|
3221
2688
|
|
3222
|
-
# Returns self as a string of options that can be passed to Sorbet
|
3223
|
-
#
|
3224
|
-
# Example:
|
3225
|
-
# ~~~rb
|
3226
|
-
# config = Sorbet::Config.new
|
3227
|
-
# config.paths << "/foo"
|
3228
|
-
# config.paths << "/bar"
|
3229
|
-
# config.ignore << "/baz"
|
3230
|
-
# config.allowed_extensions << ".rb"
|
3231
|
-
#
|
3232
|
-
# puts config.options_string # "/foo /bar --ignore /baz --allowed-extension .rb"
|
3233
|
-
# ~~~
|
3234
2689
|
sig { returns(::String) }
|
3235
2690
|
def options_string; end
|
3236
2691
|
|
3237
2692
|
sig { returns(T::Array[::String]) }
|
3238
2693
|
def paths; end
|
3239
2694
|
|
3240
|
-
# @return [Array<String>]
|
3241
2695
|
def paths=(_arg0); end
|
3242
2696
|
|
3243
2697
|
class << self
|
@@ -3271,6 +2725,9 @@ module Spoom::Sorbet::Errors
|
|
3271
2725
|
class << self
|
3272
2726
|
sig { params(errors: T::Array[::Spoom::Sorbet::Errors::Error]).returns(T::Array[::Spoom::Sorbet::Errors::Error]) }
|
3273
2727
|
def sort_errors_by_code(errors); end
|
2728
|
+
|
2729
|
+
sig { params(errors: T::Array[::Spoom::Sorbet::Errors::Error]).returns(::REXML::Document) }
|
2730
|
+
def to_junit_xml(errors); end
|
3274
2731
|
end
|
3275
2732
|
end
|
3276
2733
|
|
@@ -3290,34 +2747,32 @@ class Spoom::Sorbet::Errors::Error
|
|
3290
2747
|
end
|
3291
2748
|
def initialize(file, line, message, code, more = T.unsafe(nil)); end
|
3292
2749
|
|
3293
|
-
# By default errors are sorted by location
|
3294
2750
|
sig { params(other: T.untyped).returns(::Integer) }
|
3295
2751
|
def <=>(other); end
|
3296
2752
|
|
3297
|
-
# @return [Integer, nil]
|
3298
2753
|
def code; end
|
3299
2754
|
|
3300
2755
|
sig { returns(T.nilable(::String)) }
|
3301
2756
|
def file; end
|
3302
2757
|
|
3303
|
-
# Other files associated with the error
|
3304
2758
|
sig { returns(T::Set[::String]) }
|
3305
2759
|
def files_from_error_sections; end
|
3306
2760
|
|
3307
2761
|
sig { returns(T.nilable(::Integer)) }
|
3308
2762
|
def line; end
|
3309
2763
|
|
3310
|
-
# @return [String, nil]
|
3311
2764
|
def message; end
|
3312
2765
|
|
3313
2766
|
sig { returns(T::Array[::String]) }
|
3314
2767
|
def more; end
|
3315
2768
|
|
2769
|
+
sig { returns(::REXML::Element) }
|
2770
|
+
def to_junit_xml_element; end
|
2771
|
+
|
3316
2772
|
sig { returns(::String) }
|
3317
2773
|
def to_s; end
|
3318
2774
|
end
|
3319
2775
|
|
3320
|
-
# Parse errors from Sorbet output
|
3321
2776
|
class Spoom::Sorbet::Errors::Parser
|
3322
2777
|
sig { params(error_url_base: ::String).void }
|
3323
2778
|
def initialize(error_url_base: T.unsafe(nil)); end
|
@@ -3327,11 +2782,9 @@ class Spoom::Sorbet::Errors::Parser
|
|
3327
2782
|
|
3328
2783
|
private
|
3329
2784
|
|
3330
|
-
# @raise [ParseError]
|
3331
2785
|
sig { params(line: ::String).void }
|
3332
2786
|
def append_error(line); end
|
3333
2787
|
|
3334
|
-
# @raise [ParseError]
|
3335
2788
|
sig { void }
|
3336
2789
|
def close_error; end
|
3337
2790
|
|
@@ -3341,7 +2794,6 @@ class Spoom::Sorbet::Errors::Parser
|
|
3341
2794
|
sig { params(line: ::String).returns(T.nilable(::Spoom::Sorbet::Errors::Error)) }
|
3342
2795
|
def match_error_line(line); end
|
3343
2796
|
|
3344
|
-
# @raise [ParseError]
|
3345
2797
|
sig { params(error: ::Spoom::Sorbet::Errors::Error).void }
|
3346
2798
|
def open_error(error); end
|
3347
2799
|
|
@@ -3375,32 +2827,24 @@ Spoom::Sorbet::SEGFAULT_CODE = T.let(T.unsafe(nil), Integer)
|
|
3375
2827
|
|
3376
2828
|
module Spoom::Sorbet::Sigils
|
3377
2829
|
class << self
|
3378
|
-
# changes the sigil in the file at the passed path to the specified new strictness
|
3379
2830
|
sig { params(path: T.any(::Pathname, ::String), new_strictness: ::String).returns(T::Boolean) }
|
3380
2831
|
def change_sigil_in_file(path, new_strictness); end
|
3381
2832
|
|
3382
|
-
# changes the sigil to have a new strictness in a list of files
|
3383
2833
|
sig { params(path_list: T::Array[::String], new_strictness: ::String).returns(T::Array[::String]) }
|
3384
2834
|
def change_sigil_in_files(path_list, new_strictness); end
|
3385
2835
|
|
3386
|
-
# returns a string containing the strictness of a sigil in a file at the passed path
|
3387
|
-
# * returns nil if no sigil
|
3388
2836
|
sig { params(path: T.any(::Pathname, ::String)).returns(T.nilable(::String)) }
|
3389
2837
|
def file_strictness(path); end
|
3390
2838
|
|
3391
|
-
# returns the full sigil comment string for the passed strictness
|
3392
2839
|
sig { params(strictness: ::String).returns(::String) }
|
3393
2840
|
def sigil_string(strictness); end
|
3394
2841
|
|
3395
|
-
# returns the strictness of a sigil in the passed file content string (nil if no sigil)
|
3396
2842
|
sig { params(content: ::String).returns(T.nilable(::String)) }
|
3397
2843
|
def strictness_in_content(content); end
|
3398
2844
|
|
3399
|
-
# returns a string which is the passed content but with the sigil updated to a new strictness
|
3400
2845
|
sig { params(content: ::String, new_strictness: ::String).returns(::String) }
|
3401
2846
|
def update_sigil(content, new_strictness); end
|
3402
2847
|
|
3403
|
-
# returns true if the passed string is a valid strictness (else false)
|
3404
2848
|
sig { params(strictness: ::String).returns(T::Boolean) }
|
3405
2849
|
def valid_strictness?(strictness); end
|
3406
2850
|
end
|
@@ -3474,12 +2918,10 @@ class Spoom::Sorbet::Sigs::RBSToRBITranslator
|
|
3474
2918
|
end
|
3475
2919
|
end
|
3476
2920
|
|
3477
|
-
# From https://github.com/Shopify/ruby-lsp/blob/9154bfc6ef/lib/ruby_lsp/document.rb#L127
|
3478
2921
|
class Spoom::Sorbet::Sigs::Scanner
|
3479
2922
|
sig { params(source: ::String).void }
|
3480
2923
|
def initialize(source); end
|
3481
2924
|
|
3482
|
-
# Finds the character index inside the source string for a given line and column
|
3483
2925
|
sig { params(line: ::Integer, character: ::Integer).returns(::Integer) }
|
3484
2926
|
def find_char_position(line, character); end
|
3485
2927
|
end
|
@@ -3504,15 +2946,12 @@ class Spoom::Timeline
|
|
3504
2946
|
sig { params(context: ::Spoom::Context, from: ::Time, to: ::Time).void }
|
3505
2947
|
def initialize(context, from, to); end
|
3506
2948
|
|
3507
|
-
# Return one commit for each date in `dates`
|
3508
2949
|
sig { params(dates: T::Array[::Time]).returns(T::Array[::Spoom::Git::Commit]) }
|
3509
2950
|
def commits_for_dates(dates); end
|
3510
2951
|
|
3511
|
-
# Return all months between `from` and `to`
|
3512
2952
|
sig { returns(T::Array[::Time]) }
|
3513
2953
|
def months; end
|
3514
2954
|
|
3515
|
-
# Return one commit for each month between `from` and `to`
|
3516
2955
|
sig { returns(T::Array[::Spoom::Git::Commit]) }
|
3517
2956
|
def ticks; end
|
3518
2957
|
end
|