Skip to content

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

@tooomm

Description

@tooomm

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: Cockatrice/Cockatrice#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 (#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: #108 (comment) or #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 (#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:

  • script that updates <info> key with "date & time (UST)" and version information after each merge (+dispatch)
  • check all image links and report unavailable ones ✔️done
  • script that checks ordering of elements (relations: alphabetical, pics: newest set on top) and attributes (count before exclude) etc. (See sort sets and cards #165 for example, and Improve documentation #111 for more infos)
  • script that ensures there are no typos in keys (should be catched with the xsd validation already?)
  • remove unused token relations #160 has some ideas and scripts (the doubled entry could be part of the xsd schema file maybe? xsd:unique or xsd:key?)
  • script that checks whether related card names exist in AtomicCards.json (MTGJSON) or if there is a potential typo that leads to a broken connection in Cockatrice / Or query the Scryfall API for the card names instead of using the file from MTGJSON?
  • check fields for typos (like "type" or "maintype", against list or against scryfall/mtgjson data)
  • ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions