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
Support warnings-as-errors #613
Conversation
83b1443
to
16103e9
Compare
16103e9
to
d9db669
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this feature! It just needs a quick test to make sure the command option {warningsAsErrors: true}
is hooked up to the linter configuration. You can follow this as an example: https://github.com/mozilla/web-ext/blob/master/tests/unit/test-cmd/test.lint.js#L68-L75
I originally just tested that it worked as expected against the patched I'll be 100% honest and admit that I don't fully understand how those tests are composed and how they work in this project, and I don't have a webpack-decoding capable debugger to dig into it with... But with that said, I've added some code which (to me) does look reasonable and which "tests green". Feel free to let me know what you think about it. Does it look correct? Does it suffice? if so, we just need to wait for |
d9db669
to
446aa8f
Compare
The |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the tests! I requested a few minor changes.
@@ -96,13 +104,16 @@ describe('lint', () => { | |||
boring: 'boring flag', | |||
// $FLOW_IGNORE: wrong type used for testing purpose | |||
selfHosted: 'self-hosted flag', | |||
// $FLOW_IGNORE: wrong type used for testing purpose | |||
warningsAsErrors: 'warnings-as-errors flag', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't need to add this parameter to the test because the "pass through" is already covered by the first test you added. Also, this pass through test is kind of silly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove this entirely. Or is there any reason to include it? Do the tests fail?
const config = createLinter.firstCall.args[0].config; | ||
assert.equal(config.warningsAsErrors, true); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks great! I think it would make sense to add one more test that does lint()
without specifying the warnings flag and asserts the linter is called with warningsAsErrors = undefined
(or should it be false?)
Like i tried to say: I've added some tests and they all run fine. I'm just not 100% confident about how all the bits and pieces which the tests are built from fit together, so I cannot know for certain that what I'd like to test gets tested. If you could look over my commits and double check that you think it makes sense, that would be greatly appreciated. |
Ok. Thanks for the feedback. I agree the pass-through tests looks kind of silly but I decided to add them just for the sake of consistency. I'll add another test to verify undefined behavior. Thanks again for your help. |
Also, if you merge in the latest master, I fixed the lint error (which is unrelated to your patch). |
446aa8f
to
b7460cc
Compare
And there everything in Once the update addons-linter PR is merged, everything in this PR should be good to go too. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the quick turnaround. I requested some minor test cleanup.
@@ -96,13 +104,16 @@ describe('lint', () => { | |||
boring: 'boring flag', | |||
// $FLOW_IGNORE: wrong type used for testing purpose | |||
selfHosted: 'self-hosted flag', | |||
// $FLOW_IGNORE: wrong type used for testing purpose | |||
warningsAsErrors: 'warnings-as-errors flag', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove this entirely. Or is there any reason to include it? Do the tests fail?
}).then(() => { | ||
const config = createLinter.firstCall.args[0].config; | ||
assert.equal(config.pretty, 'pretty flag'); | ||
assert.equal(config.metadata, 'metadata flag'); | ||
assert.equal(config.output, 'output value'); | ||
assert.equal(config.boring, 'boring flag'); | ||
assert.equal(config.selfHosted, 'self-hosted flag'); | ||
assert.equal(config.warningsAsErrors, 'warnings-as-errors flag'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can remove this too (unless it's needed?)
b7460cc
to
4ded9b9
Compare
I've now fixed up everything as you've asked me to, and added a And nothing seems to be happening there. Should I (or someone) file a PR to revert the yargs-changes causing this breakage? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for all the changes
Yeah, I'll wait on mozilla/addons-linter#1023 before merging
I haven't had a chance to look at it. @tofumatt have you had time to take a look? If you can see anything in the yargs changelog that stands out, let us know. I'm not sure if it's a yargs regression or not. I suspect it has something to do with how |
I haven't figured it out yet though I've looked a bit. I'll have another
On 4 November 2016 at 20:22:42, Kumar McMillan (notifications@github.com)
|
I've just taken a cursory glance at this issue, and it didn't get anywhere. I do have quite limited time at hand these days, so if you could dig deeper into this, that would really be appreciated. |
4ded9b9
to
4eee665
Compare
This patch adds support for using --warnings-as-errors as a parameter for the lint command. This complements the PR mozilla/addons-linter#1016 and completes the issue mozilla/addons-linter#1014.
4eee665
to
5019374
Compare
Just tested this patch with latest version of This PR should now be ready for merge. |
Yep, I bumped our linter dep with #632 |
Thanks for all your work on this feature! |
This patch adds support for using
--warnings-as-errors
as a parameter for the lint command.This enables the functionality provided in the PR mozilla/addons-linter#1016 and partially resolves the issue mozilla/addons-linter#1014.
Once
addons-linter
has PR accepted and merged, packages.json will also need to have the package-version bumped to fully resolve and close the issue.