fables-tales / rubyfmt

Ruby Autoformatter!
MIT License
1.07k stars 50 forks source link

`--check [FILE]` returns `0` exit code for invalid syntax #451

Open reese opened 8 months ago

reese commented 8 months ago

Input file + Rubyfmt's output

$ cat hi.rb
bad syntax in here

$ cat hi.rb | cargo run -- --check
Rubyfmt detected a syntax error in the ruby code being executed

$ echo $?
1

$ cargo run -- --check hi.rb 
Rubyfmt detected a syntax error in the ruby code being executed

$ echo $?
0

This breaks because

These two are inconsistent (despite having the same input), and realistically it should probably return 5 in both cases (since we return 5 for invalid syntax in normal runs).