Java Developer

ot-clean, YAML node alias surprise

I’m working on version 0.4 now where I want to add support for wildcard matching. In other words, I would like to remove all log files from the project by simply adding *.log pattern. For test purposes I created simple clean.yml file:

deletes:
 - *.log

and got the nasty exception:

while scanning an alias
 in 'string', line 2, column 4:
     - *.log
       ^
expected alphabetic or numeric character, but found /
 in 'string', line 2, column 5:
     - *.log
        ^

Star at the beginning of the line is illegal in YAML. Why? It looks like it supports feature called Alias Nodes. In order to avoid that you have to use double quotes like this:

deletes:
 - “*.log”

I really don’t like a need of adding double quotes into deletes section. The idea for now is to preprocess YAML a bit and add double quotes before parsing by YAML library. I’ll put this into backlog but I’m really disappointed by the complexity of current YAML format. Functionality like this is making space for new file formats. I would not be surprised when seeing some YAML-Lite version specs in the near future.

The ot-clean series

This blog post is one of the series about the ot-clean. Simple open source tool that maintains your projects directories cleaned from all the garbage. Feel free to look at the source code or readme page for more information. You can also submit pull request or post suggestion. This text participates in open source blogging competition.

Project status

Build Status

All posts from the ot-clean series


Like it? Share it on , , ,

About the author

Grzegorz Gajos, Software Architect with international consulting and programming background. Co-founder of Open Tangerine Software House. Quality evangelist. An experienced entrepreneur, out of the box thinker and problem solver.