Skip to content

Commit

Permalink
Remove css validator (#1085)
Browse files Browse the repository at this point in the history
* remove css validator

* remove css validator in compound.js check

* Update lib/l10n-en_GB.js

Co-authored-by: Denis Ah-Kang <[email protected]>

* Keep css correction in documentation, #1085 (review)

Co-authored-by: Denis Ah-Kang <[email protected]>
  • Loading branch information
jennyliang220 and deniak authored Jan 5, 2021
1 parent c8d0ec4 commit 05b2462
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 259 deletions.
3 changes: 1 addition & 2 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"Cmembership",
"constexpr",
"Cprocess",
"cssvalidation",
"ctor",
"customised",
"DAHUT",
Expand Down Expand Up @@ -164,4 +163,4 @@
"node_modules/**"
],
"allowCompoundWords": true
}
}
29 changes: 0 additions & 29 deletions lib/exceptions.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,5 @@
{
".*": [
{
"rule": "validation.css",
"type": "at-rule"
},
{
"rule": "validation.css",
"type": "noexistence-at-all",
"message": "Property justify-self doesn't exist : "
},
{
"rule": "validation.css",
"type": "noexistence-at-all",
"message": "Property user-select doesn't exist : "
},
{
"rule": "validation.css",
"type": "generator.unrecognize",
"message": "Parse Error"
},
{
"rule": "validation.css",
"type": "noexistence-at-all",
"message": "Property “pointer-events” doesn't exist : "
},
{
"rule": "validation.html",
"type": "noexistence-at-all",
Expand All @@ -34,11 +10,6 @@
"message": "Bad value “publication” for attribute “rel” on element “link”: The string “publication” is not a registered keyword."
}
],
"^css.*$": [
{
"rule": "validation.css"
}
],
"^webrtc$": [
{
"rule": "headers.copyright"
Expand Down
15 changes: 3 additions & 12 deletions lib/l10n-en_GB.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,10 @@ exports.messages = {
, "links.linkchecker.display": "Please verify using <a href=\"https://validator.w3.org/checklink?uri=${link}&recursive=on\">Link Checker</a>."
// links/compound
, "links.compound.skipped": "HTML and CSS validations for compound documents were skipped. "
, "links.compound.no-validation": "Validation of <a href=\"${link}\">${file}</a> <a href=\"https://validator.w3.org/nu/doc=${link}\">HTML</a> <a href=\"https://jigsaw.w3.org/css-validator/validator?profile=css3svg&uri=${link}\">CSS</a>"
, "links.compound.link": "Validation of <a href=\"${link}\">${file}</a> <a href=\"https://validator.w3.org/nu/doc=${link}\">HTML ${markup}</a> <a href=\"https://jigsaw.w3.org/css-validator/validator?profile=css3svg&uri=${link}\">CSS ${css}</a>"
, "links.compound.error": "Validation of <a href=\"${link}\">${file}</a> <a href=\"https://validator.w3.org/nu/doc=${link}\">HTML</a> <a href=\"https://jigsaw.w3.org/css-validator/validator?profile=css3svg&uri=${link}\">CSS</a>: ${errMsg}"
, "links.compound.no-validation": "Validation of <a href=\"${link}\">${file}</a> <a href=\"https://validator.w3.org/nu/doc=${link}\">HTML</a>."
, "links.compound.link": "Validation of <a href=\"${link}\">${file}</a> <a href=\"https://validator.w3.org/nu/doc=${link}\">HTML ${markup}</a>."
, "links.compound.error": "Validation of <a href=\"${link}\">${file}</a> <a href=\"https://validator.w3.org/nu/doc=${link}\">HTML</a>: ${errMsg}."
, "links.compound.html-timeout": "The HTML validator timed out."
, "links.compound.css-timeout": "The CSS validator timed out."
, "links.reliability.unreliable-link": "Link for <em>\"${text}\"</em> is pointing to unreliable domain <em>\"${link}\"</em>."
// sotd/supersedable
, "sotd.supersedable.no-sotd-intro": "No <em>&ldquo;status of this document&rdquo;</em> introduction (eg absent, not using HTTPS, wrong copy)."
Expand Down Expand Up @@ -217,14 +216,6 @@ exports.messages = {
// style/body-toc-sidebar
, "style.body-toc-sidebar.class-found": 'The class <code>toc-sidebar</code> should be added by <code>fixup.js</code>.'
, "style.body-toc-sidebar.selector-fail": 'Selector <code>body</code> failed.'
// validation/css
, "validation.css.skipped": "CSS validation was skipped."
, "validation.css.no-source": "No CSS source to validate."
, "validation.css.failure": "Failure code from CSS validator: ${status}."
, "validation.css.no-response": "No response from CSS validator."
, "validation.css.warning": "[${level}:${type}] ${message} (${source}, line ${line})<br><a href=\"${link}\">CSS validator</a>"
, "validation.css.error": "[${type}] ${message} (${source}, line ${line} in “${context}”)<br><a href=\"${link}\">CSS validator</a>"
, "validation.css.timeout": "The CSS validator timed out."
// validation/html
, "validation.html.skipped": "HTML validation was skipped."
, "validation.html.no-source": "No HTML source to validate."
Expand Down
1 change: 0 additions & 1 deletion lib/profiles/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ exports.rules = [
, require("../rules/links/reliability")

, require("../rules/validation/html")
, require("../rules/validation/css")
, require('../rules/validation/wcag')
, require('../rules/heuristic/date-format')
];
103 changes: 43 additions & 60 deletions lib/rules/links/compound.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,67 +32,50 @@ exports.check = function (sr, done) {
links = links.sort().filter(function (item, pos) {return (!pos || item != links[pos - 1]);});

var markupService = "https://validator.w3.org/nu/"
, cssService = "http://jigsaw.w3.org/css-validator/validator"
, count = 0;
if (links.length > 0) {
links.forEach(function (l) {
if (sr.config.validation === "recursive") {
var req
, reqCSS
, ua = "W3C-Pubrules/" + sr.version
, isMarkupValid = false
, isCSSValid = false;
req = sua.get(markupService)
.set("User-Agent", ua)
.query({ doc: l, out: "json" })
.on('error', function(err) {
sr.error(self, 'error', { file : l.split('/').pop(), link : l, errMsg: err});
count++;
return;
});
req.timeout(TIMEOUT);
req.end(function (err1, res) {
if (err1 && err1.timeout === TIMEOUT) sr.warning(self, "html-timeout");
var json = res ? res.body : null;
if (!json) return sr.throw("No JSON input.");
if (json.messages) {
var errors = json.messages.filter(function(msg) {
return msg.type === "error";
});
if (errors.length === 0) isMarkupValid = true;
}
reqCSS = sua.get(cssService)
.set("User-Agent", ua)
.query({ uri: l, profile: "css3svg", output: "json", type: "html" })
.on('error', function(err) {
sr.error(self, 'error', { file : l.split('/').pop(), link : l, errMsg: err});
count++;
return;
});
reqCSS.timeout(TIMEOUT);
reqCSS.end(function (err2, res) {
if (err2 && err2.timeout === TIMEOUT) sr.warning(self, "css-timeout");
if (res && res.header && res.header['x-w3c-validator-status'] === 'Valid') isCSSValid = true;
if (isMarkupValid && isCSSValid) {
sr.info(self, "link", { file : l.split('/').pop(), link : l , markup : "\u2714", css : "\u2714" });
}
else {
const details = {
file: l.split('/').pop(),
link: l,
markup: (isMarkupValid ? "\u2714" : "\u2718"),
css: (isCSSValid ? "\u2714" : "\u2718")
};
sr.error(self, "link", details);
}
count++;
if (count === links.length) return done();
});
});
}
else {
sr.info(self, "no-validation", { file : l.split('/').pop(), link : l });
}
});
links.forEach(function (l) {
if (sr.config.validation === "recursive") {
var req
, ua = "W3C-Pubrules/" + sr.version
, isMarkupValid = false;
req = sua.get(markupService)
.set("User-Agent", ua)
.query({ doc: l, out: "json" })
.on('error', function(err) {
sr.error(self, 'error', { file : l.split('/').pop(), link : l, errMsg: err});
count++;
return;
});
req.timeout(TIMEOUT);
req.end(function (err1, res) {
if (err1 && err1.timeout === TIMEOUT) sr.warning(self, "html-timeout");
var json = res ? res.body : null;
if (!json) return sr.throw("No JSON input.");
if (json.messages) {
var errors = json.messages.filter(function(msg) {
return msg.type === "error";
});
if (errors.length === 0) isMarkupValid = true;
}
if (isMarkupValid) {
sr.info(self, "link", { file : l.split('/').pop(), link : l , markup : "\u2714"});
}
else {
const details = {
file: l.split('/').pop(),
link: l,
markup: (isMarkupValid ? "\u2714" : "\u2718")
};
sr.error(self, "link", details);
}
count++;
if (count === links.length) return done();
});
}
else {
sr.info(self, "no-validation", { file : l.split('/').pop(), link : l });
}
});
} else return done();
};
110 changes: 0 additions & 110 deletions lib/rules/validation/css.js

This file was deleted.

19 changes: 0 additions & 19 deletions test/docs/validation/bad-css.html

This file was deleted.

21 changes: 0 additions & 21 deletions test/docs/validation/css.html

This file was deleted.

5 changes: 0 additions & 5 deletions test/validation.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
*/

if (!process || !process.env || (process.env.TRAVIS !== 'true' && !process.env.SKIP_NETWORK)) {
exports.css = [
{doc: 'validation/simple.html', ignoreWarnings: true}
, {doc: 'validation/css.html', ignoreWarnings: true}
, {doc: 'validation/bad-css.html', errors: ['validation.css.error', 'validation.css.error'], ignoreWarnings: true}
];
exports.html = [
{doc: 'validation/simple.html'}
, {doc: 'validation/invalid.html', errors: ['validation.html.error']}
Expand Down

0 comments on commit 05b2462

Please sign in to comment.