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

Up deps, fix vuls, update fixtures #18

Merged
merged 2 commits into from Mar 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
node_modules/
yarn.lock
Copy link
Owner

Choose a reason for hiding this comment

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

We don't use Yarn in this repo so shouldn't really need this =/ This seems like it should be in the developer's global .gitignore -- or they should use npm install

Will leave it though I guess, doesn't really hurt anyone, though might confuse them

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
Copy link
Owner

Choose a reason for hiding this comment

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

I'm guessing this is for line length, would prefer we silence that rule explicitly. Will update

.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,
Copy link
Owner

Choose a reason for hiding this comment

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

Was confused why we needed this change -- turns out in Commander@7 they moved it to an inner object to avoid unsafe usage:

tj/commander.js#1409

https://github.com/tj/commander.js/blob/4aaaa9de3fd09401afe3894483193ba0e2e512d7/CHANGELOG.md#700-2021-01-15

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);
Copy link
Owner

Choose a reason for hiding this comment

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

👍 Nice catch, surprised nobody reported this earlier o_o

});
}, 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"
}
}