Page MenuHomePhabricator

MobileFrontend extension should validate against W3C in Jenkins
Closed, ResolvedPublic

Description

After we resolve Bug 31875 lets add the W3C validator for all builds http://validator.w3.org/mobile/


Version: unspecified
Severity: enhancement

Details

Reference
bz31876

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 11:49 PM
bzimport set Reference to bz31876.
Reedy added a comment.Oct 22 2011, 3:55 AM

(In reply to comment #0)

After we resolve Bug 31875 lets add the W3C validator for all builds
http://validator.w3.org/mobile/

Is there some sort of an API for this data? So we don't have to paste and scrape the output...

Not sure how we'd actually go about doing this

The HTML code now validates as of https://gerrit.wikimedia.org/r/3801 and https://gerrit.wikimedia.org/r/3802

It could still do with an automation step though.

I should say the HTML code validates until you introduce wikitext :D - since wikitext can contain any html markup this leads to lots of validation errors on various pages.

Note sure what implementation you have in mind, but perhaps it makes sense to do this as a PHPUnit test? Generate the html, pass it over to the api using MediaWiki's Http methods and assert based on the W3 API repsonse.

Krinkle - exactly what I had in mind :-)
What if the user running phpunit does not have an internet connection? Should the tests still fail or should a warning be printed instead?

PHPUnit has various alternative modes for assertions (next to Passed and Failing). Such as "Incomplete", "Skipped" and "Broken" (which are all effectively the same as "Skipped").

jgonera wrote:

We could also run the validator ourselves I guess, not to depend on any 3rd party. They're open source:
http://dvcs.w3.org/hg/markup-validator/
https://hg.mozilla.org/projects/htmlparser/

We just ran into a bug today (unclosed div) which could have been easily trapped if we had this.

Related URL: https://gerrit.wikimedia.org/r/61775 (Gerrit Change I1414e2fbc71b090e07d4a1073ee3b6f3159f3759)

This has been bothering me for some time. I knocked up a shell script. In future we might want to run it as part of a pre-commit hook when template files change.

Code merged, marking resolved.

https://gerrit.wikimedia.org/r/61775 (Gerrit Change I1414e2fbc71b090e07d4a1073ee3b6f3159f3759) | change APPROVED and MERGED [by jenkins-bot]