spoom 1.1.5 → 1.1.6
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/Gemfile +5 -4
- data/README.md +1 -1
- data/lib/spoom/cli/bump.rb +10 -2
- data/lib/spoom/cli/helper.rb +19 -0
- data/lib/spoom/cli/run.rb +18 -3
- data/lib/spoom/sorbet/lsp/structures.rb +1 -0
- data/lib/spoom/sorbet.rb +4 -2
- data/lib/spoom/version.rb +1 -1
- data/lib/spoom.rb +6 -3
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e58e5584ba33b3b678ddedb06972121af9dd4b9a8b7f1b6941f6bb939086107a
|
4
|
+
data.tar.gz: c1cc668af1f42ace8318a47ac0b813815e4e6a9ee1d942593b1ff37b9b41cbc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f389c4b463b7bd1c4a275e844ed68d0d9e7279fefe4b1e9ed29a1c9238c25ad941aa494dee63c4f15dab288602a22efce3da6e7b08c795b1cb99fb236e2edf39
|
7
|
+
data.tar.gz: 7071bc29a1d13087d0e0527832b7619af180b20375c006122d059c640a606a55edd68234e098cf2360f06c00aa165a7a673a4d009275707be830bebef947936a
|
data/Gemfile
CHANGED
@@ -5,8 +5,9 @@ source "https://rubygems.org"
|
|
5
5
|
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
group
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
8
|
+
group :development do
|
9
|
+
gem "pry-byebug"
|
10
|
+
gem "rubocop-shopify", require: false
|
11
|
+
gem "rubocop-sorbet", require: false
|
12
|
+
gem "tapioca", require: false
|
12
13
|
end
|
data/README.md
CHANGED
@@ -358,4 +358,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
358
358
|
|
359
359
|
## Code of Conduct
|
360
360
|
|
361
|
-
Everyone interacting in the Spoom project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Shopify/spoom/blob/
|
361
|
+
Everyone interacting in the Spoom project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Shopify/spoom/blob/main/CODE_OF_CONDUCT.md).
|
data/lib/spoom/cli/bump.rb
CHANGED
@@ -83,14 +83,22 @@ module Spoom
|
|
83
83
|
exit(files_to_bump.empty?)
|
84
84
|
end
|
85
85
|
|
86
|
-
output,
|
86
|
+
output, status, exit_code = Sorbet.srb_tc(
|
87
87
|
"--no-error-sections",
|
88
88
|
path: exec_path,
|
89
89
|
capture_err: true,
|
90
90
|
sorbet_bin: options[:sorbet]
|
91
91
|
)
|
92
92
|
|
93
|
-
|
93
|
+
check_sorbet_segfault(exit_code) do
|
94
|
+
say_error(<<~ERR, status: nil)
|
95
|
+
It means one of the file bumped to `typed: #{to}` made Sorbet crash.
|
96
|
+
Run `spoom bump -f` locally followed by `bundle exec srb tc` to investigate the problem.
|
97
|
+
ERR
|
98
|
+
undo_changes(files_to_bump, from)
|
99
|
+
end
|
100
|
+
|
101
|
+
if status
|
94
102
|
print_changes(files_to_bump, command: cmd, from: from, to: to, dry: dry, path: exec_path)
|
95
103
|
undo_changes(files_to_bump, from) if dry
|
96
104
|
exit(files_to_bump.empty?)
|
data/lib/spoom/cli/helper.rb
CHANGED
@@ -83,6 +83,20 @@ module Spoom
|
|
83
83
|
Sorbet::Config.parse_file(sorbet_config_file)
|
84
84
|
end
|
85
85
|
|
86
|
+
sig { params(exit_code: Integer, block: T.nilable(T.proc.void)).void }
|
87
|
+
def check_sorbet_segfault(exit_code, &block)
|
88
|
+
return unless exit_code == Spoom::Sorbet::SEGFAULT_CODE
|
89
|
+
|
90
|
+
say_error(<<~ERR, status: nil)
|
91
|
+
#{red("!!! Sorbet exited with code #{exit_code} - SEGFAULT !!!")}
|
92
|
+
|
93
|
+
This is most likely related to a bug in Sorbet.
|
94
|
+
ERR
|
95
|
+
|
96
|
+
block&.call
|
97
|
+
exit(exit_code)
|
98
|
+
end
|
99
|
+
|
86
100
|
# Colors
|
87
101
|
|
88
102
|
# Color used to highlight expressions in backticks
|
@@ -129,6 +143,11 @@ module Spoom
|
|
129
143
|
colorize(string, Color::BLUE)
|
130
144
|
end
|
131
145
|
|
146
|
+
sig { params(string: String).returns(String) }
|
147
|
+
def cyan(string)
|
148
|
+
colorize(string, Color::CYAN)
|
149
|
+
end
|
150
|
+
|
132
151
|
sig { params(string: String).returns(String) }
|
133
152
|
def gray(string)
|
134
153
|
colorize(string, Color::LIGHT_BLACK)
|
data/lib/spoom/cli/run.rb
CHANGED
@@ -35,12 +35,27 @@ module Spoom
|
|
35
35
|
sorbet = options[:sorbet]
|
36
36
|
|
37
37
|
unless limit || code || sort
|
38
|
-
output, status = T.unsafe(Spoom::Sorbet).srb_tc(
|
38
|
+
output, status, exit_code = T.unsafe(Spoom::Sorbet).srb_tc(
|
39
|
+
*arg,
|
40
|
+
path: path,
|
41
|
+
capture_err: false,
|
42
|
+
sorbet_bin: sorbet
|
43
|
+
)
|
44
|
+
|
45
|
+
check_sorbet_segfault(exit_code)
|
39
46
|
say_error(output, status: nil, nl: false)
|
40
47
|
exit(status)
|
41
48
|
end
|
42
49
|
|
43
|
-
output, status = T.unsafe(Spoom::Sorbet).srb_tc(
|
50
|
+
output, status, exit_code = T.unsafe(Spoom::Sorbet).srb_tc(
|
51
|
+
*arg,
|
52
|
+
path: path,
|
53
|
+
capture_err: true,
|
54
|
+
sorbet_bin: sorbet
|
55
|
+
)
|
56
|
+
|
57
|
+
check_sorbet_segfault(exit_code)
|
58
|
+
|
44
59
|
if status
|
45
60
|
say_error(output, status: nil, nl: false)
|
46
61
|
exit(0)
|
@@ -99,7 +114,7 @@ module Spoom
|
|
99
114
|
cyan = !cyan
|
100
115
|
next
|
101
116
|
end
|
102
|
-
word << (cyan ? c
|
117
|
+
word << (cyan ? cyan(c) : red(c))
|
103
118
|
end
|
104
119
|
word.string
|
105
120
|
end
|
data/lib/spoom/sorbet.rb
CHANGED
@@ -15,6 +15,8 @@ module Spoom
|
|
15
15
|
GEM_PATH = Gem::Specification.find_by_name("sorbet-static").full_gem_path
|
16
16
|
BIN_PATH = (Pathname.new(GEM_PATH) / "libexec" / "sorbet").to_s
|
17
17
|
|
18
|
+
SEGFAULT_CODE = 139
|
19
|
+
|
18
20
|
class << self
|
19
21
|
extend T::Sig
|
20
22
|
|
@@ -24,7 +26,7 @@ module Spoom
|
|
24
26
|
path: String,
|
25
27
|
capture_err: T::Boolean,
|
26
28
|
sorbet_bin: T.nilable(String)
|
27
|
-
).returns([String, T::Boolean])
|
29
|
+
).returns([String, T::Boolean, Integer])
|
28
30
|
end
|
29
31
|
def srb(*arg, path: '.', capture_err: false, sorbet_bin: nil)
|
30
32
|
if sorbet_bin
|
@@ -41,7 +43,7 @@ module Spoom
|
|
41
43
|
path: String,
|
42
44
|
capture_err: T::Boolean,
|
43
45
|
sorbet_bin: T.nilable(String)
|
44
|
-
).returns([String, T::Boolean])
|
46
|
+
).returns([String, T::Boolean, Integer])
|
45
47
|
end
|
46
48
|
def srb_tc(*arg, path: '.', capture_err: false, sorbet_bin: nil)
|
47
49
|
arg.prepend("tc") unless sorbet_bin
|
data/lib/spoom/version.rb
CHANGED
data/lib/spoom.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
require "sorbet-runtime"
|
5
|
+
require "pathname"
|
5
6
|
|
6
7
|
module Spoom
|
7
8
|
extend T::Sig
|
@@ -16,12 +17,14 @@ module Spoom
|
|
16
17
|
arg: String,
|
17
18
|
path: String,
|
18
19
|
capture_err: T::Boolean
|
19
|
-
).returns([String, T::Boolean])
|
20
|
+
).returns([String, T::Boolean, Integer])
|
20
21
|
end
|
21
22
|
def self.exec(cmd, *arg, path: '.', capture_err: false)
|
22
23
|
method = capture_err ? "popen2e" : "popen2"
|
23
|
-
Open3.send(method, [cmd, *arg].join(" "), chdir: path) do |_,
|
24
|
-
|
24
|
+
Open3.send(method, [cmd, *arg].join(" "), chdir: path) do |_, stdout, thread|
|
25
|
+
out = stdout.read
|
26
|
+
status = T.cast(thread.value, Process::Status)
|
27
|
+
[out, status.success?, status.exitstatus]
|
25
28
|
end
|
26
29
|
end
|
27
30
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spoom
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alexandre Terrasa
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '5.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: minitest-reporters
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: sorbet-runtime
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|