camdencheek / tree-sitter-dockerfile

A tree-sitter grammar for Dockerfile
MIT License
71 stars 20 forks source link

Tolerate blanks in line continuations after the backslash #50

Closed mjambon closed 4 months ago

mjambon commented 4 months ago

This was reported here: https://github.com/semgrep/semgrep/issues/9539

A dockerfile like the following is tolerated by docker but not by tree-sitter-dockerfile:

FROM ubuntu

# blanks (spaces or tabs) after the backslash:
RUN \       
echo hello

I don't see it documented at https://docs.docker.com/reference/dockerfile/#format It is unusual for users to expect this to work but it happens by accident and their dockerfiles work as intended, so we may have to support it.

camdencheek commented 4 months ago

I think I just fixed this actually. Will get a release out as soon as I can

mjambon commented 4 months ago

Fantastic. Thank you!

camdencheek commented 4 months ago

Should be good to go in v0.2.0. Thanks for the report!