syntax_tree 3.0.0 → 3.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 +9 -1
- data/Gemfile.lock +2 -2
- data/lib/syntax_tree/cli.rb +25 -25
- data/lib/syntax_tree/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: 499aba04c732c3101f3e3ebb7d487a19842781a0a97b67fad047c2cf9bbe2bcb
|
4
|
+
data.tar.gz: dc9e28898951ae74f3a053b261b8d1e752567917bbb8eb34a4aa22af6b49b716
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a8cdd3933efaaa8898cfa25bebd3e52d3b6632081319d8ddded59dacb996ebd11232d1060e408eb93bdb4211aa4d2775bfce970ba868264f7846dcb63873e5e
|
7
|
+
data.tar.gz: 673c601ce6a25cc4875b2041710b4a85f5114a24deb1cb5e3bf69a464e072f72f24f2e13cb3aa89d95076a5d7643beb6469ccd669018e75d9ac998aeb0a10ddf
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [3.0.1] - 2022-07-15
|
10
|
+
|
11
|
+
### Changed
|
12
|
+
|
13
|
+
- [#112](https://github.com/ruby-syntax-tree/syntax_tree/pull/112) - Fix parallel CLI execution by not short-circuiting with the `||` operator.
|
14
|
+
|
9
15
|
## [3.0.0] - 2022-07-04
|
10
16
|
|
11
17
|
### Changed
|
@@ -288,7 +294,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
|
|
288
294
|
|
289
295
|
- 🎉 Initial release! 🎉
|
290
296
|
|
291
|
-
[unreleased]: https://github.com/ruby-syntax-tree/syntax_tree/compare/
|
297
|
+
[unreleased]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v3.0.1...HEAD
|
298
|
+
[3.0.1]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v3.0.0...v3.0.1
|
299
|
+
[3.0.0]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v2.9.0...v3.0.0
|
292
300
|
[2.9.0]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v2.8.0...v2.9.0
|
293
301
|
[2.8.0]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v2.7.1...v2.8.0
|
294
302
|
[2.7.1]: https://github.com/ruby-syntax-tree/syntax_tree/compare/v2.7.0...v2.7.1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
syntax_tree (3.0.
|
4
|
+
syntax_tree (3.0.1)
|
5
5
|
prettier_print
|
6
6
|
|
7
7
|
GEM
|
@@ -19,7 +19,7 @@ GEM
|
|
19
19
|
rake (13.0.6)
|
20
20
|
regexp_parser (2.5.0)
|
21
21
|
rexml (3.2.5)
|
22
|
-
rubocop (1.31.
|
22
|
+
rubocop (1.31.2)
|
23
23
|
json (~> 2.3)
|
24
24
|
parallel (~> 1.10)
|
25
25
|
parser (>= 3.1.0.0)
|
data/lib/syntax_tree/cli.rb
CHANGED
@@ -315,23 +315,7 @@ module SyntaxTree
|
|
315
315
|
|
316
316
|
# At the end, we're going to return whether or not this worker ever
|
317
317
|
# encountered an error.
|
318
|
-
|
319
|
-
with_workers(queue) do |item|
|
320
|
-
action.run(item)
|
321
|
-
false
|
322
|
-
rescue Parser::ParseError => error
|
323
|
-
warn("Error: #{error.message}")
|
324
|
-
highlight_error(error, item.source)
|
325
|
-
true
|
326
|
-
rescue Check::UnformattedError, Debug::NonIdempotentFormatError
|
327
|
-
true
|
328
|
-
rescue StandardError => error
|
329
|
-
warn(error.message)
|
330
|
-
warn(error.backtrace)
|
331
|
-
true
|
332
|
-
end
|
333
|
-
|
334
|
-
if errored
|
318
|
+
if process_queue(queue, action)
|
335
319
|
action.failure
|
336
320
|
1
|
337
321
|
else
|
@@ -342,13 +326,11 @@ module SyntaxTree
|
|
342
326
|
|
343
327
|
private
|
344
328
|
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
return yield queue.shift if queue.size == 1
|
349
|
-
|
329
|
+
# Processes each item in the queue with the given action. Returns whether
|
330
|
+
# or not any errors were encountered.
|
331
|
+
def process_queue(queue, action)
|
350
332
|
workers =
|
351
|
-
Etc.nprocessors.times.map do
|
333
|
+
[Etc.nprocessors, queue.size].min.times.map do
|
352
334
|
Thread.new do
|
353
335
|
# Propagate errors in the worker threads up to the parent thread.
|
354
336
|
Thread.current.abort_on_exception = true
|
@@ -360,7 +342,25 @@ module SyntaxTree
|
|
360
342
|
|
361
343
|
# While there is still work left to do, shift off the queue and
|
362
344
|
# process the item.
|
363
|
-
|
345
|
+
until queue.empty?
|
346
|
+
item = queue.shift
|
347
|
+
errored |=
|
348
|
+
begin
|
349
|
+
action.run(item)
|
350
|
+
false
|
351
|
+
rescue Parser::ParseError => error
|
352
|
+
warn("Error: #{error.message}")
|
353
|
+
highlight_error(error, item.source)
|
354
|
+
true
|
355
|
+
rescue Check::UnformattedError,
|
356
|
+
Debug::NonIdempotentFormatError
|
357
|
+
true
|
358
|
+
rescue StandardError => error
|
359
|
+
warn(error.message)
|
360
|
+
warn(error.backtrace)
|
361
|
+
true
|
362
|
+
end
|
363
|
+
end
|
364
364
|
|
365
365
|
# At the end, we're going to return whether or not this worker
|
366
366
|
# ever encountered an error.
|
@@ -368,7 +368,7 @@ module SyntaxTree
|
|
368
368
|
end
|
369
369
|
end
|
370
370
|
|
371
|
-
workers.inject(
|
371
|
+
workers.map(&:value).inject(:|)
|
372
372
|
end
|
373
373
|
|
374
374
|
# Highlights a snippet from a source and parse error.
|
data/lib/syntax_tree/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: syntax_tree
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Newton
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-07-
|
11
|
+
date: 2022-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: prettier_print
|