spoom 1.8.2 → 1.8.4
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/lib/spoom/cli/srb/bump.rb +33 -13
- data/lib/spoom/cli/srb/sigs.rb +5 -0
- data/lib/spoom/cli/srb/tc.rb +5 -1
- data/lib/spoom/sorbet/config.rb +12 -1
- data/lib/spoom/sorbet/errors.rb +39 -3
- data/lib/spoom/sorbet/translate/sorbet_sigs_to_rbs_comments.rb +21 -6
- data/lib/spoom/sorbet/translate.rb +6 -1
- data/lib/spoom/version.rb +1 -1
- data/rbi/spoom.rbi +37 -5
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 6f138cb37a9cdcc10a7195440a948f6f9a3d2225ac032e2179823cf327b3d803
|
|
4
|
+
data.tar.gz: 9d8b55599e6de489d29362353f9ac3802b12ad85b6e9e34b40c09b07127ace47
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 708cb8b80b385e27c7d5a3e9cc05fbc475df994977a3cbf3ef4a1ea2cf592c91376bf9f1000aa7991ed0c154bb0e3ecc5120bd5ab01c94ca6e20a9a1bac98322
|
|
7
|
+
data.tar.gz: 262a4f6b42009e39c91a6e312ed54aba0056e6dd71d5ce136448c4f1343ee1037159a13ebb77d6f68113d64db7ebc3de61bad289440f0fa8b5efcca5e3444ee6
|
data/lib/spoom/cli/srb/bump.rb
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
require "find"
|
|
5
5
|
require "open3"
|
|
6
|
+
require "tempfile"
|
|
7
|
+
require "yaml"
|
|
6
8
|
|
|
7
9
|
module Spoom
|
|
8
10
|
module Cli
|
|
@@ -72,6 +74,11 @@ module Spoom
|
|
|
72
74
|
exit(1)
|
|
73
75
|
end
|
|
74
76
|
|
|
77
|
+
unless context.sorbet_config.typed_overrides.empty?
|
|
78
|
+
say_error("Cannot run `spoom bump` on a project that already uses Sorbet's `--typed-override` option")
|
|
79
|
+
exit(1)
|
|
80
|
+
end
|
|
81
|
+
|
|
75
82
|
say("Checking files...")
|
|
76
83
|
|
|
77
84
|
files_to_bump = context.srb_files_with_strictness(from, include_rbis: false)
|
|
@@ -90,18 +97,18 @@ module Spoom
|
|
|
90
97
|
exit(0)
|
|
91
98
|
end
|
|
92
99
|
|
|
93
|
-
Sorbet::Sigils.change_sigil_in_files(files_to_bump, to)
|
|
94
|
-
|
|
95
100
|
if force
|
|
101
|
+
Sorbet::Sigils.change_sigil_in_files(files_to_bump, to) unless dry
|
|
96
102
|
print_changes(files_to_bump, command: cmd, from: from, to: to, dry: dry, path: exec_path)
|
|
97
|
-
undo_changes(files_to_bump, from) if dry
|
|
98
103
|
exit(files_to_bump.empty?)
|
|
99
104
|
end
|
|
100
105
|
|
|
101
106
|
error_url_base = Spoom::Sorbet::Errors::DEFAULT_ERROR_URL_BASE
|
|
107
|
+
typed_override_file = create_typed_override_file(context, files_to_bump, to)
|
|
102
108
|
result = begin
|
|
103
109
|
T.unsafe(context).srb_tc(
|
|
104
110
|
*options[:sorbet_options].split(" "),
|
|
111
|
+
"--typed-override=#{T.must(typed_override_file.path)}",
|
|
105
112
|
"--error-url-base=#{error_url_base}",
|
|
106
113
|
capture_err: true,
|
|
107
114
|
sorbet_bin: options[:sorbet],
|
|
@@ -114,7 +121,6 @@ module Spoom
|
|
|
114
121
|
It means one of the file bumped to `typed: #{to}` made Sorbet crash.
|
|
115
122
|
Run `spoom bump -f` locally followed by `bundle exec srb tc` to investigate the problem.
|
|
116
123
|
ERR
|
|
117
|
-
undo_changes(files_to_bump, from)
|
|
118
124
|
exit(error.result.exit_code)
|
|
119
125
|
rescue Spoom::Sorbet::Error::Killed => error
|
|
120
126
|
say_error(<<~ERR, status: nil)
|
|
@@ -123,13 +129,18 @@ module Spoom
|
|
|
123
129
|
It means Sorbet was killed while executing. Changes to files have not been applied.
|
|
124
130
|
Re-run `spoom bump` to try again.
|
|
125
131
|
ERR
|
|
126
|
-
undo_changes(files_to_bump, from)
|
|
127
132
|
exit(error.result.exit_code)
|
|
133
|
+
ensure
|
|
134
|
+
typed_override_file.close!
|
|
128
135
|
end
|
|
129
136
|
|
|
130
137
|
if result.status
|
|
138
|
+
parse_result = Sorbet::Errors::Parser.parse_result(result.err, error_url_base: error_url_base)
|
|
139
|
+
parse_result.warnings.each do |warning|
|
|
140
|
+
say_error(warning, status: nil, nl: false)
|
|
141
|
+
end
|
|
142
|
+
Sorbet::Sigils.change_sigil_in_files(files_to_bump, to) unless dry
|
|
131
143
|
print_changes(files_to_bump, command: cmd, from: from, to: to, dry: dry, path: exec_path)
|
|
132
|
-
undo_changes(files_to_bump, from) if dry
|
|
133
144
|
exit(files_to_bump.empty?)
|
|
134
145
|
end
|
|
135
146
|
|
|
@@ -137,11 +148,14 @@ module Spoom
|
|
|
137
148
|
# Sorbet will return exit code 100 if there are type checking errors.
|
|
138
149
|
# If Sorbet returned something else, it means it didn't terminate normally.
|
|
139
150
|
say_error(result.err, status: nil, nl: false)
|
|
140
|
-
undo_changes(files_to_bump, from)
|
|
141
151
|
exit(1)
|
|
142
152
|
end
|
|
143
153
|
|
|
144
|
-
|
|
154
|
+
parse_result = Sorbet::Errors::Parser.parse_result(result.err, error_url_base: error_url_base)
|
|
155
|
+
parse_result.warnings.each do |warning|
|
|
156
|
+
say_error(warning, status: nil, nl: false)
|
|
157
|
+
end
|
|
158
|
+
errors = parse_result.errors
|
|
145
159
|
|
|
146
160
|
all_files = errors.flat_map do |err|
|
|
147
161
|
[err.file, *err.files_from_error_sections]
|
|
@@ -156,13 +170,11 @@ module Spoom
|
|
|
156
170
|
path
|
|
157
171
|
end.compact.uniq
|
|
158
172
|
|
|
159
|
-
undo_changes(files_with_errors, from)
|
|
160
|
-
|
|
161
173
|
say("Found #{errors.length} type checking error#{"s" if errors.length > 1}") if options[:count_errors]
|
|
162
174
|
|
|
163
175
|
files_changed = files_to_bump - files_with_errors
|
|
176
|
+
Sorbet::Sigils.change_sigil_in_files(files_changed, to) unless dry
|
|
164
177
|
print_changes(files_changed, command: cmd, from: from, to: to, dry: dry, path: exec_path)
|
|
165
|
-
undo_changes(files_to_bump, from) if dry
|
|
166
178
|
exit(files_changed.empty?)
|
|
167
179
|
end
|
|
168
180
|
|
|
@@ -189,8 +201,16 @@ module Spoom
|
|
|
189
201
|
end
|
|
190
202
|
end
|
|
191
203
|
|
|
192
|
-
|
|
193
|
-
|
|
204
|
+
#: (Spoom::Context context, Array[String] files, String strictness) -> Tempfile
|
|
205
|
+
def create_typed_override_file(context, files, strictness)
|
|
206
|
+
relative_paths = files.map do |file|
|
|
207
|
+
relative_path = file.delete_prefix("#{context.absolute_path}/")
|
|
208
|
+
"./#{relative_path}"
|
|
209
|
+
end
|
|
210
|
+
typed_override_file = Tempfile.new(["spoom-typed-override", ".yml"])
|
|
211
|
+
typed_override_file.write(YAML.dump({ strictness => relative_paths }))
|
|
212
|
+
typed_override_file.flush
|
|
213
|
+
typed_override_file
|
|
194
214
|
end
|
|
195
215
|
end
|
|
196
216
|
end
|
data/lib/spoom/cli/srb/sigs.rb
CHANGED
|
@@ -17,6 +17,10 @@ module Spoom
|
|
|
17
17
|
aliases: :p,
|
|
18
18
|
desc: "Use positional names when translating from RBI to RBS",
|
|
19
19
|
default: true
|
|
20
|
+
option :preserve_multiline_signatures,
|
|
21
|
+
type: :boolean,
|
|
22
|
+
desc: "Preserve multiline sig formatting when translating from RBI to RBS",
|
|
23
|
+
default: true
|
|
20
24
|
option :include_rbi_files, type: :boolean, desc: "Include RBI files", default: false
|
|
21
25
|
option :max_line_length, type: :numeric, desc: "Max line length (pass 0 to disable)", default: 120
|
|
22
26
|
option :translate_generics, type: :boolean, desc: "Translate generics", default: false
|
|
@@ -53,6 +57,7 @@ module Spoom
|
|
|
53
57
|
contents,
|
|
54
58
|
file: file,
|
|
55
59
|
positional_names: options[:positional_names],
|
|
60
|
+
preserve_multiline_signatures: options[:preserve_multiline_signatures],
|
|
56
61
|
max_line_length: max_line_length,
|
|
57
62
|
translate_generics: options[:translate_generics],
|
|
58
63
|
translate_helpers: options[:translate_helpers],
|
data/lib/spoom/cli/srb/tc.rb
CHANGED
|
@@ -73,7 +73,11 @@ module Spoom
|
|
|
73
73
|
exit(1)
|
|
74
74
|
end
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
parse_result = Spoom::Sorbet::Errors::Parser.parse_result(result.err, error_url_base: error_url_base)
|
|
77
|
+
parse_result.warnings.each do |warning|
|
|
78
|
+
say_error(warning, status: nil, nl: false)
|
|
79
|
+
end
|
|
80
|
+
errors = parse_result.errors
|
|
77
81
|
errors_count = errors.size
|
|
78
82
|
|
|
79
83
|
errors = errors.select { |e| e.code == code } if code
|
data/lib/spoom/sorbet/config.rb
CHANGED
|
@@ -27,7 +27,7 @@ module Spoom
|
|
|
27
27
|
DEFAULT_ALLOWED_EXTENSIONS = [".rb", ".rbi"].freeze #: Array[String]
|
|
28
28
|
|
|
29
29
|
#: Array[String]
|
|
30
|
-
attr_accessor :paths, :ignore, :allowed_extensions
|
|
30
|
+
attr_accessor :paths, :ignore, :allowed_extensions, :typed_overrides
|
|
31
31
|
|
|
32
32
|
#: bool
|
|
33
33
|
attr_accessor :no_stdlib
|
|
@@ -37,6 +37,7 @@ module Spoom
|
|
|
37
37
|
@paths = [] #: Array[String]
|
|
38
38
|
@ignore = [] #: Array[String]
|
|
39
39
|
@allowed_extensions = [] #: Array[String]
|
|
40
|
+
@typed_overrides = [] #: Array[String]
|
|
40
41
|
@no_stdlib = false #: bool
|
|
41
42
|
end
|
|
42
43
|
|
|
@@ -46,6 +47,7 @@ module Spoom
|
|
|
46
47
|
@paths = @paths.dup
|
|
47
48
|
@ignore = @ignore.dup
|
|
48
49
|
@allowed_extensions = @allowed_extensions.dup
|
|
50
|
+
@typed_overrides = @typed_overrides.dup
|
|
49
51
|
end
|
|
50
52
|
|
|
51
53
|
# Returns self as a string of options that can be passed to Sorbet
|
|
@@ -66,6 +68,7 @@ module Spoom
|
|
|
66
68
|
opts.concat(paths.map { |p| "'#{p}'" })
|
|
67
69
|
opts.concat(ignore.map { |p| "--ignore '#{p}'" })
|
|
68
70
|
opts.concat(allowed_extensions.map { |ext| "--allowed-extension '#{ext}'" })
|
|
71
|
+
opts.concat(typed_overrides.map { |path| "--typed-override '#{path}'" })
|
|
69
72
|
opts << "--no-stdlib" if @no_stdlib
|
|
70
73
|
opts.join(" ")
|
|
71
74
|
end
|
|
@@ -95,6 +98,12 @@ module Spoom
|
|
|
95
98
|
when /^--ignore=/
|
|
96
99
|
config.ignore << parse_option(line)
|
|
97
100
|
next
|
|
101
|
+
when /^--typed-override$/
|
|
102
|
+
state = :typed_override
|
|
103
|
+
next
|
|
104
|
+
when /^--typed-override=/
|
|
105
|
+
config.typed_overrides << parse_option(line)
|
|
106
|
+
next
|
|
98
107
|
when /^--file$/
|
|
99
108
|
next
|
|
100
109
|
when /^--file=/
|
|
@@ -124,6 +133,8 @@ module Spoom
|
|
|
124
133
|
config.ignore << line
|
|
125
134
|
when :extension
|
|
126
135
|
config.allowed_extensions << line
|
|
136
|
+
when :typed_override
|
|
137
|
+
config.typed_overrides << line
|
|
127
138
|
when :skip
|
|
128
139
|
# nothing
|
|
129
140
|
else
|
data/lib/spoom/sorbet/errors.rb
CHANGED
|
@@ -56,22 +56,35 @@ module Spoom
|
|
|
56
56
|
] #: Array[String]
|
|
57
57
|
|
|
58
58
|
class << self
|
|
59
|
+
# Used when only Sorbet errors are needed and leading stderr warnings can be ignored.
|
|
59
60
|
#: (String output, ?error_url_base: String) -> Array[Error]
|
|
60
61
|
def parse_string(output, error_url_base: DEFAULT_ERROR_URL_BASE)
|
|
62
|
+
parse_result(output, error_url_base: error_url_base).errors
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Used when callers need both parsed Sorbet errors and leading stderr warnings.
|
|
66
|
+
#: (String output, ?error_url_base: String) -> ParseResult
|
|
67
|
+
def parse_result(output, error_url_base: DEFAULT_ERROR_URL_BASE)
|
|
61
68
|
parser = Spoom::Sorbet::Errors::Parser.new(error_url_base: error_url_base)
|
|
62
|
-
parser.
|
|
69
|
+
parser.parse_result(output)
|
|
63
70
|
end
|
|
64
71
|
end
|
|
65
72
|
|
|
66
73
|
#: (?error_url_base: String) -> void
|
|
67
74
|
def initialize(error_url_base: DEFAULT_ERROR_URL_BASE)
|
|
68
75
|
@errors = [] #: Array[Error]
|
|
76
|
+
@warnings = [] #: Array[String]
|
|
69
77
|
@error_line_match_regex = error_line_match_regexp(error_url_base) #: Regexp
|
|
70
78
|
@current_error = nil #: Error?
|
|
71
79
|
end
|
|
72
80
|
|
|
73
81
|
#: (String output) -> Array[Error]
|
|
74
82
|
def parse(output)
|
|
83
|
+
parse_result(output).errors
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
#: (String output) -> ParseResult
|
|
87
|
+
def parse_result(output)
|
|
75
88
|
output.each_line do |line|
|
|
76
89
|
break if /^No errors! Great job\./.match?(line)
|
|
77
90
|
break if /^Errors: /.match?(line)
|
|
@@ -85,10 +98,14 @@ module Spoom
|
|
|
85
98
|
next
|
|
86
99
|
end
|
|
87
100
|
|
|
88
|
-
|
|
101
|
+
if @current_error
|
|
102
|
+
append_error(line)
|
|
103
|
+
else
|
|
104
|
+
append_warning(line)
|
|
105
|
+
end
|
|
89
106
|
end
|
|
90
107
|
close_error if @current_error
|
|
91
|
-
@errors
|
|
108
|
+
ParseResult.new(@errors, @warnings)
|
|
92
109
|
end
|
|
93
110
|
|
|
94
111
|
private
|
|
@@ -144,6 +161,11 @@ module Spoom
|
|
|
144
161
|
end
|
|
145
162
|
@current_error.more << line
|
|
146
163
|
end
|
|
164
|
+
|
|
165
|
+
#: (String warning) -> void
|
|
166
|
+
def append_warning(warning)
|
|
167
|
+
@warnings << warning
|
|
168
|
+
end
|
|
147
169
|
end
|
|
148
170
|
|
|
149
171
|
class Error
|
|
@@ -214,6 +236,20 @@ module Spoom
|
|
|
214
236
|
testcase_element
|
|
215
237
|
end
|
|
216
238
|
end
|
|
239
|
+
|
|
240
|
+
class ParseResult
|
|
241
|
+
#: Array[Error]
|
|
242
|
+
attr_reader :errors
|
|
243
|
+
|
|
244
|
+
#: Array[String]
|
|
245
|
+
attr_reader :warnings
|
|
246
|
+
|
|
247
|
+
#: (Array[Error] errors, Array[String] warnings) -> void
|
|
248
|
+
def initialize(errors, warnings)
|
|
249
|
+
@errors = errors
|
|
250
|
+
@warnings = warnings
|
|
251
|
+
end
|
|
252
|
+
end
|
|
217
253
|
end
|
|
218
254
|
end
|
|
219
255
|
end
|
|
@@ -11,6 +11,7 @@ module Spoom
|
|
|
11
11
|
#| String,
|
|
12
12
|
#| file: String,
|
|
13
13
|
#| positional_names: bool,
|
|
14
|
+
#| ?preserve_multiline_signatures: bool,
|
|
14
15
|
#| ?max_line_length: Integer?,
|
|
15
16
|
#| ?translate_generics: bool,
|
|
16
17
|
#| ?translate_helpers: bool,
|
|
@@ -20,6 +21,7 @@ module Spoom
|
|
|
20
21
|
ruby_contents,
|
|
21
22
|
file:,
|
|
22
23
|
positional_names:,
|
|
24
|
+
preserve_multiline_signatures: true,
|
|
23
25
|
max_line_length: nil,
|
|
24
26
|
translate_generics: true,
|
|
25
27
|
translate_helpers: true,
|
|
@@ -34,6 +36,8 @@ module Spoom
|
|
|
34
36
|
@extend_t_helpers = [] #: Array[Prism::CallNode]
|
|
35
37
|
@extend_t_generics = [] #: Array[Prism::CallNode]
|
|
36
38
|
@seen_mixes_in_class_methods = false #: bool
|
|
39
|
+
|
|
40
|
+
@preserve_multiline_signatures = preserve_multiline_signatures
|
|
37
41
|
@max_line_length = max_line_length #: Integer?
|
|
38
42
|
|
|
39
43
|
@translate_generics = translate_generics #: bool
|
|
@@ -75,7 +79,12 @@ module Spoom
|
|
|
75
79
|
last_sigs.each do |node, sig|
|
|
76
80
|
next if sig.is_abstract && !@translate_abstract_methods
|
|
77
81
|
|
|
78
|
-
|
|
82
|
+
preserve_multiline_signatures = !!(@preserve_multiline_signatures && sig.loc&.multiline?)
|
|
83
|
+
|
|
84
|
+
out = rbs_print(
|
|
85
|
+
node.location.start_column,
|
|
86
|
+
preserve_multiline_signatures: preserve_multiline_signatures,
|
|
87
|
+
) do |printer|
|
|
79
88
|
printer.print_method_sig(rbi_node, sig)
|
|
80
89
|
end
|
|
81
90
|
@rewriter << Source::Replace.new(node.location.start_offset, node.location.end_offset, out)
|
|
@@ -180,7 +189,7 @@ module Spoom
|
|
|
180
189
|
return unless sorbet_sig?(node)
|
|
181
190
|
|
|
182
191
|
builder = RBI::Parser::SigBuilder.new(@ruby_contents, file: @file)
|
|
183
|
-
builder.current.loc = node.location
|
|
192
|
+
builder.current.loc = RBI::Loc.from_prism(@file, node.location)
|
|
184
193
|
builder.visit_call_node(node)
|
|
185
194
|
builder.current.comments = []
|
|
186
195
|
|
|
@@ -204,7 +213,7 @@ module Spoom
|
|
|
204
213
|
rbi_node = builder.tree.nodes.first #: as RBI::Attr
|
|
205
214
|
|
|
206
215
|
last_sigs.each do |node, sig|
|
|
207
|
-
out = rbs_print(node.location.start_column) do |printer|
|
|
216
|
+
out = rbs_print(node.location.start_column, preserve_multiline_signatures: false) do |printer|
|
|
208
217
|
printer.print_attr_sig(rbi_node, sig)
|
|
209
218
|
end
|
|
210
219
|
@rewriter << Source::Replace.new(node.location.start_offset, node.location.end_offset, out)
|
|
@@ -387,10 +396,16 @@ module Spoom
|
|
|
387
396
|
last_sigs
|
|
388
397
|
end
|
|
389
398
|
|
|
390
|
-
#: (Integer) { (RBI::RBSPrinter) -> void } -> String
|
|
391
|
-
def rbs_print(indent, &block)
|
|
399
|
+
#: (Integer, preserve_multiline_signatures: bool) { (RBI::RBSPrinter) -> void } -> String
|
|
400
|
+
def rbs_print(indent, preserve_multiline_signatures:, &block)
|
|
392
401
|
out = StringIO.new
|
|
393
|
-
|
|
402
|
+
|
|
403
|
+
p = RBI::RBSPrinter.new(
|
|
404
|
+
out: out,
|
|
405
|
+
positional_names: @positional_names,
|
|
406
|
+
max_line_length: @max_line_length,
|
|
407
|
+
force_multiline_signatures: preserve_multiline_signatures,
|
|
408
|
+
)
|
|
394
409
|
block.call(p)
|
|
395
410
|
string = out.string
|
|
396
411
|
|
|
@@ -30,13 +30,17 @@ module Spoom
|
|
|
30
30
|
#| String,
|
|
31
31
|
#| file: String,
|
|
32
32
|
#| ?positional_names: bool,
|
|
33
|
+
#| ?preserve_multiline_signatures: bool,
|
|
33
34
|
#| ?max_line_length: Integer?,
|
|
34
35
|
#| ?translate_generics: bool,
|
|
35
36
|
#| ?translate_helpers: bool,
|
|
36
37
|
#| ?translate_abstract_methods: bool
|
|
37
38
|
#| ) -> String
|
|
38
39
|
def sorbet_sigs_to_rbs_comments(
|
|
39
|
-
ruby_contents, file:,
|
|
40
|
+
ruby_contents, file:,
|
|
41
|
+
positional_names: true,
|
|
42
|
+
preserve_multiline_signatures: true,
|
|
43
|
+
max_line_length: nil,
|
|
40
44
|
translate_generics: true,
|
|
41
45
|
translate_helpers: true,
|
|
42
46
|
translate_abstract_methods: true
|
|
@@ -45,6 +49,7 @@ module Spoom
|
|
|
45
49
|
ruby_contents,
|
|
46
50
|
file: file,
|
|
47
51
|
positional_names: positional_names,
|
|
52
|
+
preserve_multiline_signatures: preserve_multiline_signatures,
|
|
48
53
|
max_line_length: max_line_length,
|
|
49
54
|
translate_generics: translate_generics,
|
|
50
55
|
translate_helpers: translate_helpers,
|
data/lib/spoom/version.rb
CHANGED
data/rbi/spoom.rbi
CHANGED
|
@@ -126,9 +126,11 @@ class Spoom::Cli::Srb::Bump < ::Thor
|
|
|
126
126
|
sig { params(directory: ::String).void }
|
|
127
127
|
def bump(directory = T.unsafe(nil)); end
|
|
128
128
|
|
|
129
|
+
sig { params(context: ::Spoom::Context, files: T::Array[::String], strictness: ::String).returns(::Tempfile) }
|
|
130
|
+
def create_typed_override_file(context, files, strictness); end
|
|
131
|
+
|
|
129
132
|
def help(command = T.unsafe(nil), subcommand = T.unsafe(nil)); end
|
|
130
133
|
def print_changes(files, command:, from: T.unsafe(nil), to: T.unsafe(nil), dry: T.unsafe(nil), path: T.unsafe(nil)); end
|
|
131
|
-
def undo_changes(files, from_strictness); end
|
|
132
134
|
end
|
|
133
135
|
|
|
134
136
|
class Spoom::Cli::Srb::Coverage < ::Thor
|
|
@@ -2661,6 +2663,8 @@ class Spoom::Sorbet::Config
|
|
|
2661
2663
|
def paths; end
|
|
2662
2664
|
|
|
2663
2665
|
def paths=(_arg0); end
|
|
2666
|
+
def typed_overrides; end
|
|
2667
|
+
def typed_overrides=(_arg0); end
|
|
2664
2668
|
|
|
2665
2669
|
private
|
|
2666
2670
|
|
|
@@ -2749,6 +2753,17 @@ class Spoom::Sorbet::Errors::Error
|
|
|
2749
2753
|
def to_s; end
|
|
2750
2754
|
end
|
|
2751
2755
|
|
|
2756
|
+
class Spoom::Sorbet::Errors::ParseResult
|
|
2757
|
+
sig { params(errors: T::Array[::Spoom::Sorbet::Errors::Error], warnings: T::Array[::String]).void }
|
|
2758
|
+
def initialize(errors, warnings); end
|
|
2759
|
+
|
|
2760
|
+
sig { returns(T::Array[::Spoom::Sorbet::Errors::Error]) }
|
|
2761
|
+
def errors; end
|
|
2762
|
+
|
|
2763
|
+
sig { returns(T::Array[::String]) }
|
|
2764
|
+
def warnings; end
|
|
2765
|
+
end
|
|
2766
|
+
|
|
2752
2767
|
class Spoom::Sorbet::Errors::Parser
|
|
2753
2768
|
sig { params(error_url_base: ::String).void }
|
|
2754
2769
|
def initialize(error_url_base: T.unsafe(nil)); end
|
|
@@ -2756,11 +2771,17 @@ class Spoom::Sorbet::Errors::Parser
|
|
|
2756
2771
|
sig { params(output: ::String).returns(T::Array[::Spoom::Sorbet::Errors::Error]) }
|
|
2757
2772
|
def parse(output); end
|
|
2758
2773
|
|
|
2774
|
+
sig { params(output: ::String).returns(::Spoom::Sorbet::Errors::ParseResult) }
|
|
2775
|
+
def parse_result(output); end
|
|
2776
|
+
|
|
2759
2777
|
private
|
|
2760
2778
|
|
|
2761
2779
|
sig { params(line: ::String).void }
|
|
2762
2780
|
def append_error(line); end
|
|
2763
2781
|
|
|
2782
|
+
sig { params(warning: ::String).void }
|
|
2783
|
+
def append_warning(warning); end
|
|
2784
|
+
|
|
2764
2785
|
sig { void }
|
|
2765
2786
|
def close_error; end
|
|
2766
2787
|
|
|
@@ -2774,6 +2795,9 @@ class Spoom::Sorbet::Errors::Parser
|
|
|
2774
2795
|
def open_error(error); end
|
|
2775
2796
|
|
|
2776
2797
|
class << self
|
|
2798
|
+
sig { params(output: ::String, error_url_base: ::String).returns(::Spoom::Sorbet::Errors::ParseResult) }
|
|
2799
|
+
def parse_result(output, error_url_base: T.unsafe(nil)); end
|
|
2800
|
+
|
|
2777
2801
|
sig { params(output: ::String, error_url_base: ::String).returns(T::Array[::Spoom::Sorbet::Errors::Error]) }
|
|
2778
2802
|
def parse_string(output, error_url_base: T.unsafe(nil)); end
|
|
2779
2803
|
end
|
|
@@ -2925,13 +2949,14 @@ module Spoom::Sorbet::Translate
|
|
|
2925
2949
|
ruby_contents: ::String,
|
|
2926
2950
|
file: ::String,
|
|
2927
2951
|
positional_names: T::Boolean,
|
|
2952
|
+
preserve_multiline_signatures: T::Boolean,
|
|
2928
2953
|
max_line_length: T.nilable(::Integer),
|
|
2929
2954
|
translate_generics: T::Boolean,
|
|
2930
2955
|
translate_helpers: T::Boolean,
|
|
2931
2956
|
translate_abstract_methods: T::Boolean
|
|
2932
2957
|
).returns(::String)
|
|
2933
2958
|
end
|
|
2934
|
-
def sorbet_sigs_to_rbs_comments(ruby_contents, file:, positional_names: T.unsafe(nil), max_line_length: T.unsafe(nil), translate_generics: T.unsafe(nil), translate_helpers: T.unsafe(nil), translate_abstract_methods: T.unsafe(nil)); end
|
|
2959
|
+
def sorbet_sigs_to_rbs_comments(ruby_contents, file:, positional_names: T.unsafe(nil), preserve_multiline_signatures: T.unsafe(nil), max_line_length: T.unsafe(nil), translate_generics: T.unsafe(nil), translate_helpers: T.unsafe(nil), translate_abstract_methods: T.unsafe(nil)); end
|
|
2935
2960
|
|
|
2936
2961
|
sig { params(ruby_contents: ::String, file: ::String).returns(::String) }
|
|
2937
2962
|
def strip_sorbet_sigs(ruby_contents, file:); end
|
|
@@ -3300,13 +3325,14 @@ class Spoom::Sorbet::Translate::SorbetSigsToRBSComments < ::Spoom::Sorbet::Trans
|
|
|
3300
3325
|
ruby_contents: ::String,
|
|
3301
3326
|
file: ::String,
|
|
3302
3327
|
positional_names: T::Boolean,
|
|
3328
|
+
preserve_multiline_signatures: T::Boolean,
|
|
3303
3329
|
max_line_length: T.nilable(::Integer),
|
|
3304
3330
|
translate_generics: T::Boolean,
|
|
3305
3331
|
translate_helpers: T::Boolean,
|
|
3306
3332
|
translate_abstract_methods: T::Boolean
|
|
3307
3333
|
).void
|
|
3308
3334
|
end
|
|
3309
|
-
def initialize(ruby_contents, file:, positional_names:, max_line_length: T.unsafe(nil), translate_generics: T.unsafe(nil), translate_helpers: T.unsafe(nil), translate_abstract_methods: T.unsafe(nil)); end
|
|
3335
|
+
def initialize(ruby_contents, file:, positional_names:, preserve_multiline_signatures: T.unsafe(nil), max_line_length: T.unsafe(nil), translate_generics: T.unsafe(nil), translate_helpers: T.unsafe(nil), translate_abstract_methods: T.unsafe(nil)); end
|
|
3310
3336
|
|
|
3311
3337
|
sig { override.params(node: ::Prism::CallNode).void }
|
|
3312
3338
|
def visit_call_node(node); end
|
|
@@ -3351,8 +3377,14 @@ class Spoom::Sorbet::Translate::SorbetSigsToRBSComments < ::Spoom::Sorbet::Trans
|
|
|
3351
3377
|
sig { void }
|
|
3352
3378
|
def delete_extend_t_helpers; end
|
|
3353
3379
|
|
|
3354
|
-
sig
|
|
3355
|
-
|
|
3380
|
+
sig do
|
|
3381
|
+
params(
|
|
3382
|
+
indent: ::Integer,
|
|
3383
|
+
preserve_multiline_signatures: T::Boolean,
|
|
3384
|
+
block: T.proc.params(arg0: ::RBI::RBSPrinter).void
|
|
3385
|
+
).returns(::String)
|
|
3386
|
+
end
|
|
3387
|
+
def rbs_print(indent, preserve_multiline_signatures:, &block); end
|
|
3356
3388
|
|
|
3357
3389
|
sig { params(node: ::Prism::CallNode).void }
|
|
3358
3390
|
def visit_attr(node); end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: spoom
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.8.
|
|
4
|
+
version: 1.8.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Alexandre Terrasa
|
|
@@ -85,14 +85,14 @@ dependencies:
|
|
|
85
85
|
requirements:
|
|
86
86
|
- - ">="
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
|
-
version: 0.3.
|
|
88
|
+
version: 0.3.15
|
|
89
89
|
type: :runtime
|
|
90
90
|
prerelease: false
|
|
91
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
|
93
93
|
- - ">="
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
|
-
version: 0.3.
|
|
95
|
+
version: 0.3.15
|
|
96
96
|
- !ruby/object:Gem::Dependency
|
|
97
97
|
name: rbs
|
|
98
98
|
requirement: !ruby/object:Gem::Requirement
|