dead_end 1.1.2 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83ee512040b172db6ab10b5bc6220e856734653bb4c033291a5b2d6210485996
4
- data.tar.gz: b0812e0b2f605101c0bdef7f5d08886d404e5c02f4e28bb11e982e6cabef4636
3
+ metadata.gz: 49c72ccc76282ed1e7f9256f51f0adc1c886e1a05b3951e8f86d45eca0f22609
4
+ data.tar.gz: 2d1fc7eefe0fb741a516adf09ea5c5472d8f678572cc73858a3a1b4468b10457
5
5
  SHA512:
6
- metadata.gz: 69cd9208b68cd671f90fe82ef1cf69e2f7037286360665b648690d51e0e9206f4e53abe3c4da755c2fcec08ed76261ca85a7e17c2dfcef7589880d149c33daf3
7
- data.tar.gz: b78698db009e17b234da6aa1cbc185b9c5d391e9466685e823911ed2f725b02c0e2d2d14a79fed02a3e907cbd84d96314fb335ea80aa6cc78adf2d1ba8fff4b8
6
+ metadata.gz: a4007362e70da478bb4590ad7196897b50fe4ab31bf384a4e4a80df44b906cee5faadf992a400a45d85e16b4864a42f17cc49490e8411020a4058310c088d84c
7
+ data.tar.gz: 1cd5eaa6385bf7e451801c33d13f89a69c6412608067dc8acc23d7955ecc8ca5796ae839b966767a37f12b48e0d280fb0a1946e9d5e24f92edf14b2913b36c68
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.7
4
+
5
+ - Fix sinatra support for `require_relative` (https://github.com/zombocom/dead_end/pull/63)
6
+
7
+ ## 1.1.6
8
+
9
+ - Consider if syntax error caused an unexpected variable instead of end (https://github.com/zombocom/dead_end/pull/58)
10
+
11
+ ## 1.1.5
12
+
13
+ - Parse error once and not twice if there's more than one available (https://github.com/zombocom/dead_end/pull/57)
14
+
15
+ ## 1.1.4
16
+
17
+ - Avoid including demo gif in built gem (https://github.com/zombocom/dead_end/pull/53)
18
+
19
+ ## 1.1.3
20
+
21
+ - Add compatibility with zeitwerk (https://github.com/zombocom/dead_end/pull/52)
22
+
3
23
  ## 1.1.2
4
24
 
5
25
  - Namespace Kernel method aliases (https://github.com/zombocom/dead_end/pull/51)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dead_end (1.1.2)
4
+ dead_end (1.1.7)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -33,4 +33,4 @@ DEPENDENCIES
33
33
  stackprof
34
34
 
35
35
  BUNDLED WITH
36
- 2.2.3
36
+ 2.2.16
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,6 +5,8 @@ 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
+ module_function
9
+
8
10
  alias_method :dead_end_original_require, :require
9
11
  alias_method :dead_end_original_require_relative, :require_relative
10
12
  alias_method :dead_end_original_load, :load
@@ -25,7 +27,7 @@ module Kernel
25
27
  if Pathname.new(file).absolute?
26
28
  dead_end_original_require file
27
29
  else
28
- dead_end_original_require File.expand_path("../#{file}", caller_locations(1, 1)[0].absolute_path)
30
+ dead_end_original_require File.expand_path("../#{file}", Kernel.caller_locations(1, 1)[0].absolute_path)
29
31
  end
30
32
  rescue SyntaxError => e
31
33
  DeadEnd.handle_error(e)
@@ -82,7 +82,7 @@ module DeadEnd
82
82
  closed: `{ }`.
83
83
  EOM
84
84
  else
85
- "DeadEnd: Unmatched #{@invalid_obj.unmatched_symbol}` detected"
85
+ "DeadEnd: Unmatched `#{@invalid_obj.unmatched_symbol}` detected"
86
86
  end
87
87
  end
88
88
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeadEnd
4
- VERSION = "1.1.2"
4
+ VERSION = "1.1.7"
5
5
  end
@@ -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
- if @error.match?(/unexpected end-of-input/)
50
+ case @error
51
+ when /unexpected end-of-input/
49
52
  @error_symbol = :missing_end
50
- elsif @error.match?(/expecting end-of-input/)
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
- match = @error.match(/expecting '(?<unmatched_symbol>.*)'/)
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.2
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - schneems
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-11 00:00:00.000000000 Z
11
+ date: 2021-05-10 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
@@ -76,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
75
  - !ruby/object:Gem::Version
77
76
  version: '0'
78
77
  requirements: []
79
- rubygems_version: 3.1.4
78
+ rubygems_version: 3.2.15
80
79
  signing_key:
81
80
  specification_version: 4
82
81
  summary: Find syntax errors in your source in a snap
Binary file