Adds directives validator
Adds directives validator
To ease the testing, here's a link to an online go compiler, it is only needed to click "Fork this" to be able to modify the cpci.hdf file and try different directives combinantions
@equetzal I ask your review since the validator should validate every directive we currently support, though I feel like a review might come handy in case I forgot something or something else might be good to update / rethink.
I hardcoded the path to the hdf to ease testing on the GoLand ide but I'll update it to support receiving the directives file as an argument later on but before merging.
@equetzal I ask your review since the validator should validate every directive we currently support, though I feel like a review might come handy in case I forgot something or something else might be good to update / rethink.
I hardcoded the path to the hdf to ease testing on the GoLand ide but I'll update it to support receiving the directives file as an argument later on but before merging.
Pretty new on Go too, I'll be needing some time to test this and better review it. I've not seen the code but I'll say some facts on here that we need to check with the validator and if some is different on your code, we need to update them.
- All sections must be present:
[Always],[Event],[Event-Time], etc. - For timezones we need to have a set of valid strings a validate them to exist and be current according to IANA. E.g.
America/Mexico_City - For XKBs keyboards we can also have a set of valid XKBs and check they exist on the system.
- All the dates needs to follow the ISO standard in local timezone
- All the time-windows (like Event-Times) needs to be before and after, if they do not match they're wrong.
- All the time-windows needs to be at list 1 min wide.
- The software also needs to be validated
- The URLs needs to be well-formed URLs but we won't check existence of the web/file etc.
- The wallpaper hashes can be validated by characters and length
- All variables needs to be present to avoid empty directives