k0kubun / hamlit

High Performance Haml Implementation
https://rubygems.org/gems/hamlit
Other
980 stars 60 forks source link

Raise haml error when compile check #189

Closed dlwr closed 2 years ago

dlwr commented 2 years ago

( This Pull Request has been continued from https://github.com/k0kubun/hamlit/pull/188#issuecomment-1028590147 )

raise the error in Hamlit::Parser when hamlit compile -c to check haml error.

$ cat invalid-haml-syntax.haml
%h1
  title
%div
 %span

Before this Pull Request

$ bundle exec exe/hamlit compile -c invalid-haml-syntax.haml
Syntax OK
$ echo $?
0

After this Pull Request

$ bundle exec exe/hamlit compile -c invalid-haml-syntax.haml
bundler: failed to load command: exe/hamlit (exe/hamlit)
(haml):4: Inconsistent indentation: 1 space used for indentation, but the rest of the document was indented using 2 spaces. (Hamlit::HamlSyntaxError)
...

$ echo $?
1