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
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.
All posts from the ot-clean series
- 06 May 2016 » ot-clean, Final version
- 04 May 2016 » ot-clean, Tests refactoring
- 29 Apr 2016 » ot-clean, Refactoring and cleaning DSL (4/4)
- 26 Apr 2016 » ot-clean, Refactoring and cleaning DSL (3/4)
- 22 Apr 2016 » ot-clean, Refactoring and cleaning DSL (2/4)
- 19 Apr 2016 » ot-clean, Refactoring and cleaning DSL (1/4)
- 15 Apr 2016 » ot-clean, MatcherAssert vs Assert, which assertThat?
- 12 Apr 2016 » ot-clean, Grails 2.x/3.x, PlayFramework 2.x support
- 08 Apr 2016 » ot-clean, Complete use case
- 05 Apr 2016 » ot-clean, Scan multiple unrelated directories
- 01 Apr 2016 » ot-clean, Coveralls integration and code cleanup
- 29 Mar 2016 » ot-clean, How to access maven artifact version at runtime?
- 25 Mar 2016 » ot-clean, Wildcards
- 21 Mar 2016 » ot-clean, Zero maintenance overhead
- 18 Mar 2016 » ot-clean, Functional config file preprocessing
- 15 Mar 2016 » ot-clean, Cascade and arguments
- 11 Mar 2016 » ot-clean, Handle any project using YAML format
- 08 Mar 2016 » ot-clean, Quickstart
- 04 Mar 2016 » ot-clean, YAML node alias surprise
- 01 Mar 2016 » ot-clean, Single clean to clean them all!
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.