I have problems to check syntax of ruby scripts that has rails script/runner on its shebang.
Here are two example scripts and how they responses to ruby syntax checking:
Script hello_world_runner.rb
:
#!/usr/bin/env script/runner
p "Hello world!"
Script hello_world.rb
#!/usr/bin/env ruby
p "Hello world!"
Here is how I try to check the syntax. First line is a command and a second line is an output.
$ ruby -c hello_world_runner.rb
"Hello world!"
$ ruby -c hello_world.rb
SYNTAX OK
You can try this
tail -n +2 hellow_world_runner.rb | ruby -c
Not ideal but should work.