-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Static checker for the spec? #10483
Comments
Awesome to see you over here. Given your recent PRs, and how you've improved the JS spec, I was hoping you'd post something like this :) There are some previous discussions on small aspects of this in https://github.com/whatwg/html-build/issues and https://github.com/whatwg/meta/issues . E.g. whatwg/meta#190 or whatwg/html-build#89 . But nothing too comprehensive. We would definitely be amenable to making the spec more consistent and accepting PRs that do so. If we were to make this a more official/required part of the CI process, I'd have a few small things to raise:
|
This sounds great! The lint rules for non-HTML are in https://github.com/whatwg/whatwg.org/blob/main/resources.whatwg.org/build/deploy.sh FWIW. |
2 is done by an isolated JS script, too, which should be very easy to drop in: https://github.com/speced/bikeshed/blob/main/bikeshed/stylescript/var-click-highlighting.js (and https://github.com/speced/bikeshed/blob/main/bikeshed/stylescript/var-click-highlighting.css for the supporting CSS) 1 is done in Python, but the algo is fairly simple and should be an easy port to JS or Rust: https://github.com/speced/bikeshed/blob/main/bikeshed/unsortedJunk.py#L134 |
I don't know. I'm expecting (based on my experience with the ECMAScript spec) that this tool will produce a lot of 'false positives', which presumably is not something you want in a CI process.
Possibly. At first I thought no, because
I do like Python, but over the course of the ecmaspeak project, I've become somewhat frustrated with it, and the reasons would probably apply to this project too. I'm interested in Rust, but the learning curve looks steep, and I'm doubtful that this is a good first Rust project. I've used Crystal for some preliminary work, but I imagine you'd be even less keen on adding that to the build pipeline.
I agree, but I think it'll to be hard enough just to target the HTML spec. Applicability to other specs would be farther down the road.
I could certainly start by wrapping up the algorithms in the HTML spec, as that would make them easier to find for all my subsequent work. But it raises a bunch of questions, which I think I'll pose in a separate issue. |
In order to figure out all the questions, I started to do the work, and just kept going. So it'll probably be a draft PR rather than an issue. But something else has come up, so it'll probably be a few weeks before I get back to it. |
What is the issue with the HTML Standard?
While I imagine that the build process detects certain kinds of errors in the
source
file, it clearly fails to detect a lot too.I've been looking at the feasibility of developing a static checker for the HTML spec. It seems to me that chunks of the spec (in particular, the algorithms) are formulaic enough that they might be amenable to parsing, followed by static analysis. This could potentially detect:
(The idea is roughly similar to what I've done for the ECMAScript spec over at my ecmaspeak-py repo.)
So, two questions:
Has this idea come up before? If so, I'd be interested to see the discussion. (I looked in issues and PRs (open and closed) for anything like this, but didn't find anything. I particularly combed through the labels "spec tooling" and "meta".)
Would the editors be amenable if I were to suggest tweaks to the spec to make this more feasible? I don't think it would be anything major, I would mostly just identify cases where the spec uses multiple different ways to express the same thing, and have the editors pick the approved way(s) to express it.
The text was updated successfully, but these errors were encountered: