RSpec won't use syntax_suggest
Nobody has claimed this yet.
- Dominant language
- Ruby
- Stars
- 350
- Forks
- 17
- Avg merge
- 48m
- Merged PRs (30d)
- 5
Description
I wrote a sample RSpec code to test syntax_suggest and Ruby 3.2.0rc1: https://github.com/JunichiIto/syntax_suggest_sandbox
I have a wrong spec file:
https://github.com/JunichiIto/syntax_suggest_sandbox/blob/main/spec/sample_spec.rb
RSpec.describe 'sample' do
exampledo
expect(1 + 1).to eq 2
end
end
I added gem "syntax_suggest" to Gemfile and --require syntax_suggest to .rspec according to README.
- https://github.com/JunichiIto/syntax_suggest_sandbox/blob/main/Gemfile
- https://github.com/JunichiIto/syntax_suggest_sandbox/blob/main/.rspec
I ran bundle exec rspec but RSpec won't use syntax_suggest:
$ bundle exec rspec
An error occurred while loading ./spec/sample_spec.rb.
Failure/Error: __send__(method, file)
SyntaxError:
/Users/jnito/dev/sandbox/syntax_suggest_sandbox/spec/sample_spec.rb:5: syntax error, unexpected `end'
# /Users/jnito/dev/sandbox/syntax_suggest_sandbox/vendor/bundle/ruby/3.2.0+3/gems/rspec-core-3.12.0/lib/rspec/core/configuration.rb:2117:in `load'
# /Users/jnito/dev/sandbox/syntax_suggest_sandbox/vendor/bundle/ruby/3.2.0+3/gems/rspec-core-3.12.0/lib/rspec/core/configuration.rb:2117:in `load_file_handling_errors'
# /Users/jnito/dev/sandbox/syntax_suggest_sandbox/vendor/bundle/ruby/3.2.0+3/gems/rspec-core-3.12.0/lib/rspec/core/configuration.rb:1617:in `block in load_spec_files'
# /Users/jnito/dev/sandbox/syntax_suggest_sandbox/vendor/bundle/ruby/3.2.0+3/gems/rspec-core-3.12.0/lib/rspec/core/configuration.rb:1615:in `each'
# /Users/jnito/dev/sandbox/syntax_suggest_sandbox/vendor/bundle/ruby/3.2.0+3/gems/rspec-core-3.12.0/lib/rspec/core/configuration.rb:1615:in `load_spec_files'
# /Users/jnito/dev/sandbox/syntax_suggest_sandbox/vendor/bundle/ruby/3.2.0+3/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:102:in `setup'
# /Users/jnito/dev/sandbox/syntax_suggest_sandbox/vendor/bundle/ruby/3.2.0+3/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:86:in `run'
# /Users/jnito/dev/sandbox/syntax_suggest_sandbox/vendor/bundle/ruby/3.2.0+3/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:71:in `run'
# /Users/jnito/dev/sandbox/syntax_suggest_sandbox/vendor/bundle/ruby/3.2.0+3/gems/rspec-core-3.12.0/lib/rspec/core/runner.rb:45:in `invoke'
# /Users/jnito/dev/sandbox/syntax_suggest_sandbox/vendor/bundle/ruby/3.2.0+3/gems/rspec-core-3.12.0/exe/rspec:4:in `<top (required)>'
# /Users/jnito/dev/sandbox/syntax_suggest_sandbox/vendor/bundle/ruby/3.2.0+3/bin/rspec:25:in `load'
# /Users/jnito/dev/sandbox/syntax_suggest_sandbox/vendor/bundle/ruby/3.2.0+3/bin/rspec:25:in `<top (required)>'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/lib/ruby/3.2.0+3/bundler/cli/exec.rb:58:in `load'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/lib/ruby/3.2.0+3/bundler/cli/exec.rb:58:in `kernel_load'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/lib/ruby/3.2.0+3/bundler/cli/exec.rb:23:in `run'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/lib/ruby/3.2.0+3/bundler/cli.rb:486:in `exec'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/lib/ruby/3.2.0+3/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/lib/ruby/3.2.0+3/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/lib/ruby/3.2.0+3/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/lib/ruby/3.2.0+3/bundler/cli.rb:31:in `dispatch'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/lib/ruby/3.2.0+3/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/lib/ruby/3.2.0+3/bundler/cli.rb:25:in `start'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/lib/ruby/gems/3.2.0+3/gems/bundler-2.4.0.dev/libexec/bundle:48:in `block in <top (required)>'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/lib/ruby/3.2.0+3/bundler/friendly_errors.rb:120:in `with_friendly_errors'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/lib/ruby/gems/3.2.0+3/gems/bundler-2.4.0.dev/libexec/bundle:36:in `<top (required)>'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/bin/bundle:25:in `load'
# /Users/jnito/.rbenv/versions/3.2.0-rc1/bin/bundle:25:in `<main>'
#
# Showing full backtrace because every line was filtered out.
# See docs for RSpec::Configuration#backtrace_exclusion_patterns and
# RSpec::Configuration#backtrace_inclusion_patterns for more information.
No examples found.
Finished in 0.00002 seconds (files took 0.09691 seconds to load)
0 examples, 0 failures, 1 error occurred outside of examples
CLI command works fine:
$ syntax_suggest spec/sample_spec.rb
--> /Users/jnito/dev/sandbox/syntax_suggest_sandbox/spec/sample_spec.rb
Unmatched `end', missing keyword (`do', `def`, `if`, etc.) ?
1 RSpec.describe 'sample' do
> 2 exampledo
> 4 end
5 end
How can I use syntax_suggest when I ran bundle exec rspec ?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Gemfile, .rspec, and spec/sample_spec.rb, then read the syntax_suggest README and reproduce the difference between bundle exec rspec and syntax_suggest spec/sample_spec.rb. Trace how RSpec loads the invalid spec and determine what is needed for syntax_suggest to report the syntax error during the RSpec run. Done means the provided sample produces syntax_suggest output through bundle exec rspec.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ruby
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100