travis-ci / travis-yaml

parses, normalizes, validates and serializes your .travis.yml
http://yaml.travis-ci.org/
MIT License
170 stars 66 forks source link

syntax error: did not find expected alphabetic or numeric character while scanning an anchor #91

Closed kenorb closed 8 years ago

kenorb commented 8 years ago

I've got the following code in my .travis.yml:

before_cache:
  - [ -d ~/.wine ] && find ~/.wine/drive_c -type l -delete

however the syntax fails (travis lint), because of:

[x] syntax error: (): did not find expected alphabetic or numeric character while scanning an anchor at line x column 20

This is a valid shell command, why this is limited only to alphabetic or numeric characters? Should this be fixed?

Currently the only workaround I see is to change it into test -d ~/.wine && ....

svenfuchs commented 8 years ago

Thanks for the report, @kenorb

This is indeed not valid YAML syntax. Try quoting the string like so:

before_cache:
  - "[ -d ~/.wine ] && find ~/.wine/drive_c -type l -delete"

You can always check the validity of your YAML online here