Skip to content

Commit

Permalink
rework exception mechanism so allow the webgpu and WSGL CR to be publ…
Browse files Browse the repository at this point in the history
…ished without implementation report
  • Loading branch information
deniak committed Dec 16, 2024
1 parent 47d6617 commit 6c278a3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@
"vcard",
"WHATWG",
"wcag",
"webgpu",
"webidl",
"webperf",
"webrtc",
"Whut",
"wrongprocess"
"wrongprocess",
"WGSL"
],
"dictionaries": ["html", "js", "css", "npm", "en-gb"],
"ignorePaths": [
Expand Down
6 changes: 6 additions & 0 deletions lib/exceptions.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,11 @@
{
"rule": "sotd.candidate-review-end"
}
],
"^webgpu|WGSL$": [
{
"rule": "headers.dl",
"message": "Implementation report"
}
]
}
3 changes: 2 additions & 1 deletion lib/rules/headers/dl.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export const name = self.name;
*/
function checkLink({ sr, rule = self, element, linkName, mustHave = true }) {
if (!element || !element.href) {
if (mustHave) sr.error(rule, 'not-found', { linkName });
if (mustHave)
sr.error(rule, 'not-found', { linkName, message: linkName });
return false;
}
const text = sr.norm(element.textContent).trim();
Expand Down
5 changes: 3 additions & 2 deletions lib/validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,13 @@ Specberus.prototype.validate = function (options) {
.catch(err => this.throw(err.toString()));
};

Specberus.prototype.error = function (rule, key, extra) {
Specberus.prototype.error = async function (rule, key, extra) {
let name;
if (typeof rule === 'string') name = rule;
else name = rule.name;
const shortname = this.shortname || (await this.getShortname());
if (
this.shortname !== undefined &&
shortname !== undefined &&
this.exceptions.has(this.shortname, name, key, extra)
)
this.warning(rule, key, extra);
Expand Down

0 comments on commit 6c278a3

Please sign in to comment.