You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-1
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,7 @@ What if I told you, that there was a library that helped find your missing `def`
32
32
33
33
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!
34
34
35
-
## Installation
35
+
## Installation in your codebase
36
36
37
37
To automatically search syntax errors when they happen, add this to your Gemfile:
38
38
@@ -50,6 +50,16 @@ If your application is not calling `Bundler.require` then you must manually add
50
50
require"syntax_search/auto"
51
51
```
52
52
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
+
53
63
To get the CLI and manually search for syntax errors, install the gem:
54
64
55
65
$ gem install syntax_search
@@ -73,6 +83,10 @@ We know that source code that does not contain a syntax error can be parsed. We
73
83
74
84
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.
75
85
86
+
Here's an example:
87
+
88
+

89
+
76
90
## How is source code broken up into smaller blocks?
77
91
78
92
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.
0 commit comments