Skip to content

Expand search for both unexpected end-of-input as well as unexpected end #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## HEAD (unreleased)

## 0.1.1

- Fix error message detection to fire on more rubies ()

## 0.1.0

- Initial release
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
syntax_search (0.1.0)
syntax_search (0.1.1)
parser

GEM
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,18 @@ And then execute:

$ bundle install

If your application is not calling `Bundler.require` then you must manually add a require:

```ruby
require "syntax_search/auto"
```

To get the CLI and manually search for syntax errors, install the gem:

$ gem install syntax_search

This gives you the CLI command `$ syntax_search` for more info run `$ syntax_search --help`.

## What does it do?

When your code triggers a SyntaxError due to an "unexpected `end'" in a file, this library fires to narrow down your search to the most likely offending locations.
Expand Down
2 changes: 1 addition & 1 deletion lib/syntax_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Error < StandardError; end
SEARCH_SOURCE_ON_ERROR_DEFAULT = true

def self.handle_error(e, search_source_on_error: SEARCH_SOURCE_ON_ERROR_DEFAULT)
raise e if !e.message.include?("expecting end-of-input")
raise e if !e.message.include?("end-of-input")

filename = e.message.split(":").first

Expand Down
2 changes: 1 addition & 1 deletion lib/syntax_search/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module SyntaxErrorSearch
VERSION = "0.1.0"
VERSION = "0.1.1"
end