dead_end 1.1.1 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +9 -0
- data/CHANGELOG.md +20 -0
- data/Gemfile.lock +2 -2
- data/dead_end.gemspec +1 -1
- data/lib/dead_end/auto.rb +11 -9
- data/lib/dead_end/display_invalid_blocks.rb +1 -1
- data/lib/dead_end/version.rb +1 -1
- data/lib/dead_end/who_dis_syntax_error.rb +12 -9
- metadata +2 -3
- data/assets/syntax_search.gif +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac6f2a5183bb09317d83211f3b1f7049154011ae0fbd73f08152864303a763bd
|
4
|
+
data.tar.gz: b6ea7a79863ffcc8664f3b693fabe49635f17fa48ed8e4529eeb48de9808b9c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5b1524a4a5844d932dfdbd7874b81c43fbe4a98ac30ee4258e8eaefbf33a98d470a96721ce7ee0ec8e61e5f3ce525dabecde40b3900f5e5b8964b71676d49df
|
7
|
+
data.tar.gz: f9c2bf9a500f3428627a4de15af3e7d75ce0446e2042f68b39ab27a97da0c60171b7449241a60b358c8d5045c46f65a3bab3ed1d11cd4881eb5c8da06414d5ba
|
data/.circleci/config.yml
CHANGED
@@ -32,6 +32,14 @@ jobs:
|
|
32
32
|
- ruby/install-deps
|
33
33
|
- <<: *unit
|
34
34
|
|
35
|
+
"ruby-3-0":
|
36
|
+
docker:
|
37
|
+
- image: circleci/ruby:3.0
|
38
|
+
steps:
|
39
|
+
- checkout
|
40
|
+
- ruby/install-deps
|
41
|
+
- <<: *unit
|
42
|
+
|
35
43
|
workflows:
|
36
44
|
version: 2
|
37
45
|
build:
|
@@ -39,3 +47,4 @@ workflows:
|
|
39
47
|
- "ruby-2-5"
|
40
48
|
- "ruby-2-6"
|
41
49
|
- "ruby-2-7"
|
50
|
+
- "ruby-3-0"
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,25 @@
|
|
1
1
|
## HEAD (unreleased)
|
2
2
|
|
3
|
+
## 1.1.6
|
4
|
+
|
5
|
+
- Consider if syntax error caused an unexpected variable instead of end (https://github.com/zombocom/dead_end/pull/58)
|
6
|
+
|
7
|
+
## 1.1.5
|
8
|
+
|
9
|
+
- Parse error once and not twice if there's more than one available (https://github.com/zombocom/dead_end/pull/57)
|
10
|
+
|
11
|
+
## 1.1.4
|
12
|
+
|
13
|
+
- Avoid including demo gif in built gem (https://github.com/zombocom/dead_end/pull/53)
|
14
|
+
|
15
|
+
## 1.1.3
|
16
|
+
|
17
|
+
- Add compatibility with zeitwerk (https://github.com/zombocom/dead_end/pull/52)
|
18
|
+
|
19
|
+
## 1.1.2
|
20
|
+
|
21
|
+
- Namespace Kernel method aliases (https://github.com/zombocom/dead_end/pull/51)
|
22
|
+
|
3
23
|
## 1.1.1
|
4
24
|
|
5
25
|
- Safer NoMethodError annotation (https://github.com/zombocom/dead_end/pull/48)
|
data/Gemfile.lock
CHANGED
data/dead_end.gemspec
CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
# Specify which files should be added to the gem when it is released.
|
21
21
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
22
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
23
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|assets)/}) }
|
24
24
|
end
|
25
25
|
spec.bindir = "exe"
|
26
26
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
data/lib/dead_end/auto.rb
CHANGED
@@ -5,27 +5,29 @@ require_relative "../dead_end/internals"
|
|
5
5
|
# Monkey patch kernel to ensure that all `require` calls call the same
|
6
6
|
# method
|
7
7
|
module Kernel
|
8
|
-
|
9
|
-
|
10
|
-
alias_method :
|
8
|
+
module_function
|
9
|
+
|
10
|
+
alias_method :dead_end_original_require, :require
|
11
|
+
alias_method :dead_end_original_require_relative, :require_relative
|
12
|
+
alias_method :dead_end_original_load, :load
|
11
13
|
|
12
14
|
def load(file, wrap = false)
|
13
|
-
|
15
|
+
dead_end_original_load(file)
|
14
16
|
rescue SyntaxError => e
|
15
17
|
DeadEnd.handle_error(e)
|
16
18
|
end
|
17
19
|
|
18
20
|
def require(file)
|
19
|
-
|
21
|
+
dead_end_original_require(file)
|
20
22
|
rescue SyntaxError => e
|
21
23
|
DeadEnd.handle_error(e)
|
22
24
|
end
|
23
25
|
|
24
26
|
def require_relative(file)
|
25
27
|
if Pathname.new(file).absolute?
|
26
|
-
|
28
|
+
dead_end_original_require file
|
27
29
|
else
|
28
|
-
|
30
|
+
dead_end_original_require File.expand_path("../#{file}", caller_locations(1, 1)[0].absolute_path)
|
29
31
|
end
|
30
32
|
rescue SyntaxError => e
|
31
33
|
DeadEnd.handle_error(e)
|
@@ -62,7 +64,7 @@ end
|
|
62
64
|
# we can attempt to disable this behavior in a production context.
|
63
65
|
if !DeadEnd::IsProduction.call
|
64
66
|
class NoMethodError
|
65
|
-
alias :
|
67
|
+
alias :dead_end_original_to_s :to_s
|
66
68
|
|
67
69
|
def to_s
|
68
70
|
return super if DeadEnd::IsProduction.call
|
@@ -93,7 +95,7 @@ if !DeadEnd::IsProduction.call
|
|
93
95
|
message << $/
|
94
96
|
message
|
95
97
|
rescue => e
|
96
|
-
puts "DeadEnd Internal error: #{e.
|
98
|
+
puts "DeadEnd Internal error: #{e.dead_end_original_to_s}"
|
97
99
|
puts "DeadEnd Internal backtrace:"
|
98
100
|
puts backtrace.map {|l| " " + l }.join($/)
|
99
101
|
super
|
data/lib/dead_end/version.rb
CHANGED
@@ -42,22 +42,25 @@ module DeadEnd
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def on_parse_error(msg)
|
45
|
+
return if @error_symbol && @unmatched_symbol
|
46
|
+
|
45
47
|
@error = msg
|
46
48
|
@unmatched_symbol = :unknown
|
47
49
|
|
48
|
-
|
50
|
+
case @error
|
51
|
+
when /unexpected end-of-input/
|
49
52
|
@error_symbol = :missing_end
|
50
|
-
|
51
|
-
@error_symbol = :unmatched_syntax
|
53
|
+
when /expecting end-of-input/
|
52
54
|
@unmatched_symbol = :end
|
53
|
-
elsif @error.match?(/unexpected `end'/) || # Ruby 2.7 & 3.0
|
54
|
-
@error.match?(/unexpected end,/) || # Ruby 2.6
|
55
|
-
@error.match?(/unexpected keyword_end/) # Ruby 2.5
|
56
|
-
|
57
55
|
@error_symbol = :unmatched_syntax
|
56
|
+
when /unexpected .* expecting '(?<unmatched_symbol>.*)'/
|
57
|
+
@unmatched_symbol = $1.to_sym if $1
|
58
|
+
@error_symbol = :unmatched_syntax
|
59
|
+
when /unexpected `end'/, # Ruby 2.7 and 3.0
|
60
|
+
/unexpected end/, # Ruby 2.6
|
61
|
+
/unexpected keyword_end/i # Ruby 2.5
|
58
62
|
|
59
|
-
|
60
|
-
@unmatched_symbol = match[:unmatched_symbol].to_sym if match
|
63
|
+
@error_symbol = :unmatched_syntax
|
61
64
|
else
|
62
65
|
@error_symbol = :unknown
|
63
66
|
end
|
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.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- schneems
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-25 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
|
@@ -31,7 +31,6 @@ files:
|
|
31
31
|
- LICENSE.txt
|
32
32
|
- README.md
|
33
33
|
- Rakefile
|
34
|
-
- assets/syntax_search.gif
|
35
34
|
- bin/console
|
36
35
|
- bin/setup
|
37
36
|
- dead_end.gemspec
|
data/assets/syntax_search.gif
DELETED
Binary file
|