Closed Bug 1080419 Opened 10 years ago Closed 10 years ago

Add an optional HTML validator to the Grunt build script

Categories

(Tree Management :: Treeherder, defect, P3)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: emorley, Assigned: emorley)

References

Details

Attachments

(1 file)

49 bytes, text/x-github-pull-request
Details | Review
eg:
https://www.npmjs.org/package/grunt-html-angular-validate

It will hopefully help avoid issues like bug 1071092.
Commit pushed to master at https://github.com/mozilla/treeherder-ui

https://github.com/mozilla/treeherder-ui/commit/220bde784fd9290f6de4f6a770fbb490a4f47c71
Bug 1080419 - Put devDependencies in alphabetical order

This means if |npm install foo --save-dev| is now used in the future,
the diff will be much clearer, since it won't also change the order of
existing entries.
Work in progress:
https://github.com/mozilla/treeherder-ui/compare/html-validation?expand=1

Run using |grunt htmlangular|

Unfortunately since our templates use .html as an extension (compared to something specific we could add to the options), the validator throws up lots of errors for them, since it doesn't know to handle them specially (https://github.com/nikestep/grunt-html-angular-validate#optionstmplext). As such, this initial WIP doesn't check the directories containing partials, just app/*.html.

Running with the WIP gives:

[/c/src/treeherder/treeherder-ui]$ grunt htmlangular
Running "htmlangular:files" (htmlangular) task

Validating webapp/app/help.html ...ERROR
[L18:C289] & did not start a character reference. (& probably should have been escaped as &.)

Validating webapp/app/index.html ...ERROR
[L4:C50] Element title must not be empty.
[L7:C61] Bad value X-UA-Compatible for attribute http-equiv on element meta.
[L8:C64] Bad value cache-control for attribute http-equiv on element meta.
[L10:C25] Element th-favicon-link not allowed as child of element body in this context. (Suppressing further errors from this subtree.)
[L13:C71] Element link is missing required attribute property.
[L14:C86] Element link is missing required attribute property.
[L15:C78] Element link is missing required attribute property.
[L16:C72] Element link is missing required attribute property.
[L17:C77] Element link is missing required attribute property.
[L20:C11] Stray end tag head.
[L21:C77] An body start tag seen but an element of the same type was already open.
[L21:C77] Cannot recover after last error. Any further errors will be ignored.

Validating webapp/app/logviewer.html ...ERROR
[L22:C49] Bad value {{logRevisionFilterUrl}} for attribute href on element a: Illegal character in path segment: not a URL code point.
[L30:C47] Attribute lv-log-steps not allowed on element div at this point.
[L36:C46] Attribute on-load-more not allowed on element div at this point.
[L36:C46] Attribute lv-infinite-scroll not allowed on element div at this point.
[L36:C46] Attribute lv-log-lines not allowed on element div at this point.
Warning: HTML validation failed Use --force to continue.
Assignee: nobody → emorley
Also meant to say, the supposed advantage of this validator over others, is that it knows to ignore validation errors due to use of Angular (eg the use of "ng-foo" attributes rather than the more correct "data-ng-foo"). How successful it is at this I don't know.
Status: NEW → ASSIGNED
Attached file WIP
Commits pushed to master at https://github.com/mozilla/treeherder-ui

https://github.com/mozilla/treeherder-ui/commit/7e8c587def7424c61d6dadb8976e57e9ed09f85f
Bug 1080419 - Add an optional grunt HTML validator

Run using |grunt htmlangular|

https://github.com/mozilla/treeherder-ui/commit/cd1bc898692a067e3e1972adbc0f4ab898671fdd
Merge pull request #246 from mozilla/html-validation

Bug 1080419 - Add an optional grunt HTML validator
No longer blocks: 1072681
Component: Treeherder → Treeherder: Docs & Development
Blocks: 1110107
No longer blocks: 1071092
This bug landed the validator support in the repo, which can be used using |grunt htmlangular|.

I'm breaking out the next step (making use of this as part of the Travis job) to bug 1110107.
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Summary: Add an HTML validator to the Grunt build script and/or Travis run → Add an optional HTML validator to the Grunt build script
Commits pushed to master at https://github.com/mozilla/treeherder

https://github.com/mozilla/treeherder/commit/6252e0748d5947724023faf68aa13d0ec4e83446
Bug 1080419 - Put devDependencies in alphabetical order

This means if |npm install foo --save-dev| is now used in the future,
the diff will be much clearer, since it won't also change the order of
existing entries.

https://github.com/mozilla/treeherder/commit/3597e08d3e7ced62b34e8c09461a08acbe9da285
Bug 1080419 - Add an optional grunt HTML validator

Run using |grunt htmlangular|

https://github.com/mozilla/treeherder/commit/df98fee7572430c2a7afe571cddaba9c94d037d5
Merge pull request #246 from mozilla/html-validation

Bug 1080419 - Add an optional grunt HTML validator
Component: Treeherder: Docs & Development → TreeHerder
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: