Cockatrice / Magic-Token

Tokens.xml for M:tG
The Unlicense
11 stars 15 forks source link

CI: Check xml file formatting and validate against xsd #65

Open tooomm opened 5 years ago

tooomm commented 5 years ago

Should have helped with the little errors we just corrected.

I guess the Cockatrice xsd would have spotted the <prop> key issues? But yeah, I know... no such updated file yet for v4: https://github.com/Cockatrice/Cockatrice/issues/3696

Travis setup is easy, but we would need e.g. a little python script to do the actual checks and produce some useful output in the travis logs.


We could also check if the date is modified, to prevent changes that don't bump the version. Or have tests that make sure each name/identifier is unique and the layout and ordering in the file is uniform and aligns with what we decided it should be --> have better docs and write such things down (https://github.com/Cockatrice/Magic-Token/issues/111).

Maybe we can also check for typos in e.g. card names and correct/verify wording (scryfall? gatherer? other third party source?)? Or make sure all tokens are added to our file, or make sure all card links are in place etc. (It's all on scryfall, e.g. https://scryfall.com/sets/tafr, https://scryfall.com/card/tafr/22/tomb-of-annihilation, https://api.scryfall.com/cards/search?q=Tomb%20of%20Annihilation ...) Maybe new tokens could even be automatically sourced at one point (similar to how spoiler are done)?

Find broken image links and non-alphabetical ordering (or whatever the pattern is).

Ensure opening and closing tags are matching and don't break reading the file: https://github.com/Cockatrice/Magic-Token/pull/108#discussion_r671629262 or https://github.com/Cockatrice/Magic-Token/pull/181

CI could also compare all sets in the token file with the ones available in MTGJSON to prevent typos there or the usage of wrong/non-existent set codes (https://github.com/Cockatrice/Magic-Token/pull/116).

Hint: https://github.com/Cockatrice/Cockatrice/wiki/Custom-Cards-&-Sets#diagnosing-problems-in-your-xml-file


Other helpful checks that could be done in CI:

tooomm commented 4 years ago

Tackled this in #93 and used xmllint, the output is helpful and Travis (using GitHub Actions in between) spotted some new errors right away.


Several interesting Actions from GH Marketplace that might help with the idea: