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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e58e5584ba33b3b678ddedb06972121af9dd4b9a8b7f1b6941f6bb939086107a
4
- data.tar.gz: c1cc668af1f42ace8318a47ac0b813815e4e6a9ee1d942593b1ff37b9b41cbc2
3
+ metadata.gz: fa8ac9092af39d9a951ffe28c217f9f7516d25e316483ba9398df6fbb220f10a
4
+ data.tar.gz: 5140065943452ad4ca4de375c13b27bd24003fa828ac4fe9594a7f66d11ac970
5
5
  SHA512:
6
- metadata.gz: f389c4b463b7bd1c4a275e844ed68d0d9e7279fefe4b1e9ed29a1c9238c25ad941aa494dee63c4f15dab288602a22efce3da6e7b08c795b1cb99fb236e2edf39
7
- data.tar.gz: 7071bc29a1d13087d0e0527832b7619af180b20375c006122d059c640a606a55edd68234e098cf2360f06c00aa165a7a673a4d009275707be830bebef947936a
6
+ metadata.gz: 1b706423681d2acdbdd167a3076229953df609036254c3dcbc470a828078857318c79c3bdbddfa422ad9f26ddeb01fe464d6ab3173949d47cdc490d799403b94
7
+ data.tar.gz: 13b7086057c38d3a1344f2920c42c8c9208d0f3c8c438eae02b3f0b32a21e0a35f526e6e5607c5235af2fad02d0aa0365678f9ae7ce88d13d7404f142890fe07
@@ -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)
@@ -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
- ERROR_LINE_MATCH_REGEX = %r{
22
- ^ # match beginning of line
23
- (\S[^:]*) # capture filename as something that starts with a non-space character
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(ERROR_LINE_MATCH_REGEX)
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
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Spoom
5
- VERSION = "1.1.6"
5
+ VERSION = "1.1.7"
6
6
  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.6
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-08 00:00:00.000000000 Z
11
+ date: 2021-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler