-
Notifications
You must be signed in to change notification settings - Fork 530
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
Reimplement max-warnings as a proper option #857
Conversation
30f6e6e
to
e09df5e
Compare
24d793c
to
71a2917
Compare
71a2917
to
d57be3b
Compare
1 similar comment
@@ -9,6 +9,8 @@ options: | |||
formatter: html | |||
# Output file instead of logging results | |||
output-file: 'linters/sass-lint.html' | |||
# Raise an error if more than 10 warnings are generated | |||
max-warnings: 50 |
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.
Set to 50 but the comment mentions 10
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.
Good catch. Fixed.
d57be3b
to
ac6a8fe
Compare
Looking good @nottrobin, can we add a few test cases for when the user specifically sets As a side note we will need to remember to replace that Thanks! 👍 |
Good idea. I'll get those new tests written in the next couple of hours. On Thu, 1 Sep 2016, 09:34 Dan Purdy, notifications@github.com wrote:
|
No rush, got a few other things to finish and add in 1.10 anyway. |
ac6a8fe
to
4fd8964
Compare
@DanPurdy I've now added two new tests:
|
|
||
it('should not raise error if no warnings even if `max-warnings` is zero', function (done) { | ||
var results = lint.lintFiles('sass/success.scss', {}); // no warnings | ||
lint.failOnError(results, {'max-warnings': 0}); // Max 100 warnings, should succceed |
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.
The comments are still for max 100 tests here
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.
Good point, again. I'll fix this.
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.
Done
Thanks just the copy n pasted comments to deal with and then this lgtm for me! 👍 |
- Remove custom, slightly hacky code for `max-warnings` from `bin/sass-lint.js` - Tidy up `bin/sass-lint.js` more generally - Add `max-warnings` as an option to be passed to `failOnError`, either through a config file or through passing options directly - Add documentation for the max-warnings option - Create new descriptive exceptions for `failOnError` - MaxWarningsExceededError and SassLintFailureError - Test the functionality of `failOnError`
4fd8964
to
fbaf738
Compare
Awesome, thanks @nottrobin looking good. Will come out with 1.10 in the next week or two hopefully |
Sorry @nottrobin I seemed to miss a unfortunate outcome from this to do with silencing errors and preventing unhandled exceptions with the I've had to sort of half patch the old functionality on top of yours so you should still encounter exit code 1 when max-warnings fails but the error itself won't be thrown if you're specifiying Let me know if there's any issues here and we can work a solution out. |
What do the changes you have made achieve?
This adds
max-warnings
as a proper option, including tests and documentation. This option can be set in the config file, passed straight through tofailOnError
, or set via the command-line.See #856 for more detail.
Are there any new warning messages?
No.
There's a new error message:
Have you written tests?
Yes.
Have you included relevant documentation
Yes, in
docs/options/max-warnings.md
.Which issues does this resolve?
Closes #856.
<DCO 1.1 Signed-off-by: Robin Winslow robin@robinwinslow.co.uk>