spoom 1.1.6 → 1.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spoom/cli/bump.rb +3 -1
- data/lib/spoom/sorbet/errors.rb +26 -19
- data/lib/spoom/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa8ac9092af39d9a951ffe28c217f9f7516d25e316483ba9398df6fbb220f10a
|
4
|
+
data.tar.gz: 5140065943452ad4ca4de375c13b27bd24003fa828ac4fe9594a7f66d11ac970
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b706423681d2acdbdd167a3076229953df609036254c3dcbc470a828078857318c79c3bdbddfa422ad9f26ddeb01fe464d6ab3173949d47cdc490d799403b94
|
7
|
+
data.tar.gz: 13b7086057c38d3a1344f2920c42c8c9208d0f3c8c438eae02b3f0b32a21e0a35f526e6e5607c5235af2fad02d0aa0365678f9ae7ce88d13d7404f142890fe07
|
data/lib/spoom/cli/bump.rb
CHANGED
@@ -83,8 +83,10 @@ module Spoom
|
|
83
83
|
exit(files_to_bump.empty?)
|
84
84
|
end
|
85
85
|
|
86
|
+
error_url_base = Spoom::Sorbet::Errors::DEFAULT_ERROR_URL_BASE
|
86
87
|
output, status, exit_code = Sorbet.srb_tc(
|
87
88
|
"--no-error-sections",
|
89
|
+
"--error-url-base=#{error_url_base}",
|
88
90
|
path: exec_path,
|
89
91
|
capture_err: true,
|
90
92
|
sorbet_bin: options[:sorbet]
|
@@ -104,7 +106,7 @@ module Spoom
|
|
104
106
|
exit(files_to_bump.empty?)
|
105
107
|
end
|
106
108
|
|
107
|
-
errors = Sorbet::Errors::Parser.parse_string(output)
|
109
|
+
errors = Sorbet::Errors::Parser.parse_string(output, error_url_base: error_url_base)
|
108
110
|
|
109
111
|
files_with_errors = errors.map do |err|
|
110
112
|
path = File.expand_path(err.file)
|
data/lib/spoom/sorbet/errors.rb
CHANGED
@@ -6,6 +6,8 @@ module Spoom
|
|
6
6
|
module Errors
|
7
7
|
extend T::Sig
|
8
8
|
|
9
|
+
DEFAULT_ERROR_URL_BASE = "https://srb.help/"
|
10
|
+
|
9
11
|
# Parse errors from Sorbet output
|
10
12
|
class Parser
|
11
13
|
extend T::Sig
|
@@ -18,28 +20,16 @@ module Spoom
|
|
18
20
|
"or set SORBET_SILENCE_DEV_MESSAGE=1 in your shell environment.",
|
19
21
|
]
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
# followed by anything that is not a colon character
|
25
|
-
: # match the filename - line number seperator
|
26
|
-
(\d+) # capture the line number
|
27
|
-
:\s # match the line number - error message separator
|
28
|
-
(.*) # capture the error message
|
29
|
-
\shttps://srb.help/ # match the error code url prefix
|
30
|
-
(\d+) # capture the error code
|
31
|
-
$ # match end of line
|
32
|
-
}x.freeze
|
33
|
-
|
34
|
-
sig { params(output: String).returns(T::Array[Error]) }
|
35
|
-
def self.parse_string(output)
|
36
|
-
parser = Spoom::Sorbet::Errors::Parser.new
|
23
|
+
sig { params(output: String, error_url_base: String).returns(T::Array[Error]) }
|
24
|
+
def self.parse_string(output, error_url_base: DEFAULT_ERROR_URL_BASE)
|
25
|
+
parser = Spoom::Sorbet::Errors::Parser.new(error_url_base: error_url_base)
|
37
26
|
parser.parse(output)
|
38
27
|
end
|
39
28
|
|
40
|
-
sig { void }
|
41
|
-
def initialize
|
29
|
+
sig { params(error_url_base: String).void }
|
30
|
+
def initialize(error_url_base: DEFAULT_ERROR_URL_BASE)
|
42
31
|
@errors = []
|
32
|
+
@error_line_match_regex = error_line_match_regexp(error_url_base)
|
43
33
|
@current_error = nil
|
44
34
|
end
|
45
35
|
|
@@ -66,9 +56,26 @@ module Spoom
|
|
66
56
|
|
67
57
|
private
|
68
58
|
|
59
|
+
sig { params(error_url_base: String).returns(Regexp) }
|
60
|
+
def error_line_match_regexp(error_url_base)
|
61
|
+
url = Regexp.escape(error_url_base)
|
62
|
+
%r{
|
63
|
+
^ # match beginning of line
|
64
|
+
(\S[^:]*) # capture filename as something that starts with a non-space character
|
65
|
+
# followed by anything that is not a colon character
|
66
|
+
: # match the filename - line number seperator
|
67
|
+
(\d+) # capture the line number
|
68
|
+
:\s # match the line number - error message separator
|
69
|
+
(.*) # capture the error message
|
70
|
+
\s#{url} # match the error code url prefix
|
71
|
+
(\d+) # capture the error code
|
72
|
+
$ # match end of line
|
73
|
+
}x
|
74
|
+
end
|
75
|
+
|
69
76
|
sig { params(line: String).returns(T.nilable(Error)) }
|
70
77
|
def match_error_line(line)
|
71
|
-
match = line.match(
|
78
|
+
match = line.match(@error_line_match_regex)
|
72
79
|
return unless match
|
73
80
|
|
74
81
|
file, line, message, code = match.captures
|
data/lib/spoom/version.rb
CHANGED
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.7
|
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-12-
|
11
|
+
date: 2021-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|