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

Test for outdated spec URLs that aren't in w3c/browser-specs #10681

Merged
merged 4 commits into from
Jun 3, 2021

Conversation

Elchi3
Copy link
Member

@Elchi3 Elchi3 commented May 31, 2021

We need to keep our specification URLs current to always provide the recommended and most up-to-date spec_urls as specified by w3c/browser-specs.

Therefore we should check all of our spec_urls against the w3c/browser-spec repository. The repo includes almost all of the BCD spec hosts but a few are missing still and so I've added a temporal allow list.

This PR fails because in main BCD doesn't use the recommend spec for ECMAScript right now. #10615 fixes that.

This adds a dev dependency to w3c/browser-specs. Sometimes, when dependabot asks us to update to a new version of browser-specs, it might fail the build because there a recommended spec from browser-specs has changed. Just like it is the case now with ECMAScript. So the idea is that this will add a mechanism that keeps spec urls up to date and relevant.

(I've never written a mocha test for BCD, please take it apart. Edit: I'm not happy with the error message, so maybe we can improve that if the overall approach of this PR makes sense.)

@Elchi3 Elchi3 requested a review from ddbeck as a code owner May 31, 2021 10:28
@github-actions github-actions bot added dependencies ⛓️ Pull requests that update a dependency package or file. infra 🏗️ Infrastructure issues (npm, GitHub Actions, releases) of this project linter 🏡 Issues or pull requests regarding the tests / linter of the JSON files. labels May 31, 2021
@Elchi3
Copy link
Member Author

Elchi3 commented Jun 1, 2021

This PR fails because in main BCD doesn't use the recommend spec for ECMAScript right now. #10615 fixes that.

I merged that PR and so this PR passes now. We now only use specs listed by w3c/browser-specs (minus the temporal allow list introduced in this PR).

Copy link
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, Florian! A couple of ideas for you in line comments.

More broadly, it's probably not optimal for us to introduce a lot of standalone linting like this, lest we traverse the whole tree a dozen times, which is rather slow. But that shouldn't stop us now. That said, the next time we want to add something like this, we should give some thought to walking the tree once and, at each feature, dispatching to individual checks.

test/spec-urls.test.js Outdated Show resolved Hide resolved
test/spec-urls.test.js Outdated Show resolved Hide resolved
test/spec-urls.test.js Outdated Show resolved Hide resolved
'https://wicg.github.io/controls-list/',
'https://w3c.github.io/webrtc-extensions/',
'https://w3c.github.io/setImmediate/',
'https://datatracker.ietf.org/doc/html/rfc2397',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of these will no longer be exceptions if w3c/browser-specs#280 is fixed.

@Elchi3
Copy link
Member Author

Elchi3 commented Jun 2, 2021

Thank you, Florian! A couple of ideas for you in line comments.

Thanks Daniel! I think I addressed your comments. Thanks for the great guidance here :)

More broadly, it's probably not optimal for us to introduce a lot of standalone linting like this, lest we traverse the whole tree a dozen times, which is rather slow. But that shouldn't stop us now. That said, the next time we want to add something like this, we should give some thought to walking the tree once and, at each feature, dispatching to individual checks.

Yeah, I totally agree. I think it is a bit unfortunate that the test outputs all of the files and even marks them as passing and then at the end another walk takes places and might tell you "oops, nope, I found more and this is actually wrong". So, yes, a general purpose traverse would be cool and then some of the current lints could maybe find their way into mocha based tests, too.

Comment on lines +55 to +56
'https://www.w3.org/TR/xpath-31/',
'https://www.w3.org/TR/xslt-30/',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These two can be removed once we removed XPath and XSLT in #9830

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Upon merging, I'll update #9830 to drop these two.


const specsExceptions = [
'https://wicg.github.io/controls-list/',
'https://w3c.github.io/setImmediate/',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be removed if/when #10746 lands

Copy link
Collaborator

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you! 🎉

@ddbeck ddbeck merged commit 88f64b0 into mdn:main Jun 3, 2021
@Elchi3 Elchi3 deleted the test-specurls branch June 3, 2021 14:29
ddbeck added a commit to ddbeck/browser-compat-data that referenced this pull request Jun 4, 2021
ddbeck added a commit that referenced this pull request Jun 4, 2021
* Bump version to v3.3.6
* Add release note for #10646
* Add release note for #10581
* Add release note for #10685
* Add release note for #10691
* Add release note for #6957
* Add release note for #10721
* Add release note for #10695
* Add release note for #9821
* Add release note for #10681
* Add release note for #10725
* Add stats
* Add release date
* Wordsmith
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies ⛓️ Pull requests that update a dependency package or file. infra 🏗️ Infrastructure issues (npm, GitHub Actions, releases) of this project linter 🏡 Issues or pull requests regarding the tests / linter of the JSON files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants