Datasets:
Download scripts/check_syntax.rb from timlawrenz/gnn-ruby-code-study: direct link, hf CLI and curl.
- Browser
- Download file 290 Bytes
-
https://huggingface.co/datasets/timlawrenz/gnn-ruby-code-study/resolve/main/scripts/check_syntax.rb
- Command line
-
hf download hf://datasets/timlawrenz/gnn-ruby-code-study/scripts/check_syntax.rb
-
curl -L -o check_syntax.rb https://huggingface.co/datasets/timlawrenz/gnn-ruby-code-study/resolve/main/scripts/check_syntax.rb
290 Bytes
| # frozen_string_literal: true | |
| require 'parser/current' | |
| # Reads code from stdin and exits with 0 if syntax is valid, 1 otherwise. | |
| begin | |
| code = $stdin.read | |
| Parser::CurrentRuby.parse(code) | |
| exit 0 | |
| rescue Parser::SyntaxError => e | |
| $stderr.puts e.message | |
| exit 1 | |
| end |