inaka / aleppo

Alternative Erlang Pre-Processor
MIT License
7 stars 5 forks source link

Fix handling of missing include file by adding a dot #55

Closed aboroska closed 6 years ago

aboroska commented 6 years ago

Fixes https://github.com/inaka/elvis/issues/467. Also related to #45.

The problem is that when an include is not found aleppo places a string token in place of the include attribute as described by @elbrujohalcon here: https://github.com/inaka/aleppo/issues/45#issuecomment-319171017

This PR aims to solve it by adding a dot after the string token as it was there very likely in the source anyway as -include("file"). -include_lib("file"). attributes were correctly recognised.

By adding the dot the tools that might work on the output of aleppo will treat only the added string as a syntax error and not anything that follows until the next dot. For example katana: https://github.com/inaka/katana-code/blob/master/src/ktn_code.erl#L112-L122

Before this change katana would swallow the next term coming after the include attribute.

elbrujohalcon commented 6 years ago

Thanks @aboroska :)