dead_end 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/dead_end/around_block_scan.rb +14 -5
- data/lib/dead_end/code_frontier.rb +1 -1
- data/lib/dead_end/internals.rb +6 -4
- data/lib/dead_end/parse_blocks_from_indent_line.rb +1 -1
- data/lib/dead_end/version.rb +1 -1
- 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: 91a09272a46d3519c0ca78dcd3fd38199898fea1d6261c18576ff832e55351bd
|
4
|
+
data.tar.gz: f50e76a749fe0ecdf871fdaf6aead25132cb26a5d03068cbc611476c6eb06a8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89e7c7734a7a74c735479d35418ffda7d53557ce7d0c8a47fb2a67f5581d87d1be8117ff62d6590ed2cbf633fb566b797a6f3c3033e6c6a50b543cfbba9f4718
|
7
|
+
data.tar.gz: 2804e68394e928f36803859eb0e193bf96dc088138c4fea87510d6bc0d70e9c5485b6ca4c402762174c1ba3b139b9a4d1af28a6b31e87ec4e36859f659afc42d
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## HEAD (unreleased)
|
2
2
|
|
3
|
+
## 1.0.1
|
4
|
+
|
5
|
+
- Fix performance issue when evaluating multiple block combinations (https://github.com/zombocom/dead_end/pull/35)
|
6
|
+
|
3
7
|
## 1.0.0
|
4
8
|
|
5
9
|
- Gem name changed from `syntax_search` to `dead_end` (https://github.com/zombocom/syntax_search/pull/30)
|
data/Gemfile.lock
CHANGED
@@ -153,11 +153,20 @@ module DeadEnd
|
|
153
153
|
self.scan_while {|line| line.not_empty? && line.indent >= @orig_indent }
|
154
154
|
end
|
155
155
|
|
156
|
+
def next_up
|
157
|
+
@code_lines[before_index.pred]
|
158
|
+
end
|
159
|
+
|
160
|
+
def next_down
|
161
|
+
@code_lines[after_index.next]
|
162
|
+
end
|
163
|
+
|
156
164
|
def scan_adjacent_indent
|
157
|
-
|
158
|
-
|
165
|
+
before_after_indent = []
|
166
|
+
before_after_indent << next_up&.indent || 0
|
167
|
+
before_after_indent << next_down&.indent || 0
|
159
168
|
|
160
|
-
indent =
|
169
|
+
indent = before_after_indent.min
|
161
170
|
self.scan_while {|line| line.not_empty? && line.indent >= indent }
|
162
171
|
|
163
172
|
self
|
@@ -183,11 +192,11 @@ module DeadEnd
|
|
183
192
|
end
|
184
193
|
|
185
194
|
private def before_lines
|
186
|
-
@code_lines[0...@orig_before_index]
|
195
|
+
@code_lines[0...@orig_before_index] || []
|
187
196
|
end
|
188
197
|
|
189
198
|
private def after_lines
|
190
|
-
@code_lines[
|
199
|
+
@code_lines[after_index.next..-1] || []
|
191
200
|
end
|
192
201
|
end
|
193
202
|
end
|
@@ -143,7 +143,7 @@ module DeadEnd
|
|
143
143
|
# Given that we know our syntax error exists somewhere in our frontier, we want to find
|
144
144
|
# the smallest possible set of blocks that contain all the syntax errors
|
145
145
|
def detect_invalid_blocks
|
146
|
-
self.class.combination(@frontier).detect do |block_array|
|
146
|
+
self.class.combination(@frontier.select(&:invalid?)).detect do |block_array|
|
147
147
|
holds_all_syntax_errors?(block_array)
|
148
148
|
end || []
|
149
149
|
end
|
data/lib/dead_end/internals.rb
CHANGED
@@ -37,9 +37,10 @@ module DeadEnd
|
|
37
37
|
raise e
|
38
38
|
end
|
39
39
|
|
40
|
-
def self.call(source: , filename: , terminal: false, record_dir: nil, timeout: TIMEOUT_DEFAULT)
|
40
|
+
def self.call(source: , filename: , terminal: false, record_dir: nil, timeout: TIMEOUT_DEFAULT, io: $stderr)
|
41
41
|
search = nil
|
42
42
|
Timeout.timeout(timeout) do
|
43
|
+
record_dir ||= ENV["DEBUG"] ? "tmp" : nil
|
43
44
|
search = CodeSearch.new(source, record_dir: record_dir).call
|
44
45
|
end
|
45
46
|
|
@@ -50,10 +51,11 @@ module DeadEnd
|
|
50
51
|
terminal: terminal,
|
51
52
|
code_lines: search.code_lines,
|
52
53
|
invalid_obj: invalid_type(source),
|
53
|
-
io:
|
54
|
+
io: io
|
54
55
|
).call
|
55
|
-
rescue Timeout::Error
|
56
|
-
|
56
|
+
rescue Timeout::Error => e
|
57
|
+
io.puts "Search timed out DEAD_END_TIMEOUT=#{timeout}, run with DEBUG=1 for more info"
|
58
|
+
io.puts e.backtrace.first(3).join($/)
|
57
59
|
end
|
58
60
|
|
59
61
|
# Used for counting spaces
|
data/lib/dead_end/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dead_end
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- schneems
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-12-
|
11
|
+
date: 2020-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: When you get an "unexpected end" in your syntax this gem helps you find
|
14
14
|
it
|
@@ -76,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
76
|
- !ruby/object:Gem::Version
|
77
77
|
version: '0'
|
78
78
|
requirements: []
|
79
|
-
rubygems_version: 3.
|
79
|
+
rubygems_version: 3.0.3
|
80
80
|
signing_key:
|
81
81
|
specification_version: 4
|
82
82
|
summary: Find syntax errors in your source in a snap
|