Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tooomm opened this issue May 3, 2019 · 1 comment
Open

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

tooomm opened this issue May 3, 2019 · 1 comment

Comments

@tooomm
Copy link
Contributor

tooomm commented May 3, 2019

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)
  • ...
@tooomm
Copy link
Contributor Author

tooomm commented Oct 12, 2020

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:

@tooomm tooomm changed the title have travis check xml file formatting and validade against xsd CI: Check xml file formatting and validade against xsd Mar 3, 2021
@tooomm tooomm changed the title CI: Check xml file formatting and validade against xsd CI: Check xml file formatting and validate against xsd Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant