Skip to content

Commit

Permalink
Merge pull request #18 from antongolub/fix-vuls
Browse files Browse the repository at this point in the history
Up deps, fix vuls, update fixtures
  • Loading branch information
twolfson committed Mar 7, 2021
2 parents b694a83 + 09936f2 commit 234006a
Show file tree
Hide file tree
Showing 17 changed files with 315 additions and 115 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
node_modules/
yarn.lock
23 changes: 13 additions & 10 deletions lib/cli.js
Expand Up @@ -29,8 +29,8 @@ exports._parse = function (argv, _console, callback) {
DEFAULT_SLEEP_MS)
.option('--concurrency <concurrency>',
'Amount of requests to run in parallel, defaults to ' + DEFAULT_CONCURRENCY, DEFAULT_CONCURRENCY)
.option('--usermedium <usermedium>', 'Medium where the CSS will be used (e.g. `all` (service default), `print`, `screen`)')
.option('--profile <profile>', 'CSS profile to use for validation (e.g. `css3svg` (service default), `css21`, `svg`)')
.option('--usermedium <usermedium>', 'Medium where the CSS will be used (e.g. `all` (service default), `print`, `screen`)') // jscs:disable
.option('--profile <profile>', 'CSS profile to use for validation (e.g. `css3svg` (service default), `css21`, `svg`)') // jscs:disable
.option('--lang <lang>', 'Language to use in response (e.g. `en` (service default), `bg`, `de`)')
.option('--warning <warning>', 'Warning level to set (e.g. `0`, `1`, `2` (service default), `no`)')
.option('--vextwarning <vextwarning>',
Expand All @@ -40,6 +40,9 @@ exports._parse = function (argv, _console, callback) {
// Process our arguments
program.parse(argv);

// Get program opts
var opts = program.opts();

// Assume we are OK by default
var status = STATUS_OK;

Expand All @@ -54,17 +57,17 @@ exports._parse = function (argv, _console, callback) {
}

// Otherwise, perform our validation
async.eachOfLimit(filepathContentArr, program.concurrency,
async.eachOfLimit(filepathContentArr, opts.concurrency,
function handleFilepathContent (filepathContent, i, cb) {
var filepath = filepaths[i];
var options = {
text: filepathContent,
w3cUrl: program.w3cUrl,
usermedium: program.usermedium,
profile: program.profile,
lang: program.lang,
warning: program.warning,
vextwarning: program.vextwarning
w3cUrl: opts.w3cUrl,
usermedium: opts.usermedium,
profile: opts.profile,
lang: opts.lang,
warning: opts.warning,
vextwarning: opts.vextwarning
};

validateCss(options, function handleValidateCss (err, data) {
Expand Down Expand Up @@ -96,7 +99,7 @@ exports._parse = function (argv, _console, callback) {
}

// Continue
setTimeout(cb, program.sleep);
setTimeout(cb, opts.delay);
});
}, function handleResults (err) {
// If there was an error, callback with it
Expand Down
28 changes: 14 additions & 14 deletions package.json
Expand Up @@ -33,24 +33,24 @@
"test": "mocha && npm run lint"
},
"dependencies": {
"async": "~2.1.5",
"commander": "~2.9.0",
"form-data": "~0.1.2",
"async": "~3.2.0",
"commander": "~7.1.0",
"form-data": "~4.0.0",
"obj-extend": "~0.1.0",
"readable-stream": "~1.1.9",
"sax": "~0.5.5"
"readable-stream": "~3.6.0",
"sax": "~1.2.4"
},
"devDependencies": {
"chai": "~3.5.0",
"eight-track": "~1.3.0",
"eight-track-normalize-multipart": "~0.1.0",
"express": "~3.21.2",
"foundry": "~4.3.2",
"foundry-release-git": "~2.0.2",
"chai": "~4.3.3",
"eight-track": "~2.1.0",
"eight-track-normalize-multipart": "~0.2.0",
"express": "~4.17.1",
"foundry": "~4.4.2",
"foundry-release-git": "~2.0.3",
"foundry-release-npm": "~2.0.2",
"jscs": "~3.0.7",
"jshint": "~2.9.4",
"mocha": "~3.2.0",
"jshint": "~2.12.0",
"mocha": "~8.3.1",
"twolfson-style": "~1.6.1"
},
"keywords": [
Expand All @@ -64,4 +64,4 @@
"foundry-release-npm"
]
}
}
}
2 changes: 1 addition & 1 deletion test/cli_test.js
Expand Up @@ -59,6 +59,6 @@ describe('An invalid CSS file processed by our CLI', function () {
});

it('outputs our expected warning', function () {
expect(this.stderr).to.contain('invalid.css:3:\n Property -moz-box-sizing');
expect(this.stderr).to.contain('invalid.css:3:\n -moz-box-sizing” is an unknown vendor extension');
});
});
4 changes: 2 additions & 2 deletions test/css-validator_test.js
Expand Up @@ -70,7 +70,7 @@ describe('A invalid CSS file being validated', function () {
describe('A valid CSS URI being validated', function () {
runValidateCssUri(function () {
return {
uri: 'https://cdn.rawgit.com/twolfson/css-validator/0.7.0/test/test-files/valid.css'
uri: 'https://gitcdn.link/repo/twolfson/css-validator/0.7.0/test/test-files/valid.css'
};
});

Expand All @@ -84,7 +84,7 @@ describe('A valid CSS URI being validated', function () {
describe('A invalid CSS URI being validated', function () {
runValidateCssUri(function () {
return {
uri: 'https://cdn.rawgit.com/twolfson/css-validator/0.7.0/test/test-files/invalid.css'
uri: 'https://gitcdn.link/repo/twolfson/css-validator/0.7.0/test/test-files/invalid.css'
};
});

Expand Down

This file was deleted.

This file was deleted.

@@ -0,0 +1,38 @@
{
"request": {
"httpVersion": "1.1",
"headers": {
"host": "localhost:1337",
"connection": "close"
},
"trailers": {},
"method": "GET",
"url": "/css-validator/validator?output=soap12&w3cUrl=http%3A%2F%2Flocalhost%3A1337%2Fcss-validator%2Fvalidator&uri=https%3A%2F%2Fgitcdn.link%2Frepo%2Ftwolfson%2Fcss-validator%2F0.7.0%2Ftest%2Ftest-files%2Fvalid.css",
"bodyEncoding": "utf8",
"body": ""
},
"response": {
"httpVersion": "1.1",
"headers": {
"cache-control": "no-cache",
"date": "Sun, 07 Mar 2021 10:21:41 GMT",
"pragma": "no-cache",
"transfer-encoding": "chunked",
"content-language": "en",
"content-type": "application/soap+xml;charset=utf-8",
"server": "Jigsaw/2.3.0-beta3",
"vary": "Accept-Language",
"access-control-allow-origin": "*",
"access-control-allow-headers": "content-type,accept-charset",
"access-control-allow-methods": "GET, HEAD, POST, OPTIONS",
"access-control-max-age": "600",
"x-w3c-validator-errors": "0",
"x-w3c-validator-status": "Valid",
"connection": "close"
},
"trailers": {},
"statusCode": 200,
"bodyEncoding": "utf8",
"body": "<?xml version='1.0' encoding=\"utf-8\"?>\n<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">\n <env:Body>\n <m:cssvalidationresponse\n env:encodingStyle=\"http://www.w3.org/2003/05/soap-encoding\"\n xmlns:m=\"http://www.w3.org/2005/07/css-validator\">\n <m:uri>https://gitcdn.link/repo/twolfson/css-validator/0.7.0/test/test-files/valid.css</m:uri>\n <m:checkedby>http://jigsaw.w3.org/css-validator/</m:checkedby>\n <m:csslevel>css3</m:csslevel>\n <m:date>2021-03-07T10:21:41Z</m:date>\n <m:validity>true</m:validity>\n <m:result>\n <m:errors xml:lang=\"en\">\n <m:errorcount>0</m:errorcount>\n \n </m:errors>\n <m:warnings xml:lang=\"en\">\n <m:warningcount>0</m:warningcount>\n </m:warnings>\n </m:result>\n </m:cssvalidationresponse>\n </env:Body>\n</env:Envelope>\n\n"
}
}
@@ -0,0 +1,38 @@
{
"request": {
"httpVersion": "1.1",
"headers": {
"host": "localhost:1337",
"connection": "close"
},
"trailers": {},
"method": "GET",
"url": "/css-validator/validator?output=soap12&w3cUrl=http%3A%2F%2Flocalhost%3A1337%2Fcss-validator%2Fvalidator&uri=https%3A%2F%2Fgitcdn.link%2Frepo%2Ftwolfson%2Fcss-validator%2F0.7.0%2Ftest%2Ftest-files%2Finvalid.css",
"bodyEncoding": "utf8",
"body": ""
},
"response": {
"httpVersion": "1.1",
"headers": {
"cache-control": "no-cache",
"date": "Sun, 07 Mar 2021 10:21:01 GMT",
"pragma": "no-cache",
"transfer-encoding": "chunked",
"content-language": "en",
"content-type": "application/soap+xml;charset=utf-8",
"server": "Jigsaw/2.3.0-beta3",
"vary": "Accept-Language",
"access-control-allow-origin": "*",
"access-control-allow-headers": "content-type,accept-charset",
"access-control-allow-methods": "GET, HEAD, POST, OPTIONS",
"access-control-max-age": "600",
"x-w3c-validator-errors": "1",
"x-w3c-validator-status": "Invalid",
"connection": "close"
},
"trailers": {},
"statusCode": 200,
"bodyEncoding": "utf8",
"body": "<?xml version='1.0' encoding=\"utf-8\"?>\n<env:Envelope xmlns:env=\"http://www.w3.org/2003/05/soap-envelope\">\n <env:Body>\n <m:cssvalidationresponse\n env:encodingStyle=\"http://www.w3.org/2003/05/soap-encoding\"\n xmlns:m=\"http://www.w3.org/2005/07/css-validator\">\n <m:uri>https://gitcdn.link/repo/twolfson/css-validator/0.7.0/test/test-files/invalid.css</m:uri>\n <m:checkedby>http://jigsaw.w3.org/css-validator/</m:checkedby>\n <m:csslevel>css3</m:csslevel>\n <m:date>2021-03-07T10:21:02Z</m:date>\n <m:validity>false</m:validity>\n <m:result>\n <m:errors xml:lang=\"en\">\n <m:errorcount>1</m:errorcount>\n \n <m:errorlist>\n <m:uri>https://gitcdn.link/cdn/twolfson/css-validator/b694a83b93fa9ffb2150dd2fbab75223a49b3bd2/test/test-files/invalid.css</m:uri>\n \n <m:error>\n <m:line>2</m:line>\n <m:errortype>parse-error</m:errortype>\n <m:context>body</m:context> \n <m:errorsubtype>\n exp\n </m:errorsubtype>\n <m:skippedstring>\n url(ab &apos;cd&apos;)\n </m:skippedstring>\n <m:type>value</m:type>\n \n <m:message>\n \n Value Error : background (nullcolors.html#propdef-background)\n \n &#8220;url(ab &apos;cd&apos;)&#8221; is not a &#8220;background-color&#8221; value : \n </m:message>\n </m:error>\n \n </m:errorlist>\n \n </m:errors>\n <m:warnings xml:lang=\"en\">\n <m:warningcount>1</m:warningcount>\n \n <m:warninglist>\n <m:uri>https://gitcdn.link/cdn/twolfson/css-validator/b694a83b93fa9ffb2150dd2fbab75223a49b3bd2/test/test-files/invalid.css</m:uri>\n \n <m:warning>\n <m:line>3</m:line>\n <m:level>0</m:level>\n <m:message>&#8220;-moz-box-sizing&#8221; is an unknown vendor extension</m:message>\n <m:type>vendor-extension</m:type>\n </m:warning>\n \n </m:warninglist>\n </m:warnings>\n </m:result>\n </m:cssvalidationresponse>\n </env:Body>\n</env:Envelope>\n\n"
}
}

0 comments on commit 234006a

Please sign in to comment.