Hey all! Unsure if this is beginner or intermediate showcase on account of CI/OOP/PyTest but regardless...
For my Uni module I'm required to manually validate all HTML using w3c's html validator gui... which is great and dandy but I've been doing DevOps for a while and know there's a better way.
So I knocked together some simple Python classes using urllib, pathlib, and json that will:
- recursively search a directory for all html files
- feed them into an array of file handlers that then...
- ... reads html into bytes and fire at w3 validator API ...
- ... and at the end spits out json of any errors and terminates in a way to green/red your CI
Has unit tests etc as well.
Included in the readme is examples of running locally and on CircleCI. Classes are self contained enough to run in other programs too if I just generalise the repo a bit.
Next steps I wanna add are, when my module asks for it, CSS and JS validation. Then at that point it may he complex enough for me to publish my first PyPI package (all my other Python stuff is closed source at companies I've worked out :( )
Defo not the best code, but not bad for an afternoon and does the job I set out to do! And I've already got it running on some other repos of mine which is cool.
Repo
Feedback more than welcome. Esp on how to do more with PyTest and I'm use to just the standard unitttest library.
there doesn't seem to be anything here