Skip to content

Commit eea6d05

Browse files
committed
Rspec instructions in the README
1 parent b9ef6da commit eea6d05

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ What if I told you, that there was a library that helped find your missing `def`
3232

3333
How much would you pay for such a library? A million, a billion, a trillion? Well friends, today is your lucky day because you can use this library today for free!
3434

35-
## Installation
35+
## Installation in your codebase
3636

3737
To automatically search syntax errors when they happen, add this to your Gemfile:
3838

@@ -50,6 +50,16 @@ If your application is not calling `Bundler.require` then you must manually add
5050
require "syntax_search/auto"
5151
```
5252

53+
If you're using rspec add this to your `.rspec` file:
54+
55+
```
56+
--require syntax_search/auto
57+
```
58+
59+
> This is needed because people can execute a single test file via `bundle exec rspec path/to/file_spec.rb` and if that file has a syntax error, it won't load `spec_helper.rb` to trigger any requires.
60+
61+
## Install the CLI
62+
5363
To get the CLI and manually search for syntax errors, install the gem:
5464

5565
$ gem install syntax_search
@@ -73,6 +83,10 @@ We know that source code that does not contain a syntax error can be parsed. We
7383

7484
Since there can be multiple syntax errors in a document it's not good enough to check individual code blocks, we've got to check multiple at the same time. We will keep creating and adding new blocks to our search until we detect that our "frontier" (which contains all of our blocks) contains the syntax error. After this, we can stop our search and instead focus on filtering to find the smallest subset of blocks that contain the syntax error.
7585

86+
Here's an example:
87+
88+
![](assets/syntax_search.gif)
89+
7690
## How is source code broken up into smaller blocks?
7791

7892
By definition source code with a syntax error in it cannot be parsed, so we have to guess how to chunk up the file into smaller pieces. Once we've split up the file we can safely rule out or zoom into a specific piece of code to determine the location of the syntax error. This libary uses indentation and empty lines to make guesses about what might be a "block" of code. Once we've got a chunk of code, we can test it.

assets/syntax_search.gif

53 KB
Loading

0 commit comments

Comments
 (0)